Networked Data¶
Networked Variables¶
void RegisterNetworkedVariable( string name, int SNDC_category, int SNVT_type, var defaultValue = 0, float rangemin = 0, float rangemax = 0 )
Registers a named networked variable.
int GetNetworkedVariableIndex( string name )
Gets the internal index used to reference a scripted network variable. For use with FX_PATTACH_SCRIPT_NETWORK_VAR
.
void SetGlobalNetBool( string name, bool value )
void SetGlobalNetInt( string name, int value )
void SetGlobalNetFloat( string name, float value )
void SetGlobalNetFloatOverTime( string name, float value, float time )
void SetGlobalNetTime( string name, float value )
void SetGlobalNetEnt( string name, entity value )
bool GetGlobalNetBool( string name )
int GetGlobalNetInt( string name )
float GetGlobalNetFloat( string name )
float GetGlobalNetTime( string name )
entity GetGlobalNetEnt( string name )
Remote Functions¶
Remote functions allow the SERVER
to call registered script functions on the CLIENT
and UI
VM.
void Remote_BeginRegisteringFunctions()
Begin registration of remote functions.
void Remote_EndRegisteringFunctions()
Finish registration of remote functions.
void AddCallback_OnRegisteringCustomNetworkVars( void functionref() callback )
Note
This function is not native. It's defined in Northstar.CustomServers
Registers a callback when Remote functions are being registered.
To register custom remote functions you are required to use this callback because functions can only be registered once.
```squirrel globalize_all_functions
void function MyMod_Init() { AddCallback_OnRegisteringCustomNetworkVars( MyModRegisterRemoteFunctions ) }
void function MyModRegisterRemoteFunctions() { Remote_RegisterFunction( "ExampleRemoteFunction" ) }
void function ExampleRemoteFunction() {} ```
void Remote_RegisterFunction( string name )
Register a function name to be used in remote calls.
void Remote_CallFunction_Replay( entity player, string functionName, ... )
Note
Allowed extra parameter types are null, bool, int, and float.
Given a player, function name, and optional parameters, call function in client script.
Then call it again if we rewind and play a kill replay. The command will not reach the client at all if called during a span of time the player skips because they were watching a replay.
void Remote_CallFunction_NonReplay( entity player, string functionName, ... )
Note
Allowed extra parameter types are null, bool, int, and float.
Given a player, function name, and optional parameters, call function in client script.
Does not get called again in replays.
void Remote_CallFunction_UI( entity player, string functionName, ... )
Note
Allowed extra parameter types are null, bool, int, and float.
Given a player, function name and optional parameters, call function in UI script.
Replays¶
While not being networked themselves, these are used by remote functions.
bool ShouldDoReplayIsForcedByCode()
bool Replay_IsEnabled()