Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDialog woes

Androclese Antonelli
Org. B-Day: 05/11/04
Join date: 25 Apr 2006
Posts: 96
05-24-2006 22:41
I am writing a multi-script application (yes, still)

I've run into a weird scripting issue that I need a hand with.

My primary script generates a dialog menu. A button is selected and another menu is generated. Another button is selected and a llMessageLinked function is kicked off.

The sub-script picks up the link message and processes it, leading to a function being executed (do_colorselect in the code below). This function, parallel in design to the previous two llDialog menu's fails to execute, spitting out a "llDialog - must supply a message" error.

here is the code I'm using on the sub-script. When I move this to a stand-along script, it works just fine. Any idea what might be happening?
CODE

// Dialog Menu Values
integer MENU_HANDLE;
integer MENU_CHANNEL;

// function type: A text string to help us keep track of what functions we are processing
string currentfunction;

// Color List for the Color Change function
list colorlistdesc = [ "Red", "Green", "Blue", "Yellow", "Orange", "Purple", "Pink", "Cyan", "L.Grey", "D.Grey", "Black", "White" ];
list colorlist = [ "<1, 0, 0>", "<0, 1, 0>", "<0, 0, 1>", "<1, 1, 0>", "<1, 0, 1>", "<0, 1, 1>", "<0.75, 0.75, 0.75>", "<0.5, 0.5, 0.5>", "<0, 0, 0>", "<1, 1, 1>" ];

// Color Selection Dialog
do_colorselect(key agent) {
// list buttons = colorlistdesc;
string title = "Select a Color from the List below:\n asdiuasdoiunadiundu";
MENU_CHANNEL = llFloor(llFrand(-99999.0 - 1));
MENU_HANDLE = llListen(MENU_CHANNEL,"",llDetectedKey(0) ,"");
llSay(DEBUG_CHANNEL, (string)llDumpList2String(colorlistdesc, " "));
llSay(DEBUG_CHANNEL, title);
llDialog(agent, title, colorlistdesc, MENU_CHANNEL);
// llDialog(agent, "hi", [ "button" ], 0);
llSetTimerEvent(10.0);
}

default
{
state_entry()
{
state standby;
}

// Restart the Jukebox on rez
on_rez (integer p) {
llResetScript();
}

// Restart the Jukebox when ownership has been handed off
changed (integer change) {
if (change && CHANGED_OWNER) {
llResetScript();
}
}
}

state standby {
// Restart the Jukebox whenever it is rez'd
on_rez (integer p) {
llResetScript();
}

// Restart the Jukebox when ownership has been handed off
changed (integer change) {
if (change & CHANGED_OWNER) {
llMessageLinked (LINK_SET, 50000, "", ""); // Call a Master Reset
}
}

//Kill the timer and close the menu handle
timer() {
llSetTimerEvent(0.0);
llListenRemove(MENU_HANDLE);
}

listen(integer channel, string name, key id, string message) {
if ( channel == MENU_CHANNEL ) { // Wrong Channel Filter
if ( currentfunction == "nowplayingcolor" ) {
integer userpick = llListFindList(colorlistdesc, (list)message);
string color = llList2String(colorlist, userpick);
llMessageLinked (LINK_SET, 1501, (string)color, "");
}
}
}

link_message(integer sender_num, integer number, string message, key messagealt) {
// Master Restart
if ( number == 50000 ) {
llResetScript() ;
}
// Color Change Request
if ( number == 1500 ) {
currentfunction = "nowplayingcolor";
do_colorselect(llDetectedKey(0));
}
}
}
_____________________
The Sculpted Garden

Originally Born 5/11/2004 - New AV, Old Player.

If you leave the game, don't delete your account, just make it 'free'. You'll lose your inventory like I did. *sniff*
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-24-2006 23:14
hmm....
From: someone
Note: The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events.
:confused:
_____________________
:) Seagel Neville :)
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
05-25-2006 01:58
The way it looks from that (it might be different in the actual code) is that list colorlistdesc is a local variable defined in a different span to the function to write the dialog box. Thus colorlistdesc is an empty list and the dialog box complains. I'd have expected a syntax error on compiling too mind, unless you've declared is as a global, then redeclared it as a local, once you've left the span the local gets cleared and boom, no buttons, complaints.
Androclese Antonelli
Org. B-Day: 05/11/04
Join date: 25 Apr 2006
Posts: 96
05-25-2006 05:22
From: Seagel Neville
hmm....
Note: The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events.
:confused:


*sigh*

This is the 3rd time that this has come back to bite my in the backside. You would think that I would have learned by now.

Thanks, I know how to fix it now.

Eloise Pasteur, it is a global list since I recycle that list into 2 other functions (on to change the emitter light, and one to change another type of text). The formatting was weird on the cut-n-paste. It shows left aligned for me in the edit box. *shrug*


Edit: After doing what I thought was the correct answer, and not getting a good result, I threw in a TON of debug messages. It turns out that the primary script is still trying to catch the listen response and the sub-script never gets to the generate the menu. This is a process problem then dealing with when I generate the listen channel and how I activate the listen process. *oops*

Edit 2: The final solution ended up being that I was not doing a return after sending the link message in the primary script. By ommiting the return, certain values did not get reset and the primary script sat in the wrong process, still trying to listen for a response.

Thanks to everybody who helped me out, I really appreciate it!
_____________________
The Sculpted Garden

Originally Born 5/11/2004 - New AV, Old Player.

If you leave the game, don't delete your account, just make it 'free'. You'll lose your inventory like I did. *sniff*