Jump to content

Get info on state_entry


XbabylonX
 Share

You are about to reply to a thread that has been inactive for 3763 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 example

state 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

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

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

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

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

You are about to reply to a thread that has been inactive for 3763 days.

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
 Share

×
×
  • Create New...