Home   Help Search Login Register  

Author Topic: goto "_this select 0"  (Read 865 times)

0 Members and 2 Guests are viewing this topic.

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
goto "_this select 0"
« 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:
...NIGHT WALKER....

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:goto "_this select 0"
« Reply #1 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)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:goto "_this select 0"
« Reply #2 on: 02 Mar 2005, 06:42:13 »
Many Thanks General!

Blip
...NIGHT WALKER....

StonedSoldier

  • Guest
Re:goto "_this select 0"
« Reply #3 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

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:goto "_this select 0"
« Reply #4 on: 02 Mar 2005, 18:29:06 »
StonedSoldier-

Thats going to be helpful as well!

Thank you,

 :cheers:

Blip  :joystick:
...NIGHT WALKER....