Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pay enabled when it shouldn't be - bug

Jimmy Loveless
Hello, avatar!
Join date: 1 Oct 2004
Posts: 35
02-05-2005 02:24
I have come up with a conclusive way to reproduce this bug, which was discussed a little in an earlier thread.

Background:
Entering a state that contains a money event should enable the pay menu for a user's right click. Entering a state that does not contain a money event should disable the pay menu. If the script is in a prim in a linked set, sometimes pay is not disabled when in should be, depending on which prim in the linkset the user right-clicks on.

Observations:
Any object that is a linked set of prims with a script with multiple states (some with a money event and some without) will exhibit this behavior. If you create the object I describe below and you never take it into your inventory, it will always work fine. If the object is in a state where it is not accepting payments and you take it into inventory then flop it back out, it will always work fine. However, If you take it into inventory and rez it back out while the object is in a state with a money event, every prim in the object (other than the prim containing the script) will now ALWAYS accept payments regardless of the script state. The prim containing the script will still enable and disable the pay menu correctly. This means if the user is right clicking on the prim containing the script, they will observe the behavior intended by the script. If the user is clicking on some other prim in the linkset, they will be able to pay your object when the script is not expecting it, and the object will just silently accept their money if the script is in a state without a money event when they pay.

Conclusion:
After rezzing an object that had been taken into inventory with an active money event, whatever happens internally to control the pay menu throughout the linkset gets hosed. Going in and out of inventory without an active money event "fixes" it [edit: albeit temporarily].


To reproduce bug:

1. Make a few prims & link em together.
2. Put this script in the root prim:

CODE

// Script to enable and disable money for the prim by clicking on the object

default //no money event, pay menu is disabled
{
state_entry()
{
llSetText("No money state active.", <0, 1, 0>, 1);
}

touch_start(integer total_number)
{
state use_money_event;
}
}


state use_money_event //has money event, pay menu is enabled
{
state_entry()
{
llSetText("Money state is active.", <0, 1, 0>, 1);
}

touch_start(integer total_number)
{
state default;
}

money(key id, integer amt)
{
llSay(0, "You paid me " + (string)amt);
}
}


3. Play with it a bit, checking that the pay menu is properly enabled/disabled no matter which prim you right-click on.

4. While money is disabled, take it into your inventory & rez it again. Notice that everything still works just fine.

5. Now take it into inventory while the money event is active. Drop it out again, disable the money event and now you will notice that on the root prim, the pay menu is disabled, but on every other prim the pay menu is still enabled. If you pay it, notice that there is no acknowledgement from the script because the script is in a money-less state.

6. Now, if you set it to NOT accept payments, take it back into inventory again and flop it back out, hey, its fixed again.

If you want one of these test objects but dont wanna put it together yourself, IM me in-world and I'll send you one.

Weak workarounds:
One workaround is to make sure your object is not in a state with a money event when you take it into inventory. [edit: this even seems ineffective -- after a while the object goes back to the described buggy behavior] Another is to put a "PAY HERE" graphic somewhere on your root prim. :rolleyes: Another workaround is to have a money event in every friggin state in your script, and refund money if it is paid at an inappropriate time, tho I have even seen this fail.

Best, JL

p.s. this may or may not be the right place for a bug report, but the little bug report window in the SL client... well... isn't great.
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
06-03-2006 15:46
I've noticed this defect is still present in the latest version, Second Life 1.10.1 (0). I've also found another work around:
CODE

// Script to enable and disable money for the prim by clicking on the object

default //no money event, pay menu is disabled
{
state_entry()
{
llSetText("No money state active.", <0, 1, 0>, 1);
}

touch_start(integer total_number)
{
state use_money_event;
}
}


state use_money_event //has money event, pay menu is enabled
{
state_entry()
{
llSetText("Money state is active.", <0, 1, 0>, 1);
}
on_rez (integer s)
{
llResetScript ();
}

touch_start(integer total_number)
{
state default;
}

money(key id, integer amt)
{
llSay(0, "You paid me " + (string)amt);
}
}

Simply put llResetScript into the on_rez event handler in the use_money_event state and everything seems to behave normally again.