More Awesome Than You!

The Bowels of Trogdor => The Small Intestines of Trogdor => Topic started by: ScoobyDoo on 2008 February 03, 04:46:51



Title: Loop logic question
Post by: ScoobyDoo on 2008 February 03, 04:46:51
I'm trying to rewrite something, but I'm not sure if it works like windows coding or not.


1  Idle (1 game minute)
2  check for exit condition, if so return
3  do stuff
4 goto 1

Does this work properly, i.e. the sim continues to operate or will this cause it to lockup until it exits the loop?  I know in C# you have to have Application.DoEvents otherwise the program will not update.

Edit:nevermind, I see why I didn't use it during interaction, it doesn't like to use idle on interaction, "check tree primitive blocked completion"


Title: Re: Loop logic question
Post by: dizzy on 2008 February 03, 16:31:35
Edit:nevermind, I see why I didn't use it during interaction, it doesn't like to use idle on interaction, "check tree primitive blocked completion"

Your problem is in how that Interaction gets invoked. If you uncheck the "Immediate" flag in the pie menu, then you should be able to do Idle()s or anims (or other stuff that's non-immediate).


Title: Re: Loop logic question
Post by: J. M. Pescado on 2008 February 03, 17:11:25
Idling cannot be performed during "Immediate" actions: Immediate Actions must execute atomically, and cannot idle, pop up interactive dialogs unless the error is overridden, etc.

If a sim is running a non-instant action, that action has control of the stack, and the sim cannot run any other actions except subqueue actions (which require special handling, see Macrotastics) or Immediate actions. The sim will do nothing until the idle loop is terminated. Certain conditions may force an idling object prematurely out of idle (Notify Object Out Of Idle). It is not recommended that idle loops longer than 30 ticks (1 minute) be used for sim actions. It is similarly recommended that you use 0x119, Wait-For-Something-Or-Other, instead of 0x118 or its related derivatives, for all Sim actions, so that you can detect user-ordered abort and not produce an annoying action that blocks forever in defiance of the user's desire to abort. Never, ever, use 0x118 or derivatives thereof for any time periods longer than maybe 5 ticks in a sim interaction. Long idles should only occur in object main loops, never in sim interactions. Accept no Kewian-based substitutes!


Title: Re: Loop logic question
Post by: ScoobyDoo on 2008 February 04, 23:36:12
Ok it sorta is similar to windows looping where you need either a DoEvents or wait till another wndcmd message is in the stack.

That how I did it Pescado, use the main body loop and just used an attribute as a flag.