Jump to content

Recommended Posts

hi,

 

i have a bit of a problem. i want to set the variable _Schiessbahnname but everything i try dont work. this is what it looks like but still not working.

if (_Warden == R1L1) then {_PopupTargets = [R1L1T1,R1L1T2,R1L1T3,R1L1T4,R1L1T5];_RangeActive = _Warden getVariable "BEARB_R1L1";_Schiessbahnname = 1;};
if (_Warden == R1L2) then {_PopupTargets = [R1L2T1,R1L2T2,R1L2T3,R1L2T4,R1L2T5];_RangeActive = _Warden getVariable "BEARB_R1L2";_Schiessbahnname = 2;};
if (_Warden == R1L3) then {_PopupTargets = [R1L3T1,R1L3T2,R1L3T3,R1L3T4,R1L3T5];_RangeActive = _Warden getVariable "BEARB_R1L3";_Schiessbahnname = 3;};
if (_Warden == R1L4) then {_PopupTargets = [R1L4T1,R1L4T2,R1L4T3,R1L4T4,R1L4T5];_RangeActive = _Warden getVariable "BEARB_R1L4";_Schiessbahnname = 4;};

i want if _Warden is R1L1 then _Schiessbahnname is 1 and so on but how the *** do i have to write the code ??!!

 

this is the orignal code and it works...

if (_Warden == R1L1) then {_PopupTargets = [R1L1T1,R1L1T2,R1L1T3,R1L1T4,R1L1T5];_RangeActive = _Warden getVariable "BEARB_R1L1";};
if (_Warden == R1L2) then {_PopupTargets = [R1L2T1,R1L2T2,R1L2T3,R1L2T4,R1L2T5];_RangeActive = _Warden getVariable "BEARB_R1L2";};
if (_Warden == R1L3) then {_PopupTargets = [R1L3T1,R1L3T2,R1L3T3,R1L3T4,R1L3T5];_RangeActive = _Warden getVariable "BEARB_R1L3";};
if (_Warden == R1L4) then {_PopupTargets = [R1L4T1,R1L4T2,R1L4T3,R1L4T4,R1L4T5];_RangeActive = _Warden getVariable "BEARB_R1L4";};

i am thankfull for any help or tip

Share this post


Link to post
Share on other sites

Do you define _Schiessbahnname before the if code? You should.

_Schiessbahnname = 0;
if (_Warden == R1L1) then {_PopupTargets = [R1L1T1,R1L1T2,R1L1T3,R1L1T4,R1L1T5];_RangeActive = _Warden getVariable "BEARB_R1L1";_Schiessbahnname = 1;};

Share this post


Link to post
Share on other sites

Yes i did but its not working. the script is not running. i think i habe a syntax error but i dont know how i can write it right ???

Share this post


Link to post
Share on other sites

The syntax is fine.

Enable -showscripterrors startup parameter, it'll tell you if something goes wrong.

 

If the original code works, adding the _Schiessbahnname = 1 there doesn't break it.

Share this post


Link to post
Share on other sites

thx it works... was a syntax error but a suipt one :) the code was ok

Share this post


Link to post
Share on other sites

Btw, use a "switch"-structure if you want better performance ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×