Frictional Games Forum (read-only)
Switch problem - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Switch problem (/thread-10498.html)



Switch problem - Elven - 09-27-2011

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?



RE: Switch problem - Tanshaydar - 09-27-2011

You can re-define the callback function without nothing in it.


RE: Switch problem - Elven - 09-27-2011

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");
}



RE: Switch problem - Juby - 09-28-2011

(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