Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dialog does not work for next owner...

HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
08-25-2008 08:51
This script works for me but when I give the object it is in to my alt for testing, it never reaches the submenu. Any help much appreciated - thanks!

CODE

integer CHANNEL = -96711111; // dialog channel

list MENU_MAIN = ["Door", "Particles", "Spire", "Style"]; // the main menu
list MENU_DOOR = ["Open", "Close", "...back"]; // a submenu
list MENU_PARTICLES = ["Blue", "White", "...back", "Purple", "Red", "Green", "On", "Off"]; // a submenu
list MENU_STYLE = ["Concrete", "Steel", "...back", "Brick", "Bunker", "Club", "Default", "Beach"]; // a submenu
list MENU_SPIRE = ["Show", "Hide", "...back"]; // a submenu


default {
state_entry()
{
llListen(CHANNEL, "",llGetOwner(), ""); // listen for dialog answers
}

touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner())
{
llDialog(llDetectedKey(0), "\nTo change your Vivelo Skybox, please make a selection below...", MENU_MAIN, CHANNEL);
}
}

listen(integer Lchannel, string name, key id, string message)
{
llOwnerSay(message);

if (llListFindList(MENU_MAIN + MENU_DOOR + MENU_PARTICLES + MENU_STYLE + MENU_SPIRE, [message]) > -1) // verify dialog choice
{

// present main menu on request to go back
if (message == "...back")
llDialog(id, "\nTo change your Vivelo Skybox, please make a selection below...", MENU_MAIN, CHANNEL);

// present submenus on request
else if (message == "Door")
llDialog(id, "\nOpen or close the door below...", MENU_DOOR, CHANNEL);

else if (message == "Particles")
llDialog(id, "\nTurn the particles on or off or change colors below...", MENU_PARTICLES, CHANNEL);

else if (message == "Style")
llDialog(id, "\nChange the textures for a totally new look below...", MENU_STYLE, CHANNEL);


else if (message == "Spire")
llDialog(id, "\nShow or hide the building's bottom spire below...", MENU_SPIRE, CHANNEL);

else // not a main menu item, broadcast the message to the link set
llMessageLinked(LINK_SET, 0, message, NULL_KEY);
}

else
llOwnerSay("You picked an invalid option '" + llToLower(message) + "'."); // not a valid dialog choice
}
}

[end code]
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-25-2008 08:56
From: HatHead Rickenbacker

CODE

state_entry()
{
llListen(CHANNEL, "",llGetOwner(), ""); // listen for dialog answers
}

Scripts don't reset when they change owner. Without a reset (or state change) your state_entry above is only going to get called when you, YOU, first run it.

You could do something like this to reset the script whenever it changes to a new owner.
CODE

changed (integer mask)
{
if (mask & CHANGED_OWNER)
{
llOwnerSay ("Ack! My creator sold me down the river, that bastard!! resetting...");
llResetScript();
}
}
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
08-25-2008 08:58
Meade Paravane - awesome thanks!

I must also admit this is not the first time that forgetting this has tripped me up - but it shall be the last!
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-25-2008 08:59
:)
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
revochen Mayne
...says
Join date: 14 Nov 2006
Posts: 198
08-25-2008 08:59
Yes, Meade is right.
a bit shorter to reset the script is is using a on_rez event with a llResetScript() in.
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-25-2008 09:03
From: revochen Mayne
a bit shorter to reset the script is is using a on_rez event with a llResetScript() in.

It all sorta depends on what the script does..

Another option, if resetting is something that will mess the script up, is have a global to store the handle returned by llListen then close and redo the listen when the owner changes. Or when it rezzes. Or whenever..

Or only do the listen when you know you're going to call llDialog then close the listen once you get the response or after a timeout.

I've also become a fan of using random channel numbers - lot less chance of having the script get confused if more than one of the objects is nearby..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
HatHead Rickenbacker
Registered Loser
Join date: 6 Nov 2006
Posts: 133
08-25-2008 09:08
i always use random integers for multi-users but this is owner only.

Damn you for being so correct! =D
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
08-25-2008 12:01
For scripts where I don't want to reset for some reason, rather than saving the listen handle, I simply change state, which relinquishes any listens that are in effect.

For example:

CODE

state reFoo {
state_entry() { state foo; }
}

state foo {
state_entry() {
llListen(...)
}

changed(integer change) {
if (change & CHANGED_OWNER) {
state reFoo;
}
}
}
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
08-26-2008 13:34
From: Meade Paravane

llOwnerSay ("Ack! My creator sold me down the river, that bastard!! resetting...";);
llResetScript();


That's awesome! I'm stealing that...
_____________________
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-26-2008 13:38
:)
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left