Jump to content

problem when Detected key


sndbad Ghost
 Share

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

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

Recommended Posts

hello there ,

my problem when i want Detected key UUID avatar

so when i click on the object its work fine ,but when i pay dosnt work 

object says: Object: 00000000-0000-0000-0000-000000000000 = 00000000-0000-0000-0000-000000000000

anyy idea for fix that ?

 

thanks 

 

 

 
default
{
    on_rez(integer i)
    {
        llResetScript();
    }
 
    state_entry()
    {

    }
 
    touch_start(integer total_number)
    {
        integer i = 0;
        for (; i < total_number; ++i)
        {
            llSay(0, llDetectedName(i) + " = " + (string)llDetectedKey(i));
        }
    }
 
     money(key id, integer amount)
    {
                integer i = 0;
        for (; i < amount; ++i)
        {
            llSay(0, llDetectedName(i) + " = " + (string)llDetectedKey(i));
        }
    }

}

 

Link to comment
Share on other sites

There is no fix.

llDetectedXXXX functions work in touch and sensor events - nowhere else.

The "amount" variable in your money event contains the number of lindens that was payed to your object. So think about your loop and why it makes no sense.

From your script I have no clue what you try to do. Maybe tell what you want to do?

  • Like 1
Link to comment
Share on other sites

As the wiki says:

 

not in the money() event.

But money() is even easier: it passes in the "id" variable, which is presumably what you wanted with llDetectedKey(). And under most circumstances where a money() event is generated, llKey2Name() of that key should give what you'd have gotten with llDetectedName()

  • Like 1
Link to comment
Share on other sites

I see.

Then you need a global variable (at top of the script)

In the money event you store the payer's id in the global variable.

In the touch event you give the gift to the last payer and reset the variable.
Of course - only if the owner touches it must give a gift and not on everyones touch.

So you need something like this:

key	lastpayer = NULL_KEY;string	lastpayername;default{    touch_start(integer total_number)    {        if (llDetectedKey == llGetOwner()) {		if (lastpayer) {			llOwnerSay("Lastpayer: " + lastpayername + " = " + lastpayer);			// now give the gift to lastpayer			lastpayer = NULL_KEY;
} else { llOwnerSay("No new payer"); } } } money(key id, integer amount) { lastpayer = id; lastpayername = llKey2Name(id); // llKey2Name only works if the payer is still around // if that is a problem you need to use llRequestAgentData // and a dataserver event } on_rez(integer i) { llResetScript(); } }

 

 

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...