OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gundernak on 15 Jan 2004, 20:57:55
-
Hi all,
I would like to know which method needs more cpu resource (even if I have so many checks):
@ mycondition
myConsequence
or
#loop
? mycondition: goto "here"
goto "loop"
#here
myConsequence
thanks in advance
-
I'd try to use an eventhandler. If not, I'd use the @.
-
It depends what you are trying to do in your script.
If you want the script to check multiple variables, then I'd use a loop. If you only want the script to wait until a certain condition is true, then I'd use an @.
-
If you want the script to check multiple variables, then I'd use a loop. If you only want the script to wait until a certain condition is true, then I'd use a loop.
:hmm:
-
I dont know what you're talking about :P
-
Post changer! ::)
-
@ will check the condition each 0.5 seconds, just like a trigger does. If you don't need it checked that fast, go with the loop and add a delay in it.
The straight forward answer to your question would be
@ mycondition
myConsequenceThis is processed every 0.5 seconds.
#loop
? mycondition: goto "here"
goto "loop"This is processed as fast as your computer can and needs (and uses) as much resources from your computer as it gets. Terrible.
#loop
? mycondition: goto "here"
~1
goto "loop"This would be the best way when you think about saving your computer resources. It's looped every 1 seconds, so it's even better than the @ statement.. if it suits your needs.
Oh and it makes no difference wether your checking multiple variables or not. The @ statement isn't suitable for as many things as a loop is, but you can check multiple variables and conditions with the @.
@!(alive (leader mygroup)) || myunit distance enemyunit > 300 && myvariable :P
-
I dont know what you're talking about
m21man means: whatever you wanna do, you'd use a loop
check yer own post m8 ;D
::edit - :o post changer >:( :)
@gundernak:
@condition - is the most cpu stressing method, as the check
for given condition will happen during every single frame
(said by SUMA)
off course a loop without any time delay is almost the same
a loop with a delay of 1 second is not really stressing the cpu
a trigger would check about: every (from 0.3 to 0.5)th second,
depending on speed of the cpu, based upon various experiences by different mission makers
solved???
:edit - u see Artak - i'm not that bad guy - i've let ya the first
move this time - lol
~S~ CD
-
Really? I was under the impression that it's the same as a trigger, every 0.5 seconds. :o
[edit]
lol
-
My understanding of the situtation is this:-
@condition - polls every frame
Triggers
Condition: this - polls every 0.3s - 0.5s
Condition: anything else - polls every frame
Loop - user specified
-
Thanks guys,
It was rather detailed. ;)
Really appriciated :)