Jump to content
ItzTopcat

RPT Spamming Error Undefined variable in expression: commoninitcomplete

Recommended Posts

Hello, can anybody help me with this script

RPT shows and spams

 

Sleep 10;

Call Co>
  Error Undefined variable in expression: commoninitcomplete
File mpmissions\__cur_mp.smd_sahrani_a2\Common\Init\Init_Camp.sqf, line 14
Error in expression <tMarkerSizeLocal [0.5,0.5];

waitUntil {commonInitComplete};

Sleep 10;

 

 

Actual script:

_camp = _this Select 0;
_town = _this Select 1;

Call Compile Format["if (IsNil ""%1Camps"") then {%1Camps = []};",Str _town];
Call Compile Format["%1Camps = %1Camps + [_camp]",Str _town];

_index = Call Compile Format["%1Camps Find _camp",Str _town];
_marker = Format["%1Camp%2",Str _town,_index];
CreateMarkerLocal [_marker,GetPos _camp];
_marker SetMarkerTypeLocal "Strongpoint";
_marker SetMarkerColorLocal "ColorBlue";
_marker SetMarkerSizeLocal [0.5,0.5];

waitUntil {commonInitComplete};

Sleep 10;

Call Compile Format["if (IsNil ""%1SideID"") then {%1SideID = RESISTANCEID};",Str _camp];
Call Compile Format["if (IsNil ""%1SupplyValue"") then {%1SupplyValue = %2SupplyValue};",Str _camp,Str _town];

if (IsServer) then {
	_flagType = "FlagCarrierINDFOR_EP1";
	if (PkgA2) then {_flagType = "FlagCarrierGUE"};
	_flagPole = _flagType CreateVehicle GetPos _camp;
	_flagPole SetFlagTexture "Client\Images\Flags\flag_resistance.paa";
	[_camp,_town,_flagPole] ExecVM "Server\Server_UpdateCamp.sqf";
};

 

Share this post


Link to post
Share on other sites

The .rpt log is spamming because you have no sleep in the waitUntil.  Undefined variable gets logged for each cycle while it remains undefined.

 

Seems your camp script is running before the common init completes, and commonInitComplete was not predefined.

 

You could predefine it, which is often the best way:

commonInitComplete = false;

// stuff happens
// camp script runs
// common init finishes

commonInitComplete = true;

Or you could handle it as a flag variable which could be nil, true or false:

waitUntil {sleep 0.1; [false,commonInitComplete] select !(isNil "commonInitComplete")};

Return is false when commonInitComplete is not yet defined; or,

Return is commonInitComplete value when it is defined. 

Share this post


Link to post
Share on other sites
On 10/10/2022 at 9:46 PM, opusfmspol said:

The .rpt log is spamming because you have no sleep in the waitUntil.  Undefined variable gets logged for each cycle while it remains undefined.

 

Seems your camp script is running before the common init completes, and commonInitComplete was not predefined.

 

You could predefine it, which is often the best way:


commonInitComplete = false;

// stuff happens
// camp script runs
// common init finishes

commonInitComplete = true;

Or you could handle it as a flag variable which could be nil, true or false:


waitUntil {sleep 0.1; [false,commonInitComplete] select !(isNil "commonInitComplete")};

Return is false when commonInitComplete is not yet defined; or,

Return is commonInitComplete value when it is defined. 

 

 

Hello Opusfmspol,

 

I am glad people are still active in Arma2.

 

Thank you for your answer I will test it right away!

 

Edit: worked like a charm 

 

Thanks! 🙂

Share this post


Link to post
Share on other sites

Topcat,  We have an arma 2 server that does not work since the new update.  Is there a programmer that might consent to programming this server so we can play on it?  I am sure we could pay someone if they were willing.  We like the Genesis Epoch server semi millitary, but we are not real picky.  Thank you!!

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

×