Jump to content
Sign in to follow this  
Kempco

Issues with the hintSilent command

Recommended Posts

Has anyone ever had issues with the hintsilent command breaking scripts after re spawning? What happens is I get a script error saying missing ";". Logic would dictate that there is a missing ";" however prior to re spawning, there is no script error, the text appears as it should, and the script runs fine. Oddly enough, replacing the hintSilent commands with side/global/ chats or titletexts fixes the issue but that would require allot of additional work.

Thoughts?

Edited by Kempco

Share this post


Link to post
Share on other sites

The Following script is initialized server side and propagated over the network via a PVEH. It is called from an FSM that loops the following:

FSM: Loop

//_commandunit defined HERE

//====Reset Loop======//	
_nearest_units = nearestObjects [_aircraft,["Man"],25];
if ((count _nearest_units > 0) AND (!isNil "_commandUnit")) then {
_nearest_players = [];
{if (isplayer _x) then {_nearest_players = _nearest_players + [_x]}} foreach _nearest_units;
if (count _nearest_players > 0) then {
	_AtBoardPos = [];
	_new_1 = _nearest_players - _old_1;
	if (count _new_1 > 0) then {
		{JTK_Spawn_PVEH = [[_x,_aircraft],JTK_Reset_GetAddActn];publicVariable "JTK_Spawn_PVEH";
		if (local _x) then {[_x,_aircraft] spawn JTK_Reset_GetAddActn}} foreach _new_1;
		_old_1 = _old_1 + _new_1;
	};	
};
};	
if (count _old_1 > 0) then {
{if ((_x distance _aircraft > 25) OR (_x in _aircraft) OR (_x distance _BoardPos <= 4.25)) then {_old_1 = _old_1 - [_x]}} forEach _old_1;
};

//====Get In Loop======//
_nearest_units = nearestObjects [_BoardPos,["Man"],6];
if (count _nearest_units > 0) then {
_nearest_players = [];
{if (isplayer _x) then {_nearest_players = _nearest_players + [_x]}} foreach _nearest_units;
if (count _nearest_players > 0) then {
	_AtBoardPos = [];
	{if (_x distance _BoardPos <= 4.25) then {_AtBoardPos = _AtBoardPos + [_x]}} foreach _nearest_players; 
	if (count _AtBoardPos > 0) then {
		_new_2 = _AtBoardPos - _old_2;
		if (count _new_2 > 0) then {
			{JTK_Spawn_PVEH = [[_x,_aircraft,_boardPos],JTK_GetIn_GetAddActn];publicVariable "JTK_Spawn_PVEH";
			if (local _x) then {[_x,_aircraft,_boardPos] spawn JTK_GetIn_GetAddActn}} foreach _new_2;
			_old_2 = _old_2 + _new_2;
		};
	};
};
};
if (count _old_2 > 0) then {
{if ((_x distance _BoardPos > 4.25) OR (_x in _aircraft) OR (count crew _aircraft > 15)) then {_old_2 = _old_2 - [_x]}} forEach _old_2;
};

//====Takeoff Loop======//			
_crew = crew _aircraft;
if (count _crew > 0) then {
_players_in_crew = [];
{if (isplayer _x) then {_players_in_crew = _players_in_crew + [_x]}} foreach _crew;
if (count _players_in_crew > 0) then {
	_new_3 = _players_in_crew - _old_3;
	//_commandUnit = (_aircraft getVariable "JTK_HALO_Command_Unit");
	if (count _new_3 > 0) then {
[color="#FF0000"]			{JTK_Spawn_PVEH = [[_x,_aircraft],JTK_TakeOff_GetAddActn];publicVariable "JTK_Spawn_PVEH";
		if (local _x) then {[_x,_aircraft] spawn JTK_TakeOff_GetAddActn}} foreach _new_3;[/color]
		_old_3 = _old_3 + _new_3;
	};
};
};
if (count _old_3 > 0) then {
{if !(_x in _aircraft) then {_old_3 = _old_3 - [_x]}} forEach _old_3;
};




_commandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
if (!isNil "_commandUnit") then {
if (!alive _commandunit) then {_aircraft setVariable ["JTK_HALO_Command_Unit",nil,true]};
_commandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
if (isNil "_commandUnit") then {
	if (count (crew _aircraft) > 0) then {
		_players = [];
		{if ((isplayer _x) AND (alive _x)) then {_players = _players + [_x]}} foreach (crew _aircraft);
		if (count _players == 0) then {_aircraft setVariable ["JTK_HALO_Cancelled",true,true]};
	}else{_aircraft setVariable ["JTK_HALO_Cancelled",true,true]};
};
};

JTK_TakeOff_GetAddActn Reference from FSM above is highlighted in red (Precompiled as JTK_TakeOff_GetAddActn).

//by Kempco
/*
Takeoff Action is added only to the player who setup the Insertion. 
If that unit DCs before Takeoff, then delegate action to all units 
that are in or enter the aircraft.
*/

_unit 	= _this select 0;
_aircraft	= _this select 1;
_comandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
_isC130 	= _aircraft getVariable "is a C130";
private ["_Takeoff_Action","_TakeCommand_Action"];

if !(_unit in _aircraft) exitWith {};

_actn_txt = if (_isC130) then {"-Clear for Takeoff-"}else{"-Clear for Dustoff-"};


if (isMultiplayer) then {
if (_unit == _comandUnit) then {
	//[playerSide,'HQ'] sidechat "Action Wheel Updated";
	[color="#FF0000"]HintSilent "Action Wheel Updated"; [] spawn {sleep 7; hintSilent ""};[/color] Here where the issue starts, if corrected using Hint instead then problem is kicked down the line to the next hintSilent command.
	_Takeoff_Action = _aircraft addaction ['<t color="#fadfbe">' + _actn_txt + '</t>',(JTK_HALO_Path+"scripts\Actions\TakeOff.sqf"),[],4,true,true,"","((player == (_target getVariable 'JTK_HALO_Command_Unit')) AND (player in _target))"];
	While {(!isNil "_comandUnit") AND (_unit in _aircraft) AND !(_aircraft getVariable "JTK_HALO_Takeoff")} do {
		sleep 1;
		_comandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
	};
}else{
	While {(_unit in _aircraft) AND !(_aircraft getVariable "JTK_HALO_Takeoff") AND (!isNil "_comandUnit")} do {
		sleep 1;
		_comandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
	};
	if (isNil "_comandUnit") then {
		_txt = [_aircraft] call JTK_Get_Command_DC_txt;
		Hint parseText _txt;
		_aircraft removeAction _Takeoff_Action;
		_TakeCommand_Action = _aircraft addaction ['<t color="#fadfbe">' + "-Take Command-" + '</t>',(JTK_HALO_Path+"scripts\Actions\TakeCommand.sqf"),[_aircraft],4,true,true,"",""];	
		While {(_unit in _aircraft) AND !(_aircraft getVariable "JTK_HALO_Takeoff") AND (isNil "_comandUnit")} do {
			sleep 1;
			_comandUnit = _aircraft getVariable "JTK_HALO_Command_Unit";
		};
	};
};
waitUntil {!(_unit in _aircraft) OR (_aircraft getVariable "JTK_HALO_Takeoff")};
_aircraft removeAction _Takeoff_Action;
_aircraft removeAction _TakeCommand_Action;
}else{
if ((!isplayer _unit) OR !(_unit in _aircraft) OR (_unit != leader group _unit)) exitWith {};
_static = _aircraft getVariable "JTK_HALO_STATIC";
_Takeoff_Action = _aircraft addaction ['<t color="#fadfbe">' + _actn_txt + '</t>',(JTK_HALO_Path+"scripts\Actions\TakeOff.sqf"),[],4,true,true,"",""];
While {(_unit in _aircraft) AND !(_aircraft getVariable "JTK_HALO_Takeoff")} do {
	if (_unit != player) then {
		_aircraft removeAction _Takeoff_Action;
		waitUntil {!(_unit in _aircraft) OR (_aircraft getVariable "JTK_HALO_Takeoff") OR (player == _unit)};
		if (player == _unit) then {
			_Takeoff_Action = _aircraft addaction ['<t color="#fadfbe">' + _actn_txt + '</t>',(JTK_HALO_Path+"scripts\Actions\TakeOff.sqf"),[],4,true,true,"",""];
		};
	};
	sleep 1;
};
};

Where the script is going wrong is at the first instance of hintSilent. Fixing one just kicks it down the line too the next hintSilent .

In addition to the above stated conditions: the issue is unique to remote players.

Edited by Kempco

Share this post


Link to post
Share on other sites

Screw it. Switching all the hint text to Titletext. No idea whats going on here.

Edited by Kempco

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  

×