OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: gundernak on 15 Jan 2004, 20:57:55

Title: @ or Loop need more effort?
Post 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
Title: Re:@ or Loop need more effort?
Post by: m21man on 15 Jan 2004, 21:00:23
I'd try to use an eventhandler. If not, I'd use the @.
Title: Re:@ or Loop need more effort?
Post by: icarus_uk on 15 Jan 2004, 21:05:40
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 @.
Title: Re:@ or Loop need more effort?
Post by: m21man on 15 Jan 2004, 21:11:04
Quote
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:
Title: Re:@ or Loop need more effort?
Post by: icarus_uk on 15 Jan 2004, 21:15:33
I dont know what you're talking about  :P
Title: Re:@ or Loop need more effort?
Post by: m21man on 15 Jan 2004, 21:17:38
Post changer! ::)
Title: Re:@ or Loop need more effort?
Post by: Artak on 15 Jan 2004, 21:27:51
@ 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

Code: [Select]
@ mycondition
myConsequence
This is processed every 0.5 seconds.

Code: [Select]
#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.

Code: [Select]
#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
Title: Re:@ or Loop need more effort?
Post by: Chris Death on 15 Jan 2004, 21:30:09
Quote
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
Title: Re:@ or Loop need more effort?
Post by: Artak on 15 Jan 2004, 21:32:44
Really? I was under the impression that it's the same as a trigger, every 0.5 seconds.  :o

[edit]
lol
Title: Re:@ or Loop need more effort?
Post by: macguba on 15 Jan 2004, 22:34:33
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

Title: Re:@ or Loop need more effort?
Post by: gundernak on 16 Jan 2004, 00:24:23
Thanks guys,

It was rather detailed.  ;)
Really appriciated  :)