-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Marker texts are now localized to client #430
Add: Marker texts are now localized to client #430
Conversation
Update Branch: Master daily
Update master_daily
Master daily
Master daily update
Update Master daily
This reverts commit ce657c8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I wanted to do the same for markers so thanks to do it :)
As always I have some question ^^, see under :).
Generally, I don't see the point to check parameter passed to a function :
- this add unnecessary complexity in function. I like short code with just the necessary, so it easy to understand what the function actually do
- check parameter are usefull if you return an error or warning, so the user know he is not using your function correctly and can correct himself. That why I prefer to see a syntaxe error and a message in the RTP. They discribe the error very well and explain there are something wrong. If nothing is return, you can't see you are wrong and you leave hidden error. Those are very hard to find and resolve.
Just check then when it is necessary like I did it here. If you want more information ask me directly inside the PR
Thank you very much for your time!
["_arg", ""] | ||
]; | ||
//only run on client | ||
if (isDedicated) exitWith {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is only compiled client side so there are no way this function could be executed on isDedicated
(https://github.com/1kuemmel1/HeartsAndMinds/blob/8dd845701e68a3e0309429e4a93bc6dcc75f175b/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/fnc/compile.sqf#L245).
As I understand, Guillustio choosed to only compile function where there are supposed to works. By this way, the loading is faster because there are less function to compile (only usefull function are compiled) and you avoid this type of check in every function and call :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am Sorry. That's my fault: I used this function in another project some month ago. And the snippets are remnant. I will remove them.
@@ -58,7 +58,7 @@ _group = [_pos,8, 1 + round random 5,0.8] call btc_fnc_mil_create_group; | |||
[_pos,20, 2 + round random 4,0.5] call btc_fnc_mil_create_group; | |||
|
|||
_pos = getPosASL _generator; | |||
leader _group setPosASL [_pos select 0, _pos select 1, (_pos select 2) + 1 + random 1]; | |||
(leader (_group select 0)) setPosASL [_pos select 0, _pos select 1, (_pos select 2) + 1 + random 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be here, may be you based your branch on your last PR, doesn't matter :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, sorry.
if !((typeName _marker) isEqualTo "STRING") then {_marker = str _marker;}; | ||
|
||
//check marker | ||
if ((getMarkerPos _marker) isEqualTo [0,0,0]) exitWith {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mean you can't create a marker at position [0,0,0].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
if (isDedicated) exitWith {}; | ||
|
||
//check parameters | ||
if !((typeName _marker) isEqualTo "STRING") then {_marker = str _marker;}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createMarker only return string, nop?
Is there situation where this function is call by H&M with a _marker
not a string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -242,6 +242,7 @@ if (!isDedicated) then { | |||
btc_fnc_systemchat_debug = compile preprocessFileLineNumbers "core\fnc\common\systemchat_debug.sqf"; | |||
btc_fnc_show_hint = compile preprocessFileLineNumbers "core\fnc\common\show_hint.sqf"; | |||
btc_fnc_intro = compile preprocessFileLineNumbers "core\fnc\common\intro.sqf"; | |||
btc_fnc_set_markerText = compile preprocessFileLineNumbers "core\fnc\common\set_markerText.sqf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btc_fnc_set_markerTextLocal
may be ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea I will change this.
@@ -6,8 +6,7 @@ _vehicle = _this select 0; | |||
_marker = createmarker [format ["m_%1",_vehicle],getPos _vehicle]; | |||
_marker setMarkerType "mil_box"; | |||
_marker setMarkerColor "ColorRed"; | |||
_marker setMarkerText format [(localize "STR_BTC_HAM_O_EH_VEHKILLED_MRK"),getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName")]; // %1 wreck | |||
|
|||
[_marker,{localize "STR_BTC_HAM_O_EH_VEHKILLED_MRK"},(getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName"))] remoteExec ["btc_fnc_set_markerText",0,true]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a simple [_marker,"STR_BTC_HAM_O_EH_VEHKILLED_MRK",(getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName"))] remoteExec ["btc_fnc_set_markerText",0,true];
?
Then in btc_fnc_set_markerText
and check isLocalized ? instead of :
//check text for localization code
if ((typeName _text) isEqualTo "CODE") then {
_text = call _text;
};
Do it for all remoteexec with {localize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 😄
@@ -19,7 +19,8 @@ if (isNil {_cache getVariable "btc_hd_cache"} && {_explosive} && {_damage > 0.6} | |||
deleteVehicle btc_cache_obj; | |||
_marker = createmarker [format ["btc_cache_%1", btc_cache_n], btc_cache_pos]; | |||
_marker setmarkertype "hd_destroy"; | |||
_marker setMarkerText format ["Cached %1 destroyed", btc_cache_n]; | |||
[_marker,{localize "STR_BTC_HAM_O_EH_HDCACHE_MRK"},btc_cache_n] remoteExec ["btc_fnc_set_markerText",0,true]; //Cached %1 destroyed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remoteexec only client side (-2) not all (0).
Do it for all remoteexec :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the reason for the execution on all machines.
A possible solution is this (for example):
[_marker,{localize "STR_BTC_HAM_O_EH_HDCACHE_MRK"},btc_cache_n] remoteExec ["btc_fnc_set_markerText", [0, -2] select isDedicated, true];
But so you have extra code.
@@ -36,12 +36,12 @@ btc_side_jip_data = [14,getPos _city1,_city1 getVariable "name"]; | |||
//// Create markers \\\\ | |||
_marker1 = createmarker [format ["sm_2_%1",getPos _city1],getPos _city1]; | |||
_marker1 setmarkertype "hd_flag"; | |||
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy Start | |||
[_marker,{localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"}] remoteExec ["btc_fnc_set_markerText",0,true]; //Convoy Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JIP should be removed at the end of side mission see exemple 7.
You could handle this by two way :
-
[] remoteExec ["someScriptCommand", targets, Object or Group or netId ]; see the "JIP (Optional):" section in remoteexec
-
Or get the JIP ID returned by remoteexec and remove it in this function here. When the marker is deleted, delete also the JIP remoteexec you created (if no JIP ID use
""
).Something like this could work (I wrote the concept):
{ params ["_marker", "_JIP_ID"]; deletemarker _marker; if !(_JIP_ID isequalto "") then remoteExec ["", _JIP_ID]; } foreach [["marker name1", "JIP ID1"],["marker name2", "JIP ID2"]];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I´ve changed something. Please take a look.
No problem PS: Sorry for my late answer |
I also learn a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks even more great. I will do final test when those changes are done.
@@ -2,6 +2,8 @@ | |||
|
|||
{ | |||
deletemarker _x; | |||
//remove JIP remoteExec | |||
remoteExec ["", _x]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! So there was a third solution !
@@ -36,12 +36,12 @@ btc_side_jip_data = [14,getPos _city1,_city1 getVariable "name"]; | |||
//// Create markers \\\\ | |||
_marker1 = createmarker [format ["sm_2_%1",getPos _city1],getPos _city1]; | |||
_marker1 setmarkertype "hd_flag"; | |||
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy Start | |||
[_marker,"STR_BTC_HAM_SIDE_CONVOY_MRKSTART"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_marker1
_marker1 setMarkerSize [0.6, 0.6]; | ||
|
||
_marker2 = createmarker [format ["sm_2_%1",_pos2],_pos2]; | ||
_marker2 setmarkertype "hd_flag"; | ||
_marker2 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"); //Convoy End | ||
[_marker,"STR_BTC_HAM_SIDE_CONVOY_MRKEND"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy End |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_marker2
@@ -36,12 +36,12 @@ btc_side_jip_data = [14,getPos _city1,_city1 getVariable "name"]; | |||
//// Create markers \\\\ | |||
_marker1 = createmarker [format ["sm_2_%1",getPos _city1],getPos _city1]; | |||
_marker1 setmarkertype "hd_flag"; | |||
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy Start | |||
[_marker,"STR_BTC_HAM_SIDE_CONVOY_MRKSTART"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_marker1
_marker1 setMarkerSize [0.6, 0.6]; | ||
|
||
_marker2 = createmarker [format ["sm_2_%1",_pos2],_pos2]; | ||
_marker2 setmarkertype "hd_flag"; | ||
_marker2 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"); //Convoy End | ||
[_marker,"STR_BTC_HAM_SIDE_CONVOY_MRKEND"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy End |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_marker2
@@ -6,7 +6,7 @@ _vehicle = _this select 0; | |||
_marker = createmarker [format ["m_%1",_vehicle],getPos _vehicle]; | |||
_marker setMarkerType "mil_box"; | |||
_marker setMarkerColor "ColorRed"; | |||
_marker setMarkerText format [(localize "STR_BTC_HAM_O_EH_VEHKILLED_MRK"),getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName")]; // %1 wreck | |||
[_marker,"STR_BTC_HAM_O_EH_VEHKILLED_MRK",(getText (configFile >> "cfgVehicles" >> typeof _vehicle >> "displayName"))] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; // %1 wreck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the JIP when this marker is deleted ?
Add: remoteExec [_marker, _x];
in /core/fnc/log/server_repair_wreck.sqf#L13)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
done 😄
@@ -36,12 +36,12 @@ btc_side_jip_data = [14,getPos _city1,_city1 getVariable "name"]; | |||
//// Create markers \\\\ | |||
_marker1 = createmarker [format ["sm_2_%1",getPos _city1],getPos _city1]; | |||
_marker1 setmarkertype "hd_flag"; | |||
_marker1 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKSTART"); //Convoy Start | |||
[_marker1,"STR_BTC_HAM_SIDE_CONVOY_MRKSTART"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy Start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started to do local test and got an error : need _marker1
at the end of remoteExec also ^^ a sad copy and paste ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, ok. 😞
sorry
_marker1 setMarkerSize [0.6, 0.6]; | ||
|
||
_marker2 = createmarker [format ["sm_2_%1",_pos2],_pos2]; | ||
_marker2 setmarkertype "hd_flag"; | ||
_marker2 setmarkertext (localize "STR_BTC_HAM_SIDE_CONVOY_MRKEND"); //Convoy End | ||
[_marker2,"STR_BTC_HAM_SIDE_CONVOY_MRKEND"] remoteExec ["btc_fnc_set_markerTextLocal", [0, -2] select isDedicated, _marker]; //Convoy End |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_marker2
^^
Extended_PreInit_EventHandlers compile the compile.sqf file before the JIP remoteExec "btc_fnc_" is executed
#400
When merged this pull request will:
removeExec
andsetMarkerTextLocal
Final test:
Screenshots
English dedicated server and German client