Home   Help Search Login Register  

Author Topic: A past if statement coming true, even though the script has past it.  (Read 861 times)

0 Members and 1 Guest are viewing this topic.

Offline FiLL2d

  • Members
  • *
  • X.x
#end
if (fill distance gamelogic1 >= 10) then {goto "dontteleport"} else {goto "teleport"};

#teleport
hint "teleport"
fill setpos getpos gamelogic2
exit

#dontteleport
hint "dont teleport"
exit


Hi can anyone help me here, the script checks how close fill is to gamelogic1 and then makes an outcome, if fill is not in the range of 10m of the gamelogic1 it won't teleport him to gamelogic2 - but if he is in the range it will teleport him to gamelogic2.

The problem is that soon as the script goes to #teleport, the soldier named fill goes out of the range of 10m from gamelogic1 and thus #dontteleport is then ran.

I didn't think this happened, i thought OFP ignored the if statement once an outcome has been excuted, any ideas? thanks.
« Last Edit: 07 Jul 2006, 02:12:08 by FiLL2d »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Very weird. Try deleting the semi-colon at the end of your if statement. It might be preventing the script engine from recognising the #teleport label.


PS this is not an MP topic and should have been posted in Editing/Scripting General
« Last Edit: 07 Jul 2006, 14:33:30 by Mr.Peanut »
urp!

Offline FiLL2d

  • Members
  • *
  • X.x
Hi, thanks for the reply, even without the ; on the end it still does the same thing

edit: ah, the script was activating like this [fill, "attack"] exec "decide.sqs" but their was no #attack, wierd how it made the script do this.
« Last Edit: 07 Jul 2006, 16:09:34 by FiLL2d »