Jump to content
stlassen

"Error Missing ;" (I don't get it)

Recommended Posts

I'm getting an "Error Missing ;" in the code below.

I'm at a lose as to way. Either I'm blind or I'm missing something basic scripting wise.

If I remove the if-statement, there are no errors and it works.

What am I missing here?

addMissionEventHandler [
    "TeamSwitch", {
        private ["_from","_to","_grpFrom","_grpTo"];
        _from = _this select 0;
        _to    = _this select 1;
        _grpFrom = group _from;
        _grpTo = group _to;
        
        _grpTo selectLeader _to;
        
        if (_grpFrom != _grpTo) {
            systemChat "DEBUG: Switched group.";
        };
    }
];

 

The error I'm getting is as seen below:

19:19:25 Error in expression <ectLeader _to;

if (_grpFrom != _grpTo) {
systemChat "DEBUG: Switched group.";
}>
19:19:25   Error position: <{
systemChat "DEBUG: Switched group.";
}>
19:19:25   Error Missing ;
19:19:25 File C:\Users\Søren\Documents\Arma 3 - Other Profiles\Lassen\missions\My_Missions\Freedom.Altis\init.sqf, line 11
19:19:25 Error in expression <ectLeader _to;

if (_grpFrom != _grpTo) {
systemChat "DEBUG: Switched group.";
}>
19:19:25   Error position: <{
systemChat "DEBUG: Switched group.";
}>
19:19:25   Error Missing ;
19:19:25 File C:\Users\Søren\Documents\Arma 3 - Other Profiles\Lassen\missions\My_Missions\Freedom.Altis\init.sqf, line 11
19:19:25 Error in expression <.Altis\init.sqf"
addMissionEventHandler [
"TeamSwitch", {
private ["_from","_to">
19:19:25   Error position: <[
"TeamSwitch", {
private ["_from","_to">
19:19:25   Error Generic error in expression
19:19:25 File C:\Users\Søren\Documents\Arma 3 - Other Profiles\Lassen\missions\My_Missions\Freedom.Altis\init.sqf, line 1


 

 

  • Haha 1

Share this post


Link to post
Share on other sites

Without leaning myself too far out of the window (I am a shitscripter), but you're missing the "then" from "if... then"?

  • Like 1

Share this post


Link to post
Share on other sites
addMissionEventHandler [
    "TeamSwitch", {
        private ["_from","_to","_grpFrom","_grpTo"];
        _from = _this select 0;
        _to    = _this select 1;
        _grpFrom = group _from;
        _grpTo = group _to;
        
        _grpTo selectLeader _to;
        
        if (_grpFrom != _grpTo) then {                  // UP HERE TOO .... LEXX
            systemChat "DEBUG: Switched group.";
        };
    }; // <<<<< RIGHT HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
];

might be the part i posted ...

 

edit - lexx is right to i think

 

Try Lexx's part first then if it still throws the error throw in the ; i suggested

Share this post


Link to post
Share on other sites
46 minutes ago, stlassen said:

if (_grpFrom != _grpTo) {

systemChat "DEBUG: Switched group.";

}>

19:19:25 Error position: <{ systemChat "DEBUG: Switched group.";

}>

19:19:25 Error Missing ;

19:19:25 File C:\Users\Søren\Documents\Arma 3 - Other Profiles\Lassen\missions\My_Missions\Freedom.Altis\init.sqf, line 11

19:19:25 Error in expression <ectLeader _to;

 

19:19:25 Error position: <

^^^ this marks the error

 

"then" is missing.

 

The missing semicolon is not significant.

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

×