llListen() calls in functions....
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
07-15-2006 01:11
llDialog(llGetOwner(), msg, buttons, -10101); listenID=llListen(-10101, "", llGetOwner(), ""); OK... if I put these lines in a function call (which contains a lot of other stuff that's kind of private for the person that commissioned it) I get the dialog box fire, but the listen event never fires. If I take them out and put them into the body of the script it fires just fine and dandy... Since when can't you set listeners in a function call? I'm not doing anything funky like changing states. Is this a bug, or have I missed something?
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
07-15-2006 01:18
From: Eloise Pasteur llDialog(llGetOwner(), msg, buttons, -10101); listenID=llListen(-10101, "", llGetOwner(), ""); OK... if I put these lines in a function call (which contains a lot of other stuff that's kind of private for the person that commissioned it) I get the dialog box fire, but the listen event never fires. If I take them out and put them into the body of the script it fires just fine and dandy... Since when can't you set listeners in a function call? I'm not doing anything funky like changing states. Is this a bug, or have I missed something? I think you've missed something. I've got plenty of llDialog and llListen function calls in functions and no problems. I'd suggest that you're over-writing the listen handle? Or perhaps your listen event handler has a semicolon at the end of the line, like: listen (...); // <<<< The semicolon shouldn't be here! { //... }
|
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
07-15-2006 01:29
This script works properly, for what it's worth: integer listenID;
TestFunction() { listenID=llListen(0, "", llGetOwner(), ""); }
default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer num_detected) { TestFunction(); } listen(integer ch, string name, key id, string msg) { llSay(0, msg + " = success"); llListenRemove(listenID); } }
Have you tried reversing those two lines?
|
|
Zuleica Sartre
Registered User
Join date: 27 Sep 2005
Posts: 105
|
07-15-2006 08:58
From: Eloise Pasteur llDialog(llGetOwner(), msg, buttons, -10101); listenID=llListen(-10101, "", llGetOwner(), ""); OK... if I put these lines in a function call (which contains a lot of other stuff that's kind of private for the person that commissioned it) I get the dialog box fire, but the listen event never fires. If I take them out and put them into the body of the script it fires just fine and dandy... Since when can't you set listeners in a function call? I'm not doing anything funky like changing states. Is this a bug, or have I missed something? Well considering we can't see the overall structure of your code... Where is this function called? If you are not exiting the event handler that calls this function then the listen event handler will never 'fire'. Are there loops after this code that would prevent the event handler calling this function from completing?
|
|
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
|
07-15-2006 10:20
From: Eloise Pasteur llDialog(llGetOwner(), msg, buttons, -10101); listenID=llListen(-10101, "", llGetOwner(), ""); Have no idea why - but the listen has to go first else it fails - I have been caught by that before.
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
07-15-2006 14:49
I can't show the whole code because it's got a lot of stuff covered by an NDA.
It compiles, and works if I just cut and paste the function back into the main body of the text from the place I was thinking of initially calling the function - so it's not the order (which does work either way for me with no bother quite regularly), it's not a stray semi-colon (which would stop it compiling successfully anyway, it's a mistake I have made after all) and no there are no funny loops after it, no loops at all near it.
I've given up and scripted it a different way, and sacrificed a couple of lines of code and some memory to make it work, but having stared at the code for ages I still can't see what I've missed. Maybe the asshat server was just having fun with me.
|