More Awesome Than You!
Welcome, Guest. Please login or register.
2024 March 28, 10:01:44

Login with username, password and session length
Search:     Advanced search
540270 Posts in 18066 Topics by 6511 Members
Latest Member: zheng
* Home Help Search Login Register
+  More Awesome Than You!
|-+  The Bowels of Trogdor
| |-+  The Small Intestines of Trogdor
| | |-+  Loop logic question
0 Members and 1 Chinese Bot are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: Loop logic question  (Read 7615 times)
ScoobyDoo
Corpulent Cretin
*
Posts: 146


View Profile
Loop logic question
« on: 2008 February 03, 04:46:51 »
THANKS THIS IS GREAT

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"
« Last Edit: 2008 February 03, 10:12:58 by ScoobyDoo » Logged
dizzy
Souped!
*
Posts: 1572


unplugged


View Profile
Re: Loop logic question
« Reply #1 on: 2008 February 03, 16:31:35 »
THANKS THIS IS GREAT

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).
Logged

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26281



View Profile
Re: Loop logic question
« Reply #2 on: 2008 February 03, 17:11:25 »
THANKS THIS IS GREAT

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!
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
ScoobyDoo
Corpulent Cretin
*
Posts: 146


View Profile
Re: Loop logic question
« Reply #3 on: 2008 February 04, 23:36:12 »
THANKS THIS IS GREAT

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.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.079 seconds with 20 queries.