publicVariableClient: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]3(\|.*)\]\]" to "{{GameCategory|arma3|Scripting Commands}}")
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(52 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |Game name=
|game1= arma2oa
|version1= 1.62


|1.62|Game version=
|game2= tkoh
|version2= 1.00


|gr1 = Multiplayer |GROUP1=
|game3= arma3
|version3= 0.50


|gr2 = Variables |GROUP2=
|gr1= Multiplayer
____________________________________________________________________________________________


| Send the variable value to the client computer - same limitations regarding variable type as [[publicVariable#Description|publicVariable]].
|gr2= Variables
 
|descr= Send the variable value to the client computer - same limitations regarding variable type as [[publicVariable#Description|publicVariable]].


The Client ID is the temporary ID given to a connected client for that session. You can find out this ID with the [[owner]] command (using it on a player's character, for example, will give you that players client ID).<br><br>
The Client ID is the temporary ID given to a connected client for that session. You can find out this ID with the [[owner]] command (using it on a player's character, for example, will give you that players client ID).<br><br>


{{Feature|arma3|In Arma 3 it is possible to broadcast [[nil]] value}}|DESCRIPTION= 
{{Feature|arma3|In Arma 3 it is possible to broadcast [[nil]] value}}


____________________________________________________________________________________________
|s1= clientID [[publicVariableClient]] varName


| clientID '''publicVariableClient''' varName |SYNTAX=
|p1= clientID: [[Number]]


|p1= clientID: [[Number]] |PARAMETER1=
|p2= varName: [[String]]


|p2= varName: [[String]] |PARAMETER2=
|r1= [[Nothing]]


| [[Nothing]] |RETURNVALUE=
|x1= <sqf>3 publicVariableClient "CTFscoreOne";</sqf>
____________________________________________________________________________________________
 
|x1= <code>3 '''publicVariableClient''' "CTFscoreOne";</code> |EXAMPLE1=
____________________________________________________________________________________________
 
| [[clientOwner]], [[owner]], [[publicVariable]], [[publicVariableServer]], [[addPublicVariableEventHandler]], [[remoteExecutedOwner]] |SEEALSO=


|seealso= [[clientOwner]] [[owner]] [[publicVariable]] [[publicVariableServer]] [[addPublicVariableEventHandler]] [[remoteExecutedOwner]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on 24 Aug, 2012
<dt><dt>
<dt class="note">[[User:Kylania|Kylania]]<dd class="note">
<dd class="notedate">Posted on 24 Aug, 2012</dd>
<dt class="note">[[User:Kylania|Kylania]]</dt>
<dd class="note">
publicVariableServer (run on client)<BR>
publicVariableServer (run on client)<BR>
publicVariableClient (run on server)<BR>
publicVariableClient (run on server)<BR>
Line 46: Line 44:
Publishes a variable (name as STRING) to a specific client, from the server. This is useful where you want to synchronize a variable with only a specific client.<BR>
Publishes a variable (name as STRING) to a specific client, from the server. This is useful where you want to synchronize a variable with only a specific client.<BR>


This is a useful way to cut down on network traffic, as publicVariable commands are issued as a priority message. So use publicVariable sparingly, and these commands where they apply. - [http://forums.bistudio.com/showthread.php?136494-ARMA-2-OA-beta-build-94209-(1-60-MP-compatible-build-post-1-60-release)&p=2179795&viewfull=1#post2179795 Rocket]
This is a useful way to cut down on network traffic, as publicVariable commands are issued as a priority message. So use publicVariable sparingly, and these commands where they apply. - {{Link|link= http://forums.bistudio.com/showthread.php?136494-ARMA-2-OA-beta-build-94209-(1-60-MP-compatible-build-post-1-60-release)&p=2179795&viewfull=1#post2179795|text= Rocket}}
 
<dt><dt>
<dd class="notedate">Posted on 21 Sep, 2013
<dd class="notedate">Posted on 21 Sep, 2013</dd>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]<dd class="note">
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note">
While [[publicVariable]] is JIP compatible and persistent, [[publicVariableClient]] is not. If you log out then log in with the same owner id the public variable sent to your client prior will be [[nil]].
While [[publicVariable]] is JIP compatible and persistent, [[publicVariableClient]] is not. If you log out then log in with the same owner id the public variable sent to your client prior will be [[nil]].
<code>//server
<sqf>
//server
pv = 123;
pv = 123;
3 [[publicVariableClient]] "pv";
3 publicVariableClient "pv";
//connected client with id 3
//connected client with id 3
[[hint]] [[str]] pv; //123
hint str pv; //123
//
//
//client log out/log in
//client log out/log in
//
//
//client id is still 3
//client id is still 3
[[hint]] [[str]] pv; //error, undefined variable pv</code>
hint str pv; //error, undefined variable pv
 
</sqf>  
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>


[[Category:Arma 2: Operation Arrowhead: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
<dt></dt>
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
<dd class="notedate">Posted on 2015-04-12 - 09:27 (UTC)</dd>
{{GameCategory|arma3|Scripting Commands}}
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Multiplayer|{{uc:{{PAGENAME}}}}]]
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 12, 2015 - 09:27 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
<dd class="note">
Tested in Arma 3 v1.43, [[publicVariableClient]] works client-to-client if [[owner]] id of the targeted client is known.
Tested in Arma 3 v1.43, [[publicVariableClient]] works client-to-client if [[owner]] id of the targeted client is known.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 19:42, 3 September 2024

Hover & click on the images for description

Description

Description:
Send the variable value to the client computer - same limitations regarding variable type as publicVariable. The Client ID is the temporary ID given to a connected client for that session. You can find out this ID with the owner command (using it on a player's character, for example, will give you that players client ID).

Arma 3
In Arma 3 it is possible to broadcast nil value
Groups:
MultiplayerVariables

Syntax

Syntax:
clientID publicVariableClient varName
Parameters:
clientID: Number
varName: String
Return Value:
Nothing

Examples

Example 1:
3 publicVariableClient "CTFscoreOne";

Additional Information

See also:
clientOwner owner publicVariable publicVariableServer addPublicVariableEventHandler remoteExecutedOwner

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on 24 Aug, 2012
Kylania
publicVariableServer (run on client)
publicVariableClient (run on server)
Publishes a variable (name as STRING) to a specific client, from the server. This is useful where you want to synchronize a variable with only a specific client.
This is a useful way to cut down on network traffic, as publicVariable commands are issued as a priority message. So use publicVariable sparingly, and these commands where they apply. - Rocket
Posted on 21 Sep, 2013
Killzone_Kid
While publicVariable is JIP compatible and persistent, publicVariableClient is not. If you log out then log in with the same owner id the public variable sent to your client prior will be nil.
//server pv = 123; 3 publicVariableClient "pv"; //connected client with id 3 hint str pv; //123 // //client log out/log in // //client id is still 3 hint str pv; //error, undefined variable pv
Posted on 2015-04-12 - 09:27 (UTC)
Killzone_Kid
Tested in Arma 3 v1.43, publicVariableClient works client-to-client if owner id of the targeted client is known.