Home   Help Search Login Register  

Author Topic: variables in arma 2  (Read 2431 times)

0 Members and 1 Guest are viewing this topic.

Offline ZapBrannigan

  • Members
  • *
variables in arma 2
« on: 02 Sep 2010, 08:21:10 »
Why when i make a script and in the script write

Code: [Select]
      player action ["eject",vehicle player]     
then execute it with eject = [] execvm"eject.sqf" it works fine, but if i do

Code: [Select]
_vp = vehicle player
player action ["eject", _vp]

then nothing happens....

and if i do like
Code: [Select]
_m1 = _this select 0
_vm = vehicle _m1
_m1 action ["EJECT",_vm]
and execute it with eject = [player] execvm"eject.sqf"   then also nothing happens


if i remember correctly it worked fine when i did that in ofp

so confusing..


thanks

Offline i0n0s

  • Moderator
  • *****
Re: variables in arma 2
« Reply #1 on: 02 Sep 2010, 12:21:12 »
They don't work since you're writing SQS instead of SQF.
SQF is not line based and you need to close each statement with a semicolon.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: variables in arma 2
« Reply #2 on: 03 Sep 2010, 13:11:52 »
Add -showScriptErrors to your startup command line to get back the old-school script errors from OFP/ArmA. I guess they removed them because they didn't want their own script errors to show up  :P

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline ZapBrannigan

  • Members
  • *
Re: variables in arma 2
« Reply #3 on: 03 Sep 2010, 18:23:02 »
Ahh, i see. thank you for the help. I seem to be able to manage a sqf script. But i am so used to sqs and it doesnt seem like theres much you can do with sqf that you cant do with sqs why the change?...
 and for that matter why the change in the way the briefings made. its now with sqf too.  shame cause i thought the old briefing style with the notebook was soo much better

cheers

Offline i0n0s

  • Moderator
  • *****
Re: variables in arma 2
« Reply #4 on: 03 Sep 2010, 22:12:36 »
Create the following code using SQS:
Code: [Select]
switch (_var) do {
case "A": //doSomethingA
case "B": //doSomethingB
case "C": //doSomethingC
case "D": //doSomethingD
case "E": //doSomethingE
case "F": //doSomethingF
case "G": //doSomethingG
case "H": //doSomethingH
case "I": //doSomethingI
};
Player sideChat "DoSomething";
And you'll notice that your code will get significant larger and contains a lot of jumps.