assigning a "user id" when touched script?
|
Sanity Karuna
Registered User
Join date: 24 Jun 2004
Posts: 20
|
08-12-2004 05:13
Hi, I'm sure this is possible but I haven't been able to find it yet. Basiclly what I want to do is when a avatar touches an object it sets the key "userID" mostly so they can see llDialog functions. I could get it to work with money like this: From: someone default { state_entry(integer moo) {} money (key id, integer amount) { playerID = id; ammount_paid = amount; state playing; } } state playing { state_entry() { llDialog(userID, "Some random question?", [ "yes", "no" ], 21); llListen(21, "", userID, ""  ; } listen(integer channel, string name, key id, string msg) { if (msg == "yes"  {} } } I would like the same thing to happen when the avatar simply touches it but I could not find the function? thank you!
|
Cailyn Miller
mmm.... shiny
Join date: 11 Mar 2003
Posts: 369
|
08-12-2004 05:42
check out the llDetected range of functions... touch(integer total_number) { key id = llDetectedKey(total_number - 1); llDialog( id, "Some random question?", [ "yes", "no" ], 21); // blah blah }
http://www.badgeometry.com/wiki/Detected
_____________________
 BLOG: http://cailyn-sl.blogspot.com/ INWORLD: http://slurl.com/secondlife/Gisborne/113/187/27 OnRez: http://shop.onrez.com/Cailyn_Miller SLX: http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=512
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
08-12-2004 09:57
Also, to format code, use the tags. (Accessible through the # button above the message text.) There are a lot of... uh... I'm going to go with "purists" here who will be more inclined to help if they can read your code easily.
|
Nexus Nash
Undercover Linden
Join date: 18 Dec 2002
Posts: 1,084
|
08-12-2004 10:34
Ok it took me a good 2 mins to try and read that.. next time do as Cat says... here key gId; integer gListener;//force of habit when playing with Dialog integer gCom;
default { touch_start(intege num) { gId = llDetectedKey(0); state Dialog; } }
state Dialog { state_entry() { //this is my standard dialog thingy gCom = (integer)(llFrand(2400000) + 1); gListener = llListen(gCom,"",Id,"");//will alow you to drop the listener
//then all the dialog stuff here! llDialog(Id,"Foobar!",["Foo","Bar"],gCom);
} state exit() { llListenRemove(gListener);//or llremovelisten... can remember }
}
btw... how THE HELL do you tab?!
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
08-12-2004 10:51
The only web browser I know of that supports tabbing in an inline form element is IE. It's not standard UI, so most browsers don't do it.
If you want tabs, just do it in SciTE or Notepad or Emacs or something.
|
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
|
08-12-2004 11:06
From: someone Originally posted by Nexus Nash btw... how THE HELL do you tab?! Hey Nexus, long time no see! If it's a short job and not worth typing out in another editor, I usually - Type in the script sans-tabs - Go to one of the numerous open text editors that are always on my screen, make a tab, highlight the tab and CTRL-C copy it - CTRL-V paste a bunch of tabs in to the forum post edit window.
_____________________
Sarcasm meter: 0 |-----------------------*-| 10 Rating: Awww Jeeze!
|
Sanity Karuna
Registered User
Join date: 24 Jun 2004
Posts: 20
|
08-12-2004 12:39
Ok it works now thank you =) I also had one more question. Is it possible to send strings keys and integers to other objects that are not linked?
Like if One object is touched it will pick a random number then send it to another object on the other side of the room and keep it in an integer?
|
Sanity Karuna
Registered User
Join date: 24 Jun 2004
Posts: 20
|
08-12-2004 12:39
Ok it works now thank you =) I also had one more question. Is it possible to send strings keys and integers to other objects that are not linked?
Like if One object is touched it will pick a random number then send it to another object on the other side of the room and keep it in an integer?
eep sorry double clicked send
|