Jump to content
Sign in to follow this  
Graz

Touble with triggers!

Recommended Posts

I've almost made a UID bound radio trigger, but I'm having a couple of closing issues

Here's the code

//INIT file

//Activate condition (thanks to Cuel!)

if (isserver) conditiona = true;

//Approved UID

if (isDedicated) exitWith {};

waitUntil {!isNull player};

waitUntil {getPlayerUID player != ""};

_wl = ["111111","222222"];

//Set Radio msgs

if ((getPlayerUID player) in _wl) then

{1 setRadioMsg "Alpha Radio Command"} else {1 setRadioMsg "null"} ;

//Trigger

//Alpha Radio Command

if (condintiona=true)

then {conditiona =false; sleep 3600;conditiona = true;};

else TitleText [format["NOT READY YET!"], "PLAIN DOWN"];

The Issue

I'm not %100 sure my if, then, else statement is correct, it's getting a lot of errors in Squint

Also I don't know if where I put the init parts is important. If I put this at the very top or bottom of the init will it have a difference?

Share this post


Link to post
Share on other sites

I'm not really sure what you're trying to do

But that if-else is not correct. Learn to indent your code, it makes it a lot easier to read.

First off, one equality sign means assign, two means compare.

Second, if checks for a boolean value (true / false), since your "condintona" is a boolean you do not check if it's true, you check its value:

if (condintiona) then {

Compare these two to see the difference between if-then and if-else

if (true) then {
//code
};

//

if (true) then {
//code
}else{
// else code
};

Notice the semicolons.

So try this instead:

if (condintiona) then {
conditiona =false;
sleep 3600;
conditiona = true;
}else{
titleText ["NOT READY YET!", "PLAIN DOWN"];
};

You also can not sleep in a trigger, if that's what you're trying to do.

Share this post


Link to post
Share on other sites

The Radio trigger is intended to disable a condition, which is true/false, then reactivate it an hour later. If I can't use sleep or a timeout for a radio trigger, what can I use?

Thanks again Cuel!

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
Sign in to follow this  

×