Jump to content

Recommended Posts

Literally that. XD

 

Ok, I want to send a message to a particularly machine on the network (not broadcast), that's it, but i can't understand the remoteExec (if this is the way). I also know that hint is for console messaging so instead i will use some cutText or anything else, but how i do this? BTW is run for clients on steam, if that info helps.

Share this post


Link to post
Share on other sites

Are you wanting to send the message from a client to another client or server to a client?


Both methods would have to be done via remoteExec, but both methods would have different solutions.

Share this post


Link to post
Share on other sites

i guess both, just to complete knowledge. I know due to security C2C will be a little harder, anyway let's say Server to client, in fact is that.

Share this post


Link to post
Share on other sites

thnks!! but not as expected, im still dealing with this, apparently the method is by giving a PublicVarClient/server and an addPubliceventhandler, and this just to get the clientOwner then of course put it on the remoteEXEC, but cant get it work! yet..When i finish investigating i'll publsh the code example.

 

test ZONE: 

 

Packet = "TEST"; PublicVariableServer "Packet"; "Packet" addPublicVariableEventHandler {_message = (_this select 1); hint _message;[_message]RemoteExec ["hint",remoteExecutedOwner]}

  • Like 1

Share this post


Link to post
Share on other sites

Very good question.

BTW, if someone could explain how to check that on a unique PC. I never succeeded in making work as a simple local test...

Share this post


Link to post
Share on other sites
3 hours ago, opusfmspol said:

What would prompt the message to the particular machine?

^^this

 

18 hours ago, corralesid said:

Packet = "TEST";
PublicVariableServer "Packet";
"Packet" addPublicVariableEventHandler {
	_message = (_this select 1);
	hint _message;
	[_message]RemoteExec ["hint",remoteExecutedOwner]
};

 

Nothing has been remoteExecuted, as you PVed a variable, so there is no remoteExecutedOwner to reply back to.

 

Maybe something like...

//init.sqf

TAG_fnc_receivedMessage = {
	params[ "_unit", "_msg" ];

  	//Display sent message
	_unit globalChat _msg;

  	//Chose a response based on sent message
	_sendMsg = switch( _msg ) do {
		case "Hello" : {
			"Hi, How are you"
		};
		case "Hi, How are you" : {
			"I'm fine thank you"
		};
	};

	if !( isNil "_sendMsg" ) then {
		//Show responding player the message they are sending
		player globalChat _sendMsg;
		//Remote message back to sender
		[ player, _sendMsg ] remoteExec[ "TAG_fnc_receivedMessage", remoteExecutedOwner ];
	};
};

Say there are only two clients on the server, so one could initiate the conversation as such...

//So the player can see the message he is sending
player globalChat "Hello";
//Initiate conversation to other client
[ player,  "Hello" ] remoteExec[ "TAG_fnc_receivedMessage", allPlayers - [ player ] ];

Where you would then see an automated conversation between the two clients as they remoteExecute messages back and forth to each other.

Hope that is what you are after as I am a little confused about what your actual question is.

Share this post


Link to post
Share on other sites

Tks Larrow,

What I'm trying to do, with one unique laptop, preview, is this small test. I'm aware that on one PC, server and client are same, but I don't understand the process:

in a trigger (set to TRUE):

missionNamespace setVariable ["packet","TEST"];
PublicVariable "Packet";

(I'm aware this is equal to packet = "TEST"; publicVariable "packet";  or even...  missionNamespace setVariable ["packet","TEST",TRUE]; )

 

then, in another trigger, just for the countdown delay:

"Packet" addPublicVariableEventHandler {   hint str _this;  };

 

Note:   a remoteExec:    (str _this) remoteExec ["hint"]  , does nothing more...

That doesn't work. On my mind "Packet" is defined and active, correctly used for addPublicVariableEventHandler and   {hint str _this}  is a code, no?

So, what did I miss please? Is it possible to detail the BIKI page about how this command work (at least in SP/hosted server)  ?

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Note:   a remoteExec:    (str _this) remoteExec ["hint"]  , does nothing more.

They are not the same.

 

RemoteExec without specifying a target(so 0, everybody) will broadcast to all and will also fire on the client/server where the remoteExec was initiated.

If JIP is not specified then only clients present at the time of the remoteExec will receive the broadcast.

 

Where as publicVariable, whilst it will also broadcast to all, addPublicVariableEventHandler only works in multiplayer and will not fire on the client/server that initiated the publicVariable.

A variable that is publicVariable'd is always synced with JIP clients.

 

From addPublicVariableEventHandler wiki page...

Quote
  • This EH works only in Multiplayer environment
  • This EH will not fire on the machine that executed broadcast with publicVariable command, only on the machines that receive the broadcast
  • The value of broadcast variable can be exactly the same, it is the actual broadcast that triggers EH not the change in variable

 

Share this post


Link to post
Share on other sites

Ok, so there is no way to test this command with one PC only. Thanks.

Share this post


Link to post
Share on other sites
21 minutes ago, pierremgi said:

Ok, so there is no way to test this command with one PC only. Thanks.

You can, you just need to start two instances of Arma. ( In my previous post read machine as client or server edited previous post to make this clear )

Each instance has its own owner number, it is not a machine specific number.

  • Thanks 1

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

×