Jump to content
  • 0

Not understanding remote_messages.sqf


azzdayz

Question

Hey guys,

I have this installed, but I guess I don't understand what it should be doing. I thought is was supposed to make the messages from WAI show up different like color wise and stuff, but all I get is the radio messages so either it's not working or I really don't understand it's function.

So here is my thoughts, the remote.sqf needs the remote_message.sqf because it calls it right?

Spoiler

if(!isDedicated) then {

    fnc_remote_message = {
    
        private ["_type","_message","_player"];
    
        _type         = _this select 0;
        _message     = _this select 1;
        
        call {
            if(_type == "radio") exitWith { 
                if(player hasWeapon "ItemRadio") then { 
                    if(player getVariable["radiostate",true]) then {
                        systemChat _message;
                        [objNull,player,rSAY,"Radio_Message_Sound",30] call RE;
                    };
                }; 
            };
            if(_type == "global") exitWith { systemChat _message; };
        };
    };
    
    "RemoteMessage" addPublicVariableEventHandler { (_this select 1) call fnc_remote_message; };

};

remote_ready = true;

But then if it is calling it then what exactly is it doing because it has color to text changes, but I see no change. Maybe that not what it supposed to do at all and if that's the case then what is the point in this line? 

format["<t size='0.40' color='#FFFFFF' align='center'>%1</t><br /><t size='0.70' color='#d5a040' align='center'>%2</t>",_message select 0,_message select 1],

Spoiler

fnc_remote_message = {
    private ["_type","_message"];

    _type = _this select 0;
    _message = _this select 1;

    call {
        if (_type == "radio") exitWith {
            if (player hasWeapon "ItemRadio") then {
                if (player getVariable["radiostate",true]) then {
                    systemChat _message;
                    playSound "Radio_Message_Sound";
                };
            }; 
        };
        if (_type == "private")            exitWith {if(getPlayerUID player == (_message select 0)) then {systemChat (_message select 1);};};
        if (_type == "global")            exitWith {systemChat _message;};
        if (_type == "hint")             exitWith {hint _message;};
        if (_type == "titleCut")         exitWith {titleCut [_message,"PLAIN DOWN",3];};
        if (_type == "titleText")         exitWith {titleText [_message, "PLAIN DOWN"]; titleFadeOut 10;};
        if (_type == "rollingMessages") exitWith {_message call dayz_rollingMessages;};
        if (_type == "dynamic_text")    exitWith {
            [
                format["<t size='0.40' color='#FFFFFF' align='center'>%1</t><br /><t size='0.70' color='#d5a040' align='center'>%2</t>",_message select 0,_message select 1],
                0,
                0,
                10,
                0.5
            ] spawn BIS_fnc_dynamicText;
        };
    };
};

"RemoteMessage" addPublicVariableEventHandler {(_this select 1) spawn fnc_remote_message;};

I tried to explain my question as best as possible , but to sum it up I am just trying to figure out what the heck remote_messages.sqf is supposed to do exactly? I am executing it in my complies, but ya any help understanding it's function would be great.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

this is my example for epoch events.. but is the same---

event.sqf (see lines in red)

Spoiler

private ["_hint","_startingpos","_position","_waypointsrange","_aiskin","_plane_class","_boxtype","_loot_lists","_loot","_startingpos","_this","_center_1","_unitGroup","_pilot","_carrier","_xpos","_ypos",
"_cor_y","_cor_x","_waypos1","_waypos2","_waypos3","_waypos4","_wp1","_wp2","_wp3","_wp4","_waypointend","_positiondrop","_box","_chute","_smoke","_positionarray"];

 


_waypointsrange = 50;//range to move
_aiskin = "TK_Commander_EP1";
_plane_class = "AN2_DZ";
_boxtype = ["USSpecialWeaponsBox","GERBasicWeapons_EP1","GuerillaCacheBox","BAF_Launchers","DZ_ExplosiveBoxRU","DZ_ExplosivesBoxUS","BAF_OrdnanceBox",
"BAF_BasicAmmunitionBox","RUOrdnanceBox","USOrdnanceBox"
]call BIS_fnc_selectRandom;

 


_position = [3376.9175,3975.3352,-7.6293945e-006];
_positionarray = [
[(_position select 0) - 140.5, (_position select 1) - 21,-0.012],
[(_position select 0) - 200, (_position select 1) - 100,-0.012],
[(_position select 0) + 125, (_position select 1) + 115,-0.012],
[(_position select 0) + 106, (_position select 1) - 124,-0.012],
[(_position select 0) + 149, (_position select 1) + 170.5,-0.012],
[(_position select 0) + 138.5, (_position select 1) - 116,-0.012]
];
_startingpos = _positionarray call BIS_fnc_selectRandom;

 

    
//[nil,nil,rTitleText,"Supplys From Air", "PLAIN",10] call RE;
_hint = parseText format["<t align='center' color='#2fee11' shadow='2' size='1'>SUPPLYS FROM AIR</t>"];
RemoteMessage = ['hint', _hint];
publicVariable "RemoteMessage";

 

 


    

_this = createCenter west;
_this setFriend [west, 1];
_center_1 = _this;
_unitGroup = createGroup _center_1;
//

//spawnai
_pilot = objNull;
_pilot = _unitGroup createUnit [_aiskin, [(_startingpos select 0) + 90, (_startingpos select 1) + 100], [], 1, "NONE"];
_pilot addEventHandler ["handleDamage", {false}];
[_pilot] joinSilent _unitGroup;

sleep 1;

_carrier =  createVehicle [_plane_class, [(_startingpos select 0) + 50, (_startingpos select 1) + 50],[], 0, "FLY"];
_carrier         setVehicleVarName "heli";
_carrier         setFuel 1;
_carrier         engineOn true;
_carrier         setVehicleAmmo 1;
_carrier         flyInHeight 150;
_carrier         setVehicleLock "LOCKED";
_carrier         addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
_carrier addEventHandler ["handleDamage", {false}];

dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_carrier];
_pilot     assignAsDriver _carrier;
_pilot     moveInDriver _carrier;

 

_xpos = _startingpos select 0;
_ypos = _startingpos select 1;
_cor_y = -20;
_cor_x = 20;


// These are 4 waypoints in a NorthSEW around the center
_waypos1 = [_xpos, _ypos+20, 0];
_waypos2 = [_xpos+20, _ypos, 0];
_waypos3 = [_xpos, _ypos-20, 0];
_waypos4 = [_xpos-20, _ypos, 0];

_wp1 = _unitGroup addWaypoint [[((_startingpos select 0) + _cor_y),((_startingpos select 1) + _cor_x),50],0];
_wp1   setWaypointType "MOVE";


_wp2 = _unitGroup addWaypoint [_waypos2, _waypointsrange];
_wp2 setWaypointType "MOVE";
_wp3 = _unitGroup addWaypoint [_waypos3, _waypointsrange];
_wp3 setWaypointType "MOVE";
_wp4 = _unitGroup addWaypoint [_waypos4, _waypointsrange];
_wp4 setWaypointType "MOVE";
_waypointend = _unitGroup addWaypoint [[_xpos,_ypos, 0], _waypointsrange];
_waypointend setWaypointType "CYCLE";

 

 

_positiondrop = [(_startingpos select 0) + 50, (_startingpos select 1) + 50,25];
_box = _boxtype createVehicle _positiondrop;
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_box];

 

_chute = createVehicle ["ParachuteMediumEast", getPos _box, [], 0, "FLY"];
_box attachTo [_chute, [0,0,3]];
_smoke = "SmokeShellGreen" createVehicle (getPos _box);
_smoke attachTo [_box, [0,0,0]];
_box addEventHandler ["handleDamage", {false}];
sleep 20;
_box addEventHandler ["handleDamage", {true}];


sleep 60;

deleteVehicle _carrier;
deleteVehicle _pilot;


sleep 60;


deleteVehicle _chute;

EPOCH_EVENT_RUNNING = false;

 

the in your remote_msg

if u wanna play sound change the hint line by

if (_type == "hint")             exitWith {hint _message;playSound "Radio_Message_Sound";};

Link to comment
Share on other sites

  • 0
Just now, azzdayz said:

So correct me if I am wrong, but if I am just using basic mission messages then I can remove remote_messages.sqf?

yes if u use something like:

[nil,nil,rTitleText,"MESSAGE HERE","PLAIN",7.5] call RE;   

thes yes youre not using the function and the pv of remote_messages.sqf

remember it took me almost 3monts to understand how remotemsg works

Link to comment
Share on other sites

  • 0

Hi @azzdayz,
let me try to clarify confusion about remote msgs.
You're mixing two types of code which do the same, but slightly differently.

I'll guess: you visited topic in this section "Dynamic text issue" and used customized file for
remote msgs. If so, here is the start of your confusion:

The first code for remote msg showing above in the first spoiler is default one, using radio msgs only
and calling, in this case, default RE function for remote msg (which means, uses two types of public EH
- default one from arma files, second one from WAI to call default one from arma)

The second piece of code is customized version and it uses just one custom public EH + added possibility
to use more types of msgs. The main reason of custom remote msgs file is use it not just along with WAI,
but everywhere in your scripts so you can change the default behaviour of your msgs.

You wrote about changing color with BIS_fnc_dynamicText function.
The reason why it's not working for you is this: you have to change code in WAI file named "mission_winorfail.sqf"

// This is part of mission_winoffail.sqf that needs to be changed:

// Mission start msg
if (wai_radio_announce) then {
  RemoteMessage = ["radio","[RADIO] " + _msgstart];
  publicVariable "RemoteMessage";
} else {
  [nil,nil,rTitleText,_msgstart,"PLAIN",10] call RE;
};

// Mission win msg
if (wai_radio_announce) then {
  RemoteMessage = ["radio","[RADIO] " + _msgwin];
  publicVariable "RemoteMessage";
} else {
  [nil,nil,rTitleText,_msgwin,"PLAIN",10] call RE;
};

// Mission fail msg
if (wai_radio_announce) then {
  RemoteMessage = ["radio","[RADIO] " + _msglose];
  publicVariable "RemoteMessage";
} else {
  [nil,nil,rTitleText,_msglose,"PLAIN",10] call RE;
};

// ... all of this has to be changed

===

If you want to use dynamic text with customized version of remote msgs file, you have to change:
(it's needed everytime you decide to use different type of remote msg (radio, global chat, dyn. text etc - just follow instructions in code)

RemoteMessage = ["dynamic_text","["your text 1line","your text 2line"]]; // custom text 2 lines
publicVariable "RemoteMessage";

RemoteMessage = ["dynamic_text","[_msgstart,"your text 2line"]]; // default WAI text 1line, custom text 2line
publicVariable "RemoteMessage";

// The confusion part is, dynamic text case comes with two paramaters in array:
_message = _this select 1; // in the beginning of code
//...for dynamic text (check the source code) it's:
[_message select 0, _message select 1] // in dyn. text part

===

You can of course change customized code to fits you needs.
If I may to give you any advice, I would say something like:
stay with your default file on live server and use it safely. Try to change and customize and play with remote msg on your local machine so you can experiment safely.

===

Cheers

Link to comment
Share on other sites

  • 0

Thanks to both of you. You have helped fill in the blanks perfectly. I unknowingly installed the remote messages when I put coins on the server. I saw it later and didn't understand why I had it or if i was using it so I started researching it. Next thing I knew I was completely lost. With all the research and a basic understanding of reading the code I came to the conclusion I mentioned in the beginning, but now I understand.

  I have a test server so I might play around with it and see whats what, but should I decide not to take on the task then I will remove. At least now I know for sure I can :)

Link to comment
Share on other sites

  • 0
4 hours ago, salival said:

I include remote_messages.sqf in ZSC so we can utilize it if a player packs a safe/lockbox with coins in it: https://github.com/oiad/ZSC/blob/master/dayz_server/compile/server_handleSafeGear.sqf#L122-L123

It's the easiest way to send a message to a player from the server plus WAI uses it so...

Well @salivalthat's finally clarify where original code I was reffering to comes from and kills my confusion :smile: Well done, I'm gonna update relevant topic talking about this because we have the winner :)) Thx a lot for this, very usefull...

Link to comment
Share on other sites

  • 0
4 hours ago, azzdayz said:

Thanks to both of you. You have helped fill in the blanks perfectly. I unknowingly installed the remote messages when I put coins on the server. I saw it later and didn't understand why I had it or if i was using it so I started researching it. Next thing I knew I was completely lost. With all the research and a basic understanding of reading the code I came to the conclusion I mentioned in the beginning, but now I understand.

  I have a test server so I might play around with it and see whats what, but should I decide not to take on the task then I will remove. At least now I know for sure I can :)

Hi mate, see bellow post and: do not remove customized version of remote msg which comes from ZSC script (or you will get error when money script will try to send you private msg). You can safely remove default WAI instead - if you do and don't touch any other code, everything should works perfectly (using radio msg in WAI). Everything esle I wrote in my post is valid - I mean if you want to change msgs using "RemoteMessage". Cheers

Link to comment
Share on other sites

  • 0
10 hours ago, iben said:

Hi mate, see bellow post and: do not remove customized version of remote msg which comes from ZSC script (or you will get error when money script will try to send you private msg). You can safely remove default WAI instead - if you do and don't touch any other code, everything should works perfectly (using radio msg in WAI). Everything esle I wrote in my post is valid - I mean if you want to change msgs using "RemoteMessage". Cheers

Wow I opened up a large can of confusion and didn't realize it. Sorry about that, but it's good that it's helping everyone in the end understand something that apparently needed some clarification.

I will try and remove WAI messages (remote.sqf) tonight and see if everything still works. I played around with remote msg (remote_messages.sqf) and couldn't get it to work. I am sure it is just because I still don't fully understand, but trial and error will teach me.

One question though, it sounds like they are basically the same script only one is edited a little bit to allow additional functions should you choose. Does that sound about right?

 

Link to comment
Share on other sites

  • 0
1 hour ago, azzdayz said:

Wow I opened up a large can of confusion and didn't realize it. Sorry about that, but it's good that it's helping everyone in the end understand something that apparently needed some clarification.

I will try and remove WAI messages (remote.sqf) tonight and see if everything still works. I played around with remote msg (remote_messages.sqf) and couldn't get it to work. I am sure it is just because I still don't fully understand, but trial and error will teach me.

One question though, it sounds like they are basically the same script only one is edited a little bit to allow additional functions should you choose. Does that sound about right?

 

Yaeah mate,

you uderstood it well :)

  • if you have WAI installed, one remote msg file, let's say basic version, comes with WAI files.
  • If you have ZSC (coins) installed second remote msg file, let's say now -  extended version, comes with ZSC files.

Well, from your perspective, both files do the same - send msg from server to client (player). From very basic point of view, ZSC (coins) version is able to sent more types of msgs.
It means:

  • if you have ZSC in your files, you don't need WAI original version. If you remove WAI version, everything will work OK unless you will not follow ZSC instructions how to load remote_messages.sqf files in init.sqf.
  • If you have ZSC in your files and you'll remove ZSC version of remote msg (and keep WAI version only), you'll get error, because ZSC uses for example private msgs based on your UID.

As you can see, it confused me as well :)) - because I was answering in one post about public EH and remote msgs and used as an example remote msg file - extended version - but didn't know
where the file comes from :)))) Now it's clear because of @salival answer in thread - and maybe it could be meantioned in ZCS install instructions if it's not done already.

Link to comment
Share on other sites

  • 0

LOL this gettiing very confusing.. or im confused about the first  question.... :laugh:

If im not wrong thers Two types of msgs to be sended with WAI or Events..

One beauty and the other ugly by default.

The beauty needs macas/salival  remote_message.sqf

and is writed in this format:

THE BEAUTY: using remote_message.sqf

_hint = parseText format["<t align='center' color='#2fee11' shadow='2' size='1'>THE MSG</t>"];
RemoteMessage = ['hint', _hint];//this set where the msg is showed //: "private" "global" "hint" "titleCut" "titleText" "rollingMessage" "dynamic_text
publicVariable "RemoteMessage";//this send the PV writed on remote_message.sqf

The default (ugly)

[nil,nil,rTitleText,"THE MSG","PLAIN",7.5] call RE;    

 

..now if ure using "THE BEAUTY"... then you need remote_message.sqf (salival add this for default in his coins remake).

I use "Hint" format in each server msg.. so in remote_message.sqf i change this line to play a sound:

if (_type == "hint") 	exitWith {hint _message;playSound "Radio_Message_Sound";};

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...