Jump to content
SantoJ

Script not working (2 Errors)

Recommended Posts

_wright = "Good Job Soldier, Radio Tower Restored To Our Control";
_progress = "Restoring Comm link";
_link = "Comm Link Partialy Restored";
Transmission = "Incoming Transmission...";
_Completed1 = False;
_Completed2 = False;
_Completed3 = False;

// Radio Tower 1

generator1 removeAction 0;
hint _progress;

sleep 10;

hint _link;
Captain_Wright sideChat _wright;
_Completed1 = True;

// Radio Tower 2

waitUntil
{
  waitUntil {_Completed1 = True};

  if(_Completed1 = True) then{
    generator2 removeAction 0;
    hint _progress;

    sleep 10;

    hint _link;
    Captain_Wright sideChat _wright;
    _Completed2 = True;
  };
};

if
{
  _Completed1, _Completed2 = True;
  Incoming_Transmission sideChat Transmission;
  Crossroads sideChat "TEST"
};

So this is the first script ive ever created completely from scratch the aim of it is when a player in-game activates an add action on an object some messages appear however i want the player to have to visit to objects before the overall objective is complete to do this i tried using waitUntil but this is where i got the errors, no doubt its horribly wrong but i thought id give it ago.

Spoiler

if(_Completed1 = True) then{
generator2 removeAction 0;>
 0:56:58   Error position: <= True) then{
generator2 removeAction 0;>
 0:56:58   Error Missing )
 0:56:58 File C:\Users\Sean\Documents\Arma 3 - Other Profiles\PC%20Jack%20Santo%20[WA880]\mpmissions\Assualt%20On%20Altis.Altis\commLink.sqf, line 26
 0:57:00 No speaker given for 
 0:57:00 No speaker given for 
 0:57:03 No speaker given for 
 0:57:04 No speaker given for 
 0:57:04 No speaker given for 
 0:57:06 No speaker given for 
 0:57:06 No speaker given for 
 0:57:08 Error in expression <ideChat _wright;
_Completed1 = True;

 

Spoiler

waitUntil
{
waitUntil {_Completed1 = Tru>
 0:57:08   Error position: <waitUntil
{
waitUntil {_Completed1 = Tru>
 0:57:08   Error Generic error in expression
 0:57:08 File C:\Users\Sean\Documents\Arma 3 - Other Profiles\PC%20Jack%20Santo%20[WA880]\mpmissions\Assualt%20On%20Altis.Altis\commLink.sqf, line 22
 0:57:10 No speaker given for 
 0:57:12 No speaker given for 
 0:57:16 No speaker given for 
 0:57:19 No speaker given for 
 0:59:32 No speaker given for 
 0:59:32 No speaker given for 

 

Again this is the very first script ive made completely from scratch and on my own, so no doubt there is a much better way to do what i want.

Share this post


Link to post
Share on other sites

You should lookup how `if` works in any programming language.

waitUntil is the same. You are setting a variable to true. Which returns nothing. And then you want to check if nothing is something. That will obviously not work.

If you wanted to compare a boolean to true that also doesn't make sense. as true==true is exactly the same as true and false==true is exactly the same as false.

Share this post


Link to post
Share on other sites

I personally don't think this is the most efficient way to code this, but I'm not sure what other code you're working with so I won't question it or assert that I may know a better way.  The code below may help guide you on how to get the code to work.

 

Tip:

If you set a variable as a bool value (

_phronkVariable = true ), you don't need to check if (_phronkVariable == TRUE )then{ codeStuffsHere };

Instead, you check like this: if ( _phronkVariable ) then { codeStuffsInHere ; };

If you want to check if variable is false, you do this:
if (!_phronkVariable)then{ myCodeStuffsInHere ; };

_________________________________________________________
//Code "improvement" example:

 

waitUntil { _Completed1; }; //Might result in "Error: Type bool, expected code"

  if (_Completed1) then {
    generator2 removeAction 0;
    hint _progress;

    sleep 10;

    hint _link;
    Captain_Wright sideChat _wright;
    _Completed2;
  };

if ( ( _Complated1 ) || ( _Completed2 ) ) then {
  Incoming_Transmission sideChat Transmission;
  Crossroads sideChat "TEST";
};

  • Like 1

Share this post


Link to post
Share on other sites

Well, the first if is completely unnecessary, as due to the WaitUntil the script won't ever continue unless the value is true in the first place.

 

Another thing is the "if x = y" that won't work. = -> set a value, == -> compare a value. Therefore, it is always "if x == y..." All in all, OPs code looks very weird, and I suggest reading up on basic coding tutorials again.

 

https://community.bistudio.com/wiki/if

https://community.bistudio.com/wiki/waitUntil

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

×