Change font size
It is currently Sun Jul 22, 2018 3:29 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: 4 buttons, 1 prim
PostPosted: Mon Mar 23, 2009 10:14 pm 

Joined: Fri Mar 06, 2009 6:58 am
Posts: 11
1 prim, 4 buttons.
Gives notecard, landmark, url and object.
If you drag them into it first, that is.
Glad to see llDetectedTouchST is working.

{L_CODE}:
// 1 prim, 4 button notecard, landmark, item, url giver
// drop 1 of each in the prim, paste web url in the description-box of the prim
// ( r-click on prim > Edit > General Tab > Description > your url )
//this script is free for all

// DEFINE THE GRID ON THE PRIM
integer GridColumns = 1;
integer GridRows = 4;
// INDEX FOR BUTTONS
list index;
// DEFINE BUTTONS, BOTTOM LEFT TO TOP RIGHT PLUS VARIOUS VARIABLES
list GridButtons = ["OBJECT4", "OBJECT3", "OBJECT2", "OBJECT1"];
string ButtonLabel;
integer ButtonIndex;
string ButtonWord;
//////////////////////////
default
{
    state_entry()
    {
        // CREATE AN INDEX OF COORDINATES BASED ON THE GRID
        integer y;
        for(y=0; y <= GridRows - 1; y++)
        {
            integer x;
            for(x=0; x <= GridColumns - 1; x++)
            {
                index += (list)((string)<(float)x,(float)y,0.0>);
            }
        }
    }
    touch_start(integer total_number)
    {
        // LOOK UP CLICKED BUTTON IN BUTTON INDEX LIST AND DO SOMETHING
        vector pos = llDetectedTouchST(0);
        integer x = llCeil(GridColumns * pos.x);
        integer y = llCeil(GridRows * pos.y);
        vector gridPos = <(float)x,(float)y,0.0>;
        gridPos = gridPos - <1.0,1.0,0.0>;
        // LOOK UP CLICKED BUTTON IN BUTTON INDEX LIST AND DO SOMETHING
        ButtonIndex = llListFindList(index, (list)((string)gridPos));
        if(ButtonIndex != -1)
        {
            // GET THE DATA FROM THE BUTTON, CHECK IT'S NOT EMPTY
            ButtonLabel = llList2String(GridButtons, ButtonIndex);
            if (ButtonLabel == "OBJECT1")

                //Give notecard
            {
                llGiveInventory(llDetectedKey(0),
                llGetInventoryName (INVENTORY_NOTECARD,0));
            }
            else if (ButtonLabel == "OBJECT2")
            {
                //give landmark
                llGiveInventory(llDetectedKey(0),
                llGetInventoryName (INVENTORY_LANDMARK,0));
            }
            else if (ButtonLabel == "OBJECT3")
            {
                //give item
                llGiveInventory(llDetectedKey(0),
                llGetInventoryName (INVENTORY_OBJECT,0));
            }
        else if (ButtonLabel == "OBJECT4")
        {
                //go to website
                string page = llGetObjectDesc();           
                llLoadURL(llDetectedOwner(0),"",page);
        }
    }
}
}


Top
 Profile  
 
 Post subject: Re: 4 buttons, 1 prim
PostPosted: Mon Mar 23, 2009 11:35 pm 
Furious Typer
User avatar

Joined: Thu Feb 05, 2009 8:40 pm
Posts: 86
Location: CyberSpace of course, however, my keyboard is currently in Bakersfield, CA USA, earth, SOL, etc.
That's kewl, I tried it but couldn't figure out what an "item" is/was, it that like a Texture or an Object or what ???

@ any rate I was able to put in the [x] NoteCard, [x] place the URL in the description, [x]

... meanwhile, a friend from SL game me this on the other day, and it kinda does the same thing, but ya can put all sorts of stuff in the [Content] {TAB} in I think any order, and place the script in there as well in any random order, etc.

Funny, how many ways there R 2 skin a KAT :)

{L_CODE}:
// Copyright 2004, Trimming Hedges.  Released to the public domain.

// This is a simple script that gives everything in a box to the person who clicked. 
// By default, it will only give items to the owner of the box.

// I wrote this because of all the texture bundles that are given out.  It's really a PAIN
// to move a lot of textures or other contents out of a box.  This speeds that up.

// This is NOT a vending script.  You can use this script to give everything in a box to someone, by changing 'owneronly' to be 0.  BUT:
//
//  I suggest not using this script in an area where several people are going to touch it at once, because giving inventory is slow.
//  Version 2.0 of this script now detects multiple simultaneous touches: it is still slow, but it should work better at classes or events.

//  THIS IS NOT A VENDING SCRIPT.  It gives items away, it does NOT SELL THEM.  (You don't need a script for most vending anyway.)
//  This script doesn't give itself away.  If you want it to, put it in the box, and set it to not running.
//  Then rename a copy and put that in the box too.  The renamed copy should be the running one. 
//  Rename it FIRST, I had weird issues with renaming it when it was already in
//  the box. (version 1.2.12 of SL.)

integer owneronly = 1;
key owner;

default
{
    state_entry()
    {
        owner = llGetOwner();       
    }

    touch_start(integer total_number)
    {
        integer i;
        for (i=0;i<total_number;i++)
        {
            key target = llDetectedKey(i);
       
            if ( (target != owner) && (owneronly == 1) )  // person clicking isn't owner and owneronly is set;
            {
                llInstantMessage(target,"Sorry, only the owner is allowed to get my contents.");
                return;
            }
            list inventory_types = [INVENTORY_BODYPART,INVENTORY_CLOTHING,INVENTORY_LANDMARK,INVENTORY_NOTECARD,INVENTORY_OBJECT,INVENTORY_SCRIPT,INVENTORY_SOUND,INVENTORY_TEXTURE];
            integer inventory_count = llGetListLength(inventory_types);
            integer j;
            integer k;
            integer type;
            integer typecount;
            string myname = llGetScriptName();
            string objectname;

            for (j=0; j<inventory_count;j++)
            {
                type = llList2Integer(inventory_types,j); // get the next inventory type from the list
                typecount = llGetInventoryNumber(type);  // how many of that kind of inventory is in the box?
                if (typecount > 0)
                {
                    for (k=0; k<typecount;k++)
                    {
                        objectname = llGetInventoryName(type,k);
                        if (objectname != myname)  // don't give self out so the user doesn't get fifty thousand copies.
                        {
                            llGiveInventory(target,objectname);
                        }
                    }
                }           
            }
        }
    }
}


C U on the Grid and/or Chat :geek:

_________________
10/4 M.D.

<aka>Valentine MichaelSmith


Top
 Profile  
 
 Post subject: Re: 4 buttons, 1 prim
PostPosted: Wed Mar 25, 2009 11:34 am 

Joined: Fri Mar 06, 2009 6:58 am
Posts: 11
Trimming Hedges! I met once, Eons ago. He's as cool as his name and I believe every SLAv has 1 or more of his scripts in their inventory, most without knowing it :) .

Indeed there are many ways to de-texturize a V-line, lol.
Mr. Hedges' script gives all that's in inventory on 1 click, one by one.
The other divides a prim's face into 1 column of 4 rows/ buttons, one for each type of inventory.
The Item button hands out an object.
A very beginning scripter myself ( copy, paste, mess around, save, pray, return to wiki), I found it useful to better understand llDetectedTouchST.

Cheers,
AriesdB


Top
 Profile  
 
 Post subject: Re: 4 buttons, 1 prim
PostPosted: Wed Mar 25, 2009 2:29 pm 
Furious Typer
User avatar

Joined: Thu Feb 05, 2009 8:40 pm
Posts: 86
Location: CyberSpace of course, however, my keyboard is currently in Bakersfield, CA USA, earth, SOL, etc.
4 the record, boy did I ever read that script wrong, (althought I did put it in a box 4 2 nano-seconds) and moved along, the next, something about my ADHD disorder me things and/or the constant battle 4 control of his fingers, we thinks, yes precious ...

Down 2 the point, I'll have ta have another look @ that script & give it the play it deserves on the Q.T.

{L_IMAGE}

How kewl can it be to Touch 4 different areas of something and get 4 different reactions, (flipper/flipper) [button/button]

_________________
10/4 M.D.

<aka>Valentine MichaelSmith


Top
 Profile  
 
 Post subject: Re: 4 buttons, 1 prim
PostPosted: Wed Mar 25, 2009 3:00 pm 
Furious Typer
User avatar

Joined: Thu Feb 05, 2009 8:40 pm
Posts: 86
Location: CyberSpace of course, however, my keyboard is currently in Bakersfield, CA USA, earth, SOL, etc.
I'm so glad no 1 said RTFM, even if the script was WELL DOCumented.

{L_IMAGE}

Works like the text said, now I can think of all sorts of use for this animal, once it's been named. - Adam :)

_________________
10/4 M.D.

<aka>Valentine MichaelSmith


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net