RequestScriptPuke

From ZDoom Wiki
Jump to: navigation, search
SkulltagIcon.png Warning: This feature is Skulltag specific, and is not compatible with ZDoom!
To see all of Skulltag's specific features, see Skulltag features.

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

int RequestScriptPuke (int script[, int arg0[, int arg1[, int arg2[, int arg3]]]]) (Dev: 3.0 | 150718-1852)

int NamedRequestScriptPuke (str script[, int arg0[, int arg1[, int arg2[, int arg3]]]]) (Dev: 3.0 | 150718-1852)

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);
}