XbabylonX Posted January 31, 2014 Share Posted January 31, 2014 Hello,Im trying to get avatar's key id in the state_entry of a state called Two.Notice that the user gets in the state Two after a different state called One, for examplestate One { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { state Two; } } So in place of the ??? in the following code:state Two { state_entry() { AvatarKey=??? } } what should I write? Thank you for your time. Link to comment Share on other sites More sharing options...
steph Arnott Posted January 31, 2014 Share Posted January 31, 2014 state Two{ state_entry() { //AvatarKey=??? key owner = llGetOwner(); }} If detecting another agent then will need to be in the touch envent, key toucher = llDetectedKey(0); Link to comment Share on other sites More sharing options...
Qie Niangao Posted January 31, 2014 Share Posted January 31, 2014 Which avatar? If you mean the one who touched, back in state One, then you knew that to be llDetectedKey(0) in the touch_start handler, so you could store that in a global variable there and reference it anywhere else thereafter. If you want some other avatar, you'll have to explain how you know about them. Link to comment Share on other sites More sharing options...
XbabylonX Posted January 31, 2014 Author Share Posted January 31, 2014 Thank you for your replies. You both must be correct. Here is the deal: 1) Someone clicks a prim for a payment 2) After payment is done, I want to popup a dialog box with text input Just like you saying, I have to be careful with the process. Any advice on how to make it as it should? Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 31, 2014 Share Posted January 31, 2014 As Qie says, capture the person's UUID in a touch_start or touch_end event, save it in a global key variable, and use it again later when you need it in a llDialog call. Or, if you have the prim set to CLICK_ACTION_PAY, so that a click triggers a money event directly, either capture the UUID there or use it immediately, in the money event, for your dialog. Link to comment Share on other sites More sharing options...
XbabylonX Posted January 31, 2014 Author Share Posted January 31, 2014 Rolig, I guess you mean here "money(key id, integer amount)" , in my own code: money(key id, integer amount) { state Two; } the key id is the avatar id, right? If yes, I have to set a global variable inside the money brackets? Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 31, 2014 Share Posted January 31, 2014 A global variable is always declared at the top of your script, before state default. It is global because once you define it there it is accessible anywhere in your script including, in your case, the money event. When you load a value into a global event, that value is retained and can be accessed (or changed) anywhere else that you use the variable. So yes, if you load the value supplied by id into your new global variable, you will be able to use it elsewhere. That's the technical answer about syntax. Your more basic challenge is logic. Before you work on how to do something, you need a clear idea of what you want to do and the flow of events that must occur logically if you are going to get there. Until you can do it in your head, it's a good idea to make yourself a flow diagram of some kind on paper. Link to comment Share on other sites More sharing options...
XbabylonX Posted February 1, 2014 Author Share Posted February 1, 2014 That worked perfect. Thank you steph Arnott, Qie Niangao, Rolig. Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 1, 2014 Share Posted February 1, 2014 WooHoo! :smileyvery-happy: Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now