-
Notifications
You must be signed in to change notification settings - Fork 170
Client Script Functions
SongSing edited this page Jul 7, 2013
·
32 revisions
-
timerID = sys.setTimer(call, time, repeats)
Calls the code incall
aftertime
milliseconds. Ifrepeats
is true then this call repeats itself until unset. Gives atimerID
that can be used to unset the timer. -
sys.unsetTimer(timerID)
Cancels a timer function -
sys.unsetAllTimers()
Cancels all timers. Good for dealing with buggy scripts sometimes. -
sys.sha1(toHash)
returns the sha1 hash of the string -
sys.md4(toHash)
returns the md4 hash of the string (not recommended) -
sys.md5(toHash)
returns the md5 hash of the string -
sys.changeScript(newScript, triggerStartUp)
changes the script with the content. Can be used with webCall or getFileContent to do cool stuff. If optional triggerStartUp is true serverStartUp event will be triggered after loading a new script. -
sys.os()
Client OS name -
sys.eval(script)
Runs the script given in parameter. Returns the result. -
sys.stopEvent()
if called before an event occurs, if possible, stop the events from happening. If called in an event that starts by "before", stops the event from happenning. For example stops your messages being sent in the beforeSendMessage event or stops another player's from been displayed through the beforeChannelMessage event.
-
sys.isSafeScripts()
Whether the script is using safe scripts. -
sys.showingWarnings()
Whether the script is showing warnings. -
sys.rand(min, max)
Returns an integer value between min (inclusive) and max (exclusive). -
sys.time()
Returns the number of seconds since 1 Jan 1070. -
sys.validColor(color)
determines whether color is a valid hexadecimal string (eg #123456 is valid, #5Y6789 is not) -
sys.hexColor(color)
Converts a color (such as 'red') into a hexadecimal color.
-
sys.writeToFile(filename, content)
Writescontent
to the file atfilename
. Will remove any existing content. -
sys.appendToFile(filename, content)
Appendscontent
to the end of the file atfilname
. -
sys.readFile(filename)
Returns the content of the file atfilename
. -
sys.saveVal(key, value)
Storesvalue
to the data.ini file withkey
. -
sys.getVal(key)
Returns the value ofkey
in the data.ini file. -
sys.removeVal(key)
Removes the value ofkey
in the data.ini file. -
sys.getValKeys()
Returns the keys stored in the in the data.ini file. -
sys.getRegVal(key)
Returns the value ofkey
in the registry. -
sys.removeRegVal(key)
Removes the value ofkey
in the registry. -
sys.getRegKeys()
Returns the keys stored in the in the registry. -
sys.zip(file, dir)
Puts all the files (not any directories though...) from directorydir
into a zipfile namedfile
. -
sys.extractZip(file, dir)
Extracts zip filefile
.dir
is an optional parameter to extract into a specific directory. -
sys.makeDir(name)
Makes a directory with namename
-
sys.removeDir(name)
Deletes empty directoryname
-
sys.getCurrentDir()
Returns the absolute path for the directory the client is saved in -
sys.filesForDirectory(dir)
Return an array of files that are located indir
-
sys.synchronousWebCall(url)
calls the web url given, waits for the reply, and returns the reply. -
sys.synchronousWebCall(url, args)
calls the web url given with the args as POST arguments, waits for the reply, and returns the reply. -
sys.webCall(url, script)
calls the web url given, and when the reply is received runs the script given in parameter. At that moment the variable "resp" will contain the response of the web server. -
sys.webCall(url, script, args)
calls the web url given with the args as POST arguments, and otherwise behaves the same way as the previous function.
-
client.printLine(line)
Prints the text specified in all channels. -
client.printHtml(html)
Prints the html text specified. -
client.printChannelMessage(message, channelId, html)
Prints a message in the specified channel. HTML is optional. Be aware that this function calls the ChannelMessage event. Wrong use of both (the event and the function) combined can lead to infinite loops which will make your client crash! -
client.sendText()
Sends the text in the current chat window.
-
client.playerExist(id)
Returns true if a player with that id exists on the server, false otherwise. -
client.name(id)
Gets the name of the player on the server with that id. Returns "Unknown" if not online. -
client.id(name)
Gets the id of a player name. Returns -1 if not online. -
client.auth(id)
Returns the authority level of a player on the server (returns undefined if the player is offline). -
client.isIgnored(id)
Returns true if the player you specified is ignored, false otherwise. -
client.color(id)
Returns the colour of a player. -
client.tiers(id)
Returns the tiers that a player is currently in.
These functions will only affect yourself.
-
client.cancelFindBattle(verbose)
Cancels finding a battle. -
client.hasChannel(channelid)
Returns true if you are currently in the channel with the specified channelid, false otherwise. -
client.ownName()
Returns the name you are currently on. -
client.battling()
Returns true if you are battling, false otherwise. -
client.busy()
Returns true if you are busy (ie unable to accept challenges), false otherwise. -
client.away()
Returns true if you are on idle, false otherwise. -
client.currentChannel()
Returns the id of the channel you are currently on. -
client.ownId()
Returns your own player id. -
client.ownAuth()
Returns your own authority level. -
client.defaultChannel()
Returns the name of your default channel.