Home   Help Search Login Register  

Author Topic: A 'demon'  (Read 594 times)

0 Members and 1 Guest are viewing this topic.

Offline Nemesis6

  • Members
  • *
A 'demon'
« on: 19 Mar 2004, 19:45:56 »
I talked with my dad a lot about scripting and all, he told me about 'demons', should be a thing that constantly checks if something is as it's supposed to be, and if it isn't, you get the picture. Are these available in the ofp scripting language? It'd be easier than me having to make my own manual ones. I recall someone telling someone why they didn't just use something like this -

@ (somethingistrue): goto "something"

So, any enlightenment?
I am actually flying into a star... this is incredible!

Harkonin

  • Guest
Re:A 'demon'
« Reply #1 on: 19 Mar 2004, 20:48:08 »
Yep.

Make a Condition, set it to false at startup then have it set to true when you need to.

YourCondition = False and YourCondition = True

So instead of
@somethingTrue

you would use

@Something
« Last Edit: 19 Mar 2004, 20:49:02 by Harkonin »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:A 'demon'
« Reply #2 on: 20 Mar 2004, 11:46:27 »
You need to be careful:  there are two unrelated but similar constructions

@ condition

The script waits at this line until the condition is true.

? condition: consequence

The script assesses the condition:  if it is true, the consequence occurs and the script moves on to the next line.  If it is false, the script goes straight to the next line without executing the consequence.

If you want the script to keep going while it checks something, that's more difficult.   You probable need a loop of somekind

#loop
~1
bunch of stuff
? conditionA: goto "next"
? conditionB: goto "loop"
bunch of other stuff
exit

#next
etc

Read the section "Scripting Topics" in the command reference.
Plenty of reviewed ArmA missions for you to play