Jump to content
Sign in to follow this  
miguel93041

RemoteExec retrieve information

Recommended Posts

I´ve started learning about RemoteExec command because i´ve never used and needed this command so i´ve done a little script wich one player interacts with a subject and the subject retrieves the information to the player, with remoteexec obviously.

 

i call my script putting this in the debug console: ["LLAMAR"] call life_fnc_puntos;

 

This file is called fn_puntos

params[ "_style", "_caller", "_?", "_position" ];

switch (_style) do 
{
	CASE "AÑADIR": 	{
		player remoteExec ["life_fnc_anadir",cursorTarget];
	};
	CASE "QUITAR":  {
		player remoteExec ["life_fnc_quitar",cursorTarget];
	};
	CASE "LLAMAR":  {
		player remoteExec ["life_fnc_info",cursorTarget];
	};
};

And this one is called fn_info

private["_cop"];
//Varios checks para determinar el estado
_cop = _this;

with profileNamespace do {
	if(isNil "civ_puntos") exitWith {"El ciudadano blabla" remoteExec ["hint",_cop];};
	if(civ_puntos == 0) exitWith {format["El ciudadano tiene %1 blabla",civ_puntos] remoteExec ["hint",_cop];};
	if(civ_puntos > 0) exitWith {format["El ciudadano tiene %1 blabla",civ_puntos] remoteExec ["hint",_cop];};
};

 

Well the first part of the script works, it does the remoteExec to fn_info and check the variable civ_puntos but the target fails i dont know how to send the information back to the player.

Can anyone help me pls?

Share this post


Link to post
Share on other sites

So if the information you want the client to have is unique to them, you could use: https://community.bistudio.com/wiki/setVariable to assign a variable to the player remotely, then use remoteexec to have a the client run a script that reads the variable assigned to them using getvariable (get variable also has a default return option as well if there is a chance the player will not have a variable assigned).

 

If the variable is something you want all players computers to be able to read you could make a variable public:

myPublicString = "hello";
publicvariable "myPublicString"; // now everyone knows about myPublicString

 

 

Share this post


Link to post
Share on other sites

No no no.

I give you an example, we have two little guys, a cop and a civilian.

The cop request the civ some information so que do a remoteExec to Civ. And give the cop the information of the civilian doing another remoteExec to the cop.

1º Guy ->RemoteExec -> 2º Guy ->RemoteExec-> 1º Guy

How i make the target for the transicion of the 2º Guy to the 1ºGuy? It dont recognise the target

I need how to do the RemoteExec of 2ºGuy to 1ºGuy

Share this post


Link to post
Share on other sites

You can use the commands I stated as your proably gonna need to store a variable on the civillian

 

but you can also pass infomation via remote exec like you noramlly do:

 

[<params1>, <params2>] remoteExec ["someScriptCommand", targets, JIP];

Share this post


Link to post
Share on other sites

Yes i understand the command and the variable has to be stored on the profile.

The part is failing and i need help is this:

 

Put you an example:

[player] remoteExec ["life_fnc_info",cursorTarget]; -> A player sends a call of a script to a player he is looking. (WORKING FINE)

 

fn_info

private["_cop"];
//Varios checks para determinar el estado

_cop = _this select 0; <- FIRST GUY!!!

with profileNamespace do {
    if(isNil "civ_puntos") exitWith {"El ciudadano no dispone de un blabla" remoteExec ["hint",
_cop];}; <- CHECKING VARIABLE OF THE PLAYER HE WAS LOOKING AND RETRIEVING THAT INFORMATION TO THE FIRST ONE
    if(civ_puntos == 0) exitWith {format["El ciudadano tiene %1 blabla",civ_puntos] remoteExec ["hint",_cop];}; <- CHECKING VARIABLE OF THE PLAYER HE WAS LOOKING AND RETRIEVING THAT INFORMATION TO THE FIRST ONE
    if(civ_puntos > 0) exitWith {format["El ciudadano tiene %1 blabla",civ_puntos] remoteExec ["hint",_cop];}; <- CHECKING VARIABLE OF THE PLAYER HE WAS LOOKING AND RETRIEVING THAT INFORMATION TO THE FIRST ONE
};

 

THE PLAYER HE WAS LOOKING RETRIEVE INFORMATION TO THE FIRST PLAYER WITH REMOTEEXEC, but its failing, im doing bad selecting the target to the first one, how i do it?

 

Share this post


Link to post
Share on other sites

maybe you need to whitelist the hint command in your CfgRemoteExec first. otherwise it looks fine at first glance. although i'm not sure, if the _cop variable survives the move into the next scope. never used "with profilenamespace do" stuff.

Share this post


Link to post
Share on other sites

It might be CfgRemoteExec because i forgot to setup it, i´ll test it tomorrow and let you guys know more about it.

 

Ok i have setup my CfgRemoteExec i think its fine now

class CfgRemoteExec {
    class Functions {
        mode = 1;
        jip = 0;

		class life_fnc_puntos { allowedTargets = 0; jip = 0 };
		class life_fnc_info { allowedTargets = 0; jip = 0 };
		class life_fnc_quitar { allowedTargets = 0; jip = 0 };
		class life_fnc_anadir { allowedTargets = 0; jip = 0 };

    };

    class Commands {
        mode = 1;
        jip = 0;

		class call { allowedTargets = 0; jip = 0 };
		class spawn { allowedTargets = 0; jip = 0 };
        class setFuel { allowedTargets = 0; jip = 0 };
        class addWeapon { allowedTargets = 0; jip = 0 };
        class addMagazine { allowedTargets = 0; jip = 0 };
        class addPrimaryWeaponItem { allowedTargets = 0; jip = 0 };
        class addHandgunItem { allowedTargets = 0; jip = 0 };
		class hint { allowedTargets = 0; jip = 0 };
    };
};

 

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  

×