-
Notifications
You must be signed in to change notification settings - Fork 30
Scripting reference
Petr Ohlídal edited this page Aug 9, 2019
·
4 revisions
RoR server supports scripting in AngelScript language. You can run them via config file or command line arguments, see README and documentation
This document describes server script API.
- UID ~ User ID
ServerScriptClass server ~ see below.
const int TO_ALL ~ for functions that receive an UID for sending something
ServerType ~ for the server.serverMode attribute (see ServerScriptClass)
SERVER_LANSERVER_INETSERVER_AUTO
broadcastType ~ publish mode enum for the playerChat callback
-
BROADCAST_AUTO~ Do not edit the publishmode (for scripts only) -
BROADCAST_ALL~ broadcast to all clients including sender -
BROADCAST_NORMAL~ broadcast to all clients except sender -
BROADCAST_AUTHED~ broadcast to authed users (bots) -
BROADCAST_BLOCK~ no broadcast
authType ~ authorizations, see RoRnet protocol
-
AUTH_NONE~ no authentication -
AUTH_ADMIN~ admin on the server -
AUTH_RANKED~ ranked status -
AUTH_MOD~ moderator status -
AUTH_BOT~ bot status -
AUTH_BANNED~ banned AUTH_ALL
serverSayType ~ This is used to define who says it, when the server says something
FROM_SERVERFROM_HOSTFROM_MOTDFROM_RULES
ServerScriptClass ~ main interface with the server, available as global variable server, see above.
void Log(const string &in)void say(const string &in, int uid, int type)void kick(int kuid, const string &in)void ban(int buid, const string &in)bool unban(int buid)-
int cmd(int uid, string cmd)~ Execute AngelScript code on the client, seeRoRnet::MSG2_GAME_CMD int getNumClients()string getUserName(int uid)void setUserName(int uid, const string &in)-
string getUserAuth(int uid)~ Returns one of { 'admin', 'moderator', 'ranked', 'bot', 'none' } -
int getUserAuthRaw(int uid)~ Returns value ofauthTypeenum, see above. void setUserAuthRaw(int uid, int)int getUserColourNum(int uid)void setUserColourNum(int uid, int)void broadcastUserInfo(int)string getUserToken(int uid)string getUserVersion(int uid)string getUserIPAddress(int uid)string getServerTerrain()int getTime()int getStartTime()-
void setCallback(const string &in func_role, const string &in func_name, ?&in func)~ Registers a callback function. The function prototype depends on the role argument:- 'frameStep' ~
void fn(float) - 'playerChat' ~
int fn(int, const string &in) - 'gameCmd' ~
void fn(int, const string &in) - 'playerAdded' ~
void fn(int) - 'playerDeleted' ~
void fn(int, int) - 'streamAdded' ~
int fn(int, RoRnet::StreamRegister@)
- 'frameStep' ~
void deleteCallback(const string &in, const string &in, ?&in)-
void throwException(const string &in)~ Raises an error in the scripting engine, see asIScriptContext::SetException() string get_version()string get_asVersion()string get_protocolVersion()uint get_maxClients()string get_serverName()string get_IPAddr()uint get_listenPort()int get_serverMode()string get_owner()string get_website()string get_ircServ()string get_voipServ()int rangeRandomInt(int, int)