OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Blip on 02 Mar 2005, 06:24:13

Title: goto "_this select 0"
Post by: Blip on 02 Mar 2005, 06:24:13
Hey-

Whats the setup for jumping to a certain part of a script from the start?

So if I put:       [loop1] exec "script.sqs"

What do I put in the start of script.sqs to make it jump to #loop1
I have seen this before but forgot.

I have tried:

goto (_this select 0)
goto "_this select 0"
goto ("_this select 0")

thanks,

Blip  :joystick:
Title: Re:goto "_this select 0"
Post by: General Barron on 02 Mar 2005, 06:35:19
The goto command wants to have a string next to it. For example:

goto "Label1"

will go to

#Label1

So, you need to pass a STRING to the script, and then pass that string to the goto command. Right now you are trying to pass whatever is in the variable loop1 to the script. Instead, you need to pass the STRING "loop1":

["loop1"] exec "script.sqs"

And in the script:

goto (_this select 0)
Title: Re:goto "_this select 0"
Post by: Blip on 02 Mar 2005, 06:42:13
Many Thanks General!

Blip
Title: Re:goto "_this select 0"
Post by: StonedSoldier on 02 Mar 2005, 10:39:57
also i neat little trick a do sometimes for random outcome in scripts

_number = random 2
_number = _number - (_number mod 1)

goto format ["%1",_number]

#0
_man sidechat "Hello"
exit
#1
_man sidechat "Go away"
exit
#2
_man sidechat "I need a beer"
exit
Title: Re:goto "_this select 0"
Post by: Blip on 02 Mar 2005, 18:29:06
StonedSoldier-

Thats going to be helpful as well!

Thank you,

 :cheers:

Blip  :joystick: