Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to change state from within a global function

Oblivion Kaos
0z0ne Bringer
Join date: 28 Sep 2005
Posts: 17
11-24-2005 04:43
I guess this is a bug and I have reported it already. When you try to do a state change from within a global function, you get a error saying you can't.

But if you enclose your state change inside an if(1) you can. Example:

CODE

myfunction(){
if(1){
state NEW;
}
}

default {
state_entry(){
myfunction();
}
}

state NEW {
state_entry(){
// ...
}
}


I do NOT recommend you to use it as I think it is a bug, but it can save you time for a quick and dirty fix.
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-24-2005 04:57
That is a pretty old bug/hack, reffered to on the wiki at this link. I think it is reasonably safe to use if you *have* to use it, I don't think the Lindens have any plans to change the way this bug/hack works in the near future........ It's a feature! :p
_____________________
Oblivion Kaos
0z0ne Bringer
Join date: 28 Sep 2005
Posts: 17
11-24-2005 05:05
From: Cid Jacobs
That is a pretty old bug/hack, reffered to on the wiki at this link. I think it is reasonably safe to use if you *have* to use it, I don't think the Lindens have any plans to change the way this bug/hack works in the near future........ It's a feature! :p



Damm, I always do the same :)
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
11-24-2005 06:34
Hmm, it seems odd that you can't change state in a function without doing this. Although that said all of my functions test for something before doing this anyway.