Frictional Games Forum (read-only)

Full Version: Switch problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I cant figure it out. It seems that whenever I make callback of when state changes, then it will stay forever. But I want to cancel that callback after it is used (not making it stuck)! So after it has done whatever it does, if you release it, it will go back to its own spot and next time you use it, callback won't be used again and it is as... empty lever till i reassign this Smile!

help?
You can re-define the callback function without nothing in it.
I see Smile. TY! I also found method - maybe it helps someone:

void lever(string &in asTimer)
{
if(GetLeverState("levername") == -1/0/1) //whatever state u want Tongue!
{
//DO ur stuff here Smile!
RemoveTimer("lever");
}
AddTimer("", 0, "lever");
}
(09-27-2011, 09:15 PM)Elven Wrote: [ -> ]I see Smile. TY! I also found method - maybe it helps someone:

void lever(string &in asTimer)
{
if(GetLeverState("levername") == -1/0/1) //whatever state u want Tongue!
{
//DO ur stuff here Smile!
RemoveTimer("lever");
}
AddTimer("", 0, "lever");
}
Well that does in fact work, I would prefer this type of thing. (although all cases vary naturally)

Code:
SetEntityConnectionStateChangeCallback("Ent", "StateChangeEnt");
void StateChangeEnt(string &in asEntity, int alState)    {     if(alState == 1) (stuff) else (stuff) }

-Edit- read it wrong... but information nontheless? : D