ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:sendstring

This is an old revision of the document!


Sending strings from server to client

Sending strings

ACS_SendString(int scriptnum, str s) ACS_NamedSendString(str scriptname, str s)

These functions will launch the specified clientside script and send the string to it. For example:

ACS_SendString(123, "Hello there");
ACS_NamedSendString("myscript", "A test string");
Zandronum 3.0 doesn't support clientside named scripts yet!
These functions may not be used to launch serverside scripts, unless in singleplayer. Doing so will result in a ProgramError. Test your mods on a server (this is recommended for many other reasons too).
If multiple SendStrings are done in a row, the scripts may be launched either in order or in reverse order. Whether one order or the other will be used is unspecified.
Zandronum 2.1.2 doesn't support named scripts at all.

Receiving strings

To receive a string, the receiving script must be like this:

script 123 (int a, int b, int c, int d) CLIENTSIDE
{
        // Do nothing if the string hasn't been fully received.
	if (!ReceiveString(a, b, c, d))
		terminate;
	
        // The string has been fully received. It can now be retrieved using GetReceivedString().
	Log(s:"Received string: ", s:GetReceivedString());
}

Use GetReceivedString() to retrieve the string that has just been received.

functions/sendstring.1476813503.txt.gz ยท Last modified: 2016/10/18 20:58 by korshun