RequestScriptPuke: Difference between revisions
DrinkyBird (talk | contribs) (Created page with "{{Template:ACSWarning}} int '''RequestScriptPuke''' (int ''script'', int ''arg0'', int ''arg1'', int ''arg2'') int '''RequestScriptPuke''' (int ''script''[, int ''arg0''[, in...") |
DrinkyBird (talk | contribs) (Remove Devfeature) |
||
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'']]]]) | int '''RequestScriptPuke''' (int ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]]) | ||
int '''NamedRequestScriptPuke''' (str ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]]) | int '''NamedRequestScriptPuke''' (str ''script''[, int ''arg0''[, int ''arg1''[, int ''arg2''[, int ''arg3'']]]]) | ||
== Usage == | == Usage == |
Revision as of 08:51, 2 September 2017
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.
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);
}