Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can you change stage from within a function call?

AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
05-27-2007 17:50
Main program, simiplified to the part giving trouble:-
CODE

. . . .
DoLink(); //Call to function that is not intended to return due to state change
. . . .


Then the function DoLink:-

CODE

DoLink(){
llMessageLinked(LINK_THIS,Command_Number,Command_Data,NULL_KEY);
llOwnerSay("Diagnostic Leaving DoLink for state DoCom");
state DoCom;
}


and then the state waiting for a reply from another script:-

CODE

state DoCom {
state_entry() {
llOwnerSay("Diagnostic Arrived in state DoCom");
}

link_message(integer sender, integer num, string data, key id) {
ReturnMessage = data;
}
}


Nearly all the time I get the message that it departs for DoCom but it never arrives although I'm pretty sure it did once.

Am I breaking some rule here?
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
Never mind, I've pretty well confirmed you can't do it.
05-27-2007 18:05
It ignores the state change and just returns from the function call.

How it did work once or twice is strange.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-27-2007 19:17
Officially it isn't supported to change a state within a function.

There is a way to do it:

http://lslwiki.net/lslwiki/wakka.php?wakka=FunctionStateChangeHack

But don't.
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
05-28-2007 00:48
You can use llMessageLinked
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?