RequestScriptPuke: Difference between revisions

From Zandronum Wiki
(Created page with "{{Template:ACSWarning}} int '''RequestScriptPuke''' (int ''script'', int ''arg0'', int ''arg1'', int ''arg2'') int '''RequestScriptPuke''' (int ''script''[, int ''arg0''[, in...")
 
No edit summary
Tag: Source edit
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
int '''RequestScriptPuke''' (int ''script'', int ''arg0'', int ''arg1'', int ''arg2'')
int '''RequestScriptPuke''' (int ''script'', int ''arg0'', int ''arg1'', int ''arg2'')


int '''RequestScriptPuke''' (int ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]]) {{devfeature|3.0|150718-1852}}
int '''RequestScriptPuke''' (int ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]])


int '''NamedRequestScriptPuke''' (str ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]]) {{devfeature|3.0|150718-1852}}
int '''NamedRequestScriptPuke''' (str ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]])


== Usage ==
== Usage ==
RequestScriptPuke will request the execution of the script of the given script with the given arguments on the server. NamedRequestScriptPuke is the same except with named scripts. Scripts called by this are automatically treated as "execute always" and thus don't need to be negative numbers.
RequestScriptPuke will request the execution of the script of the given script with the given arguments on the server. NamedRequestScriptPuke is the same except with named scripts. Scripts called by this are automatically treated as "execute always" and thus don't need to be negative numbers.


Line 19: Line 18:
If run offline, the script will be executed on the local machine.
If run offline, the script will be executed on the local machine.


==== Return value ====
=== Parameters ===
* ''script'': The number or name to execute.
* ''arg0'' .. ''arg3'': The arguments to be passed to the script.
 
=== Return value ===
'''1''' if the script execution was successfully requested, '''0''' if RequestScriptPuke() is called on the server or the requested script is not NET. Note that the function may return '''1''' and the script still may not be executed on the server due to the unreliableness of the packet.
'''1''' if the script execution was successfully requested, '''0''' if RequestScriptPuke() is called on the server or the requested script is not NET. Note that the function may return '''1''' and the script still may not be executed on the server due to the unreliableness of the packet.


Line 37: Line 40:
</syntaxhighlight>
</syntaxhighlight>


[[category:ACS Functions]]
[[category:ACS functions]]

Latest revision as of 17:54, 2 July 2022

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

int RequestScriptPuke (int script, int arg0, int arg1, int arg2)

int RequestScriptPuke (int script[, int arg0[, int arg1[, int arg2[, int arg3]]]])

int NamedRequestScriptPuke (str script[, int arg0[, int arg1[, int arg2[, int arg3]]]])

Usage

RequestScriptPuke will request the execution of the script of the given script with the given arguments on the server. NamedRequestScriptPuke is the same except with named scripts. Scripts called by this are automatically treated as "execute always" and thus don't need to be negative numbers.

Being a puke wrapper, they have a few caveats and potential pitfalls:

  • The script passed must be NET. It is not possible to request execution of non-NET scripts.
  • The function must be used in CLIENTSIDE scripts and will not do anything but print a warning if called on the server.
  • It is not guaranteed that the puke request ever reaches the server. If the packet containing the request is lost, the server will not recieve the request at all.
  • The activator of the NET script puked is always the local player, not the activator of the parent client-side script.

If run offline, the script will be executed on the local machine.

Parameters

  • script: The number or name to execute.
  • arg0 .. arg3: The arguments to be passed to the script.

Return value

1 if the script execution was successfully requested, 0 if RequestScriptPuke() is called on the server or the requested script is not NET. Note that the function may return 1 and the script still may not be executed on the server due to the unreliableness of the packet.

Examples

In the following example, calling script 2 on the client-side requests puke of script 1 to give the server some cookies.

Script 1 (int numcookies) NET
{
    Print(n: 0, s: " gives the server host ", d: numcookies, s: " cookies in gratitude of the excellent hosting service");
}
 
Script 2 (int numcookies) CLIENTSIDE
{
    RequestScriptPuke(1, numcookies, 0, 0);
}