# WC-NG 259 ReadMe

- Installation
  - `Windows`
  - `OS X`
  - `Unix/Linux`
- Additional Variables
  - `showtimeleft`
  - `showpingdisplay`
  - `shownetworkdisplay`
  - `showstatsdisplay`
  - `statsdisplayfmt`
  - `demogamespeed`
  - `demomillis`
  - `scaletimeleft`
  - `indentfrags`
  - `keephistory`
  - `keepchathistory`
  - `clientcountry`
  - `clientcountrycode`
  - `extinfopingrate`
  - `clientdemoautorecord`
  - `clientdemorecordextinfo`
  - `autofollowactioncn`
  - `actioncnfollowtime`
  - `wcautoversioncheck`
- Additional Commands
  - `wcinfo`
  - `wccheckversion`
  - `wcupdategeoipdatabase`
  - `writehistory`
  - `loadhistory`
  - `getclientcountry`
  - `getclientcountrycode`
  - `getteamkills`
  - `getping`
  - `recordclientdemo`
  - `clientdemocompresslevel`
  - `clientdemoskipservmsg`
  - `clientdemoskipservercmds`
  - `clientdemorecording`
  - `clientdemorawsize`
  - `searchdemo`
  - `stopsearchdemo`
  - `searchdemothreadlimit`
  - `searchdemomindemosize`
  - `searchdemomaxresults`
  - `getdemoduration`
  - `stripextdemo`
  - `recompressdemo`
  - `getactioncn`
  - `jumpto`
  - `gettotalmillis`
  - `getlastmillis`
  - `ifnotdeclared`
  - `roundf`
  - `getgamestatefmt`
  - `getosstring`
  - `guititleleftalign`
  - `countryflagpath`
  - `isipaddress`
- Additional Functions
  - `colors`
  - `console input search`
- Server Browser
  - `filters`
    - `filterservermod`
    - `filterservercountry`
    - `filterserverdesc`
    - `filterservermode`
    - `filterservermodestring`
    - `filterserverhost`
    - `filterservermastermode`
  - `others`
    - `extinfoserverbrowser`
    - `extinfoconnect`
    - `processservers`
    - `loopextinfoplayers`
    - `getextinfoplayercount`
- Additional Master Servers
  - `addmasterserver`
  - `delmasterserver`
  - `listmasterservers`
- Scoreboard
  - `extinfo extensions`
    - `showextinfo`
    - `showfrags`
    - `showdeaths`
    - `showkpd`
    - `showtks`
    - `showacc`
    - `showspectatorping`
    - `showcountry`
    - `showserveruptime`
    - `showservermod`
  - `player display`
    - `showplayerdisplay`
    - `playerdisplayshowspectators`
    - `playerdisplayfontscale`
    - `playerdisplayrightoffset`
    - `playerdisplayheightoffset`
    - `playerdisplaywidthoffset`
    - `playerdisplaylineoffset`
    - `playerdisplayplayerlimit`
    - `playerdisplaymaxteams`
    - `playerdisplaymaxnamelen`
    - `playerdisplayalpha`
  - `others`
    - `oldscoreboard`
    - `showdemotime`
    - `scoreboardtextcolor`
    - `scoreboardtextcolorhead`
- Event System
  - `commands`
    - `scriptevent`
    - `delscriptevent`
    - `delallscriptevents`
    - `getthiseventid`
    - `getscripteventcount`
    - `listscriptevents`
  - `installing events`
  - `uninstalling events`
  - `available events`
  - `event troubleshooting`
- Time Functions
  - `gettimestamp`
  - `getgametimestamp`
  - `formattimestamp`
- Script Vector
  - `scriptvector`
  - `scriptvectorlength`
  - `loopscriptvector`
  - `writescriptvector`
  - `loadscriptvector`
  - `delscriptvectorindex`
  - `delscriptvector`
- HTTP Requests
  - `httpproxy`
  - `httpspeedlimit`
  - `httprequest`
  - `delhttprequest`
  - `httpresponsecodeok`
- Global Chat
  - `chat server setup`
  - `wcchatserver`
  - `wcchatpassword`
  - `wcchataddcert`
  - `wcchatdelcert`
  - `wcchatdelcert`
  - `wcchatlistcerts`
  - `wcchatshowcertdetails`
  - `wcchataddrevokedcert`
  - `wcchatconnect`
  - `wcchatdisconnect`
  - `wcchatautoconnect`
  - `wcchatshowconnects`
  - `wcchatshowservconnects`
  - `wcchatprefix`
  - `wcchatlist`
  - `wcchatlatency`
  - `wcchatgoto`
  - `wcchat`
- Plugins
  - `Plugin Commands`
    - `loadplugins`
    - `unloadplugins`
    - `loadplugin`
    - `unloadplugin`
    - `requireplugin`
    - `ispluginloaded`
    - `listplugins`
    - `listplugincommands`
    - `plugincommand`
  - `Available Plugins`
    - `g15lcd`
      - `drawtext`
      - `updatelcd`
    - `hwtemp`
      - `interface`
      - `gettemp`
      - `example`
      - `note`
- Frequently Asked Questions

## Installation

### Windows

- Run the installer, change the destination path to your sauerbraten installation path, if not detected correctly.
- Start sauerbraten through the created Sauerbraten_wc shortcuts.

### OS X

- Open another finder window, go to your home folder and then browse to Library / Application Support / sauerbraten.
- If you don't see the Library folder, then please check this link.
- Copy the doc, data, packages and plugins folders from the opened wc.dmg into the previous opened dir.
- Browse to the location of the original sauerbraten package, right click it, choose "Show Package Contents" and browse to contents / MacOS
- Rename (backup) the original file sauerbraten_u (OS X 10.6+) or sauerbraten_c (OS X 10.5) to sauerbraten_orig and copy the wclient executeable from the opened wc.dmg into this dir. Now rename it to either sauerbraten_u (OS X 10.6+) or sauerbraten_c (OS X 10.5).

### Unix/Linux

- Open your preferred file manager (e.g. konqueror, dolphin, nautilus, etc.) or terminal and browse to ~/.sauerbraten.
- Copy the doc, data, packages and plugins folders into the previous opened dir.
- Browse to the location of the original sauerbraten binary (e.g. /usr/lib/games/sauerbraten/).
- Rename the binary to sauerbraten_orig and copy the wc executeable into this dir.

## Additional Variables

    showtimeleft <0|1>

Shows a remaining map time counter.
(default: 1)

    showpingdisplay <0|1>

Shows your ping on the game hud.
(default: 1)

    shownetworkdisplay <0|1>

Shows bandwidth stats on the game hud.
(default: 0)
Info: Left side = incoming, Right side = outgoing. p/s = packets/second.
Note: Width/Height needs to be >= 1.6 with showtimeleft and or showpingisplay enabled.

    showstatsdisplay <0|1>

Shows game stats on the game hud.
(default: 1)

    statsdisplayfmt

(default: "Frags: ^f0%f ^f7Deaths: ^f3%d ^f7KpD: ^f0%k ^f7Acc: ^f1%a%% [ctf] ^fs^f7Flags: ^f0%x^fr [ctf][collect] ^fs^f7Skulls: ^f0%x^fr[collect]")
Available format specifiers:

%n | Name
%t | Team
%i | Teamkills
%f | Frags
%d | Deaths
%k | Kills per Death
%a | Accuracy
%h | Highres Ping
%p | Ping
%s | State (alive, dead, ..)
%x | Flags / Skulls
%g | Gamemode
%u | Gamespeed
%l | Game Paused (string) "paused " or ""
%m | Mapname
%o | Mapinfo
%e | Mastermode (string)

Targeting specific game modes:
Operators:

! | not
* | game mode contains
= | game mode is equal to

Example:

    [ctf]Flags: %x[ctf][collect]Skulls: %x[collect]

Is the same as:

    [*ctf]Flags: %x[*ctf][*collect]Skulls: %x[*collect]

More Examples:

    [!ctf]Not CTF[=ffa]Not CTF, but ffa[=ffa][!ctf]

    [!=ffa]not fully equal to ffa[!=ffa][!effic]not effic[!effic]

    demogamespeed <0|1>

Take over Gamespeed from demos instead of playing them in real time.
Note: This variable can't be changed during demo playback.
(default: 0)

    demomillis <ms>

Jump forward to <ms> in demo. Attention: Jumping back is not supported!

    scaletimeleft <0|1>

Scale Time Left timers always to real time.
(default: 1)

    indentfrags <0-8>

Indent frag messages by N spaces.
(default: 4)

    keephistory <0|1>

Write console input history to 'history' on exit (1).
(default: 1)

    keepchathistory <0|1>

include chat in 'history'
(default: 0)

    clientcountry <cn>

Client country.

    clientcountrycode <cn>

Client country (ISO 6166-1) codes.

    overlay <0|1>

Enable overlay image.

    overlayalpha <0.0-1.0>

Set overlay image opcacity.

    overlayimage <path>

Set overlay image.

    overlayscale <0.0-1.0>

Scale overlay image.

    overlayoffsetx <0.0-10.0>

Offset overlay image (horizontal).

    overlayoffsety <0.0-10.0>

Offset overlay image (vertical).

    extinfopingrate <1000-10000>

Polling interval for extinfo.
(default: 2000)

    autofollowactioncn <0|1>

Automatically follow action cn in spectator mode.
(default: 0)

    actioncnfollowtime <0|1>

Determines how long one action will be followed.
(default: 0)

    wcautoversioncheck <0-1>

Check for new versions of WC-NG on startup.
(default: 1)

## Additional Commands

    wcinfo [<get>]

Shows the WC-NG version, Sauerbraten revision, Compiler version and Lib versions.
Pass 1 for get to return a string instead of showing it in the console.

    wccheckversion

Command to check if there is a new version of WC-NG available.

    wcupdategeoipdatabase

Get latest GeoIP Database.

    writehistory [filename]

Write console input history to filename.cfg.
Default filename is history.cfg.

    loadhistory <filename>

Load console input history from filename.

    getclientcountry <cn>

Get Player Country.

    getclientcountrycode <cn>

Get Player Country Code (Example: AT, DE, ... (ISO 6166-1))

    getteamkills <cn>

Get Player teamkills.

    getping <cn>

Get Player ping.

    recordclientdemo [name]

Start client side demo recording.

    stopclientdemo

Stop client side demo recording.

    clientdemoautorecord <0|1>

Record demos automatically.

    clientdemorecordextinfo <0|1>

Record extinfo into demos.
(Default: 1)

    clientdemocompresslevel <0|9>

Sets compress level for client demos.
(Default: 5)

    clientdemoskipservmsg <0|1>

Don't record server messages in client demos.

    clientdemoskipservcmds <0|1>

Don't record result of commands in client demos.

    clientdemorecording

Returns 1 if client demo recording is active.

    clientdemorawsize

Returns the current raw size of the demo being recorded.

    searchdemo [[<gamemode>] [<servername>] [<mapname>] [<name>] [<frags>] [<deaths>] [<acc>] [<teamkills>] [<flags>] [<priv>]]

Search for demos / players in the demos matching the given parameters.
Note: This only works if the demo contains extinfo information.
There is also a GUI for this available in the ogros-menu: /searchdemogui

    stopsearchdemo

Stops searchdemo.

    searchdemothreadlimit <1|logical-cpu-count>

Sets how many threads should be used at a single time for searching.
(Default: logical-cpu-count)

    searchdemomaxresults <0|250>

Sets how many entries will be shown in the result dialog.
(Default: 100)

    searchdemomindemosize <0|0x7FFFFFFF>

Sets minimum demo size.
(Default: 0)

    getdemoduration <demo>

Get duration of the demo in milliseconds. (Returns -1 on error).

    stripextdemo <demo>

Strip extended informations out of a demo.

    recompressdemo <demo>

Recompess demo with a different compression level.

    getactioncn

Get clientnumber of client where something interesting happens, like cn is current flagholder.
Useful for video recording.

    jumpto <mm[:ss]>

Jump forward to mm[:ss] time left in demos. Attention: Jumping back is not supported!

    gettotalmillis

Returns current totalmillis.

    getlastmillis

Returns current lastmillis.

    ifnotdeclared <variable name> <code>

Executes "code" if variable doesn't exist.

    roundf <float num> <n-decimals>

Rounds given float number with n-decimals.

    getgamestatefmt <cn> <format>

Returns a formatted string with the given format specifiers
See statsdisplayfmt table for available format specifiers.
Note: Always requires a valid cn.

    getosstring

Returns the operating system string.
The Result may be: win64, win32, linux64, linux32, osx64, osx32, bsd64, bsd32, other64, other32

    guititleleftalign

Same as guititle, but aligns the text on the left side.

    countryflagpath <country code>

Returns path to flag icon (or "" in case of an error).

    isipaddress <str>

Returns 1 if the given string is an IP-Address.

## Additional Functions

    Colors

- "^f8" black
- "^f9" light gray

    Console Input Search

Console input search works with CTRL + R or CTRL + S (unix shell style, S forward, R backward).
Note: On OS X CTRL is mapped to the META key.

## Server Browser

### Filters

    filterservermod <mod num>

Filter servers by server mod, -3 for ogros mod, -2 for hopmod (0 for all).

    filterservercountry <country code>

Filter servers by country code ("" for all).

    filterserverdescription <description>

Filter servers by server description ("" for all).

    filterservermode <mode num>

Filter servers by game mode (-4 for all).

    filterservermodestring <mode string>

Filter servers by game mode string ("" for all).

    filterservermastermode <mode num>

Filter servers by server mastermode (-2 for all).

### Others

    extinfoserverbrowser <0|2>

Shows the players which are on the server in a gui window,
when you click on a server in the server browser, with connect buttons at the bottom.
If you set extinfoserverbrowser to 2, then the players from non empty servers will be already requested,
before you click on a server, therefore players will be shown earlier when you click on a server.
If you have problems using /extinfoserverbrowser 2 then use /extinfoserverbrowser 1 instead (increasing servpingrate may also help).
Some providers are dropping packets (german T-Com for example) - which may cause some servers to disappear.
Note: Ping Rate is servpingrate and not extinfopingrate in this case.
(default: 1)

    extinfoconnect <server> [<port> [<pass>]]

Use this command instead of connect to see the players which are on the server before connecting.

    processservers

Keep processing/pinging the server list, useful for loopextinfoplayers/getextinfoplayercount.

    loopextinfoplayers <playername> <country code> <callbackargs> <callback>

Loop through all players matching the given player/country name ("" for all).
Example:

    loopextinfoplayers "" "" "server_ip ignore server_port ignore server_name ignore8 player_cn player_ping player_name ignore player_frags player_deaths" [
        echo (format "Server Address:%1:%2 Server Name:%3 CN:%4 Name:%5 Ping: %6 Frags: %7 Deaths: %8" $server_ip $server_port $server_name $player_cn $player_ping $player_name $player_frags $player_deaths)
    ]

Full callback arg list:

    hostname hostint port serverping serverdesc secleft numplayers maxplayers mastermode gamemode mapname gamepaused gamespeed
    cn ping playername playerteam frags flags deaths teamkills acc health armour gunselect priv state playercountrycode playercountry

    getextinfoplayercount

Returns the total (extinfo) player count.

## Additional Master Servers

    addmasterserver <server> [<port>]

Add an additional master server.
If no port is given, then the default master server port is used.
Note: They are persistent and saved on shutdown.

    delmasterserver <server> [<port>]

Delete an additional master server.
If no port is given, then the default master server port is used.

    listmasterservers

List the master servers, including /mastername.

## Scoreboard

### extinfo extensions

    showextinfo <0|1>

Enable extended player infos.
(default: 1)

    showfrags <0|1>

Show extended info frags.
(default: 1)

    showdeaths <0|1>

Show extended info deaths.
(default: 1)

    showkpd <0|1>

Show extended info kills per death.
(default: 0)

    showacc <0|1>

Show extended info accuracy.
(default: 1)

    showtks <0|1>

Show extended info teamkills.
(default: 0)

    showspectatorping <0|1>

Show ping of spectators.
(default: 0)

    showcountry <0|1|2|3|4|5>

Num | Desc
0 | Disabled
1 | Country Code
2 | Country Name
3 | Country Flag | Country Code
4 | Country Flag | Country Name
5 | Country Flag

(default: 3)

    showserveruptime <0|1>

Show Server Uptime in Scoreboard.
(default: 0)

    showservermod <0|1>

Show Server Mod in Scoreboard (If info is available).
(default: 0)

    scoreboardtextcolor <0x000000|0xFFFFFF>

Sets text color in scoreboard (head).
(default: 0xFFFFDD)

    scoreboardtextcolorhead <0x000000|0xFFFFFF>

Sets text color in scoreboard.
(default: 0xFFFF80)

### player display

    showplayerdisplay <0|1>

Shows a small scoreboard on the game hud.
(default: 0)

    playerdisplayshowspectators <0|1>

Show spectators in the player display.
(default: 1)

    playerdisplayfontscale <25|30>

Player display font scale.
(default: 25)

    playerdisplayrightoffset <-100|100>

Player display right offset (Frags / Acc column).
(default: 0)

    playerdisplayheightoffset <0|600>

Player display height offset.
(default: 250)

    playerdisplaywidthoffset <-50|300>

Player display width offset.
(default: 0)

    playerdisplaylineoffset <-30|50>

Player display line offset.
(default: 0)

    playerdisplayplayerlimit <1|64>

Max players shown in the player display.
(default: 0)

    playerdisplaymaxteams <1|16>

Max teams shown in the player display.
(default: 6)

    playerdisplaymaxnamelen <4|15>

Max shown player name length in the player display.
(default: 13)

    playerdisplayalpha <20|255>

Alpha value of the player display (opacity / transparency).
(default: 150)

### others

    oldscoreboard <0|1>

Show name column on the same place as known from <=Justice Edition.
(default: 0)

    showdemotime <0|1>

Shows the time it was in the game in the scoreboard (If available).
(default: 1)

## Event System

### Commands

    scriptevent <eventname> <eventargs> <function>

Creates a new script event.

    delscriptevent <eventid>

Deletes a script event.

    delallscriptevents

Deletes all script events.

    getthiseventid

Works only in events: Returns the ID of the current event.

    getscripteventcount

Returns the count of the current installed events.

    listscriptevents

Lists current installed events.

### Installing Events

examples:

        scriptevent "playerrename" "player_cn player_name_old player_name_new" [
            echo (concat $player_name_old "renamed to" $player_name_new)
        ]

If you only need the cn as an argument:

        scriptevent "playerrename" "player_cn" [
            echo (concat "cn" $player_cn "renamed")
        ]

If you don't need any arguments at all you may also skip the "arguments" and start with the function directly:

        scriptevent "playerrename" [
            echo "someone renamed"
        ]

You can also use | or , for event argument declaration:

        scriptevent "playerrename" player_cn|player_name_old|player_name_new [
            echo (concat $player_name_old "renamed to" $player_name_new)
        ]

        scriptevent "playerrename" player_cn,player_name_old,player_name_new [
            echo (concat $player_name_old "renamed to" $player_name_new)
        ]

### Uninstalling Events

If you want to be able to uninstall events at runtime, then you need to save the returned event id from the scriptevent command.

For example:

        event_id = (scriptevent "playerrename" "player_cn player_name_old player_name_new" [
            echo (concat $player_name_old "renamed to" $player_name_new)
        ])

        if (delscriptevent $event_id) [ echo "uninstalled event!" ]

Keeping event functions as external functions:

        playerrename_event = [
            echo (concat $player_name_old "renamed to" $player_name_new)
        ]

        scriptevent "playerrename" "player_cn player_name_old player_name_new" $playerrename_event

### Available Events

Player Events:
playerconnect | clientnum, name |
playerdisconnect | clientnum, name |
playerrename | clientnum, oldname, newname |
playerjoinspec | clientnum, name |
playerleavespec | clientnum, name |
playerswitchteam | clientnum, name, oldteam, newteam, reason |
playertext | clientnum, name, text | use "result 1" to prevent console message from being shown
playerteamtext | clientnum, name, text | use "result 1" to prevent console message from being shown
playerfrag | clientnum, name, actor clientnum, actor name | use "result 1" to prevent console message from being shown
playerteamkill | clientnum, name, actor clientnum, actor name |
playerpingupdate | clientnum, name, ping value |
CTF Events:
flagscore | clientnum, actor name, actor flagcount, team flagcount, was dropped | returned string will be appended to display string
flagdrop | clientnum, actor name, actor flagcount | returned string will be appended to the console message
flagtake | clientnum, actor name, actor flagcount | returned string will be appended to the console message
flagreturn | clientnum, actor name, actor flagcount |
flagreset | - |
coaf | team name |
COLLECT Events:
skullscore | clientnum, actor name, actor flagcount, team flagcount, was dropped | returned string will be appended to display string
skulltake | clientnum, actor name, actor flagcount | returned string will be appended to the console message
coas | team name |
CAPTURE Events:
basecaptured | owner team, enemy team, base name |
baselost | owner team, enemy team, base name |
coab | team name |
Misc Events:
startup | - |
shutdown | - |
frame | - |
mapstart | gamemode name, map name |
intermission | gamemode name, map name |
servmsg | text | use "result 1" to prevent console message from being shown
servcmd | text | (N_SERVCMD)
masterupdate | master clientnum, master name, privilege (numeric) |
mastermodeupdate | master clientnum, mastermode | master clientnum might be < 0
consoleinput | text | use console input (emits a warning when being installed)
Plugin Events:
pluginload | plugin name |
pluginunload | plugin name |
Demplayback Events:
demostart | - |
demoend | - |
Extinfo Events:
servermod | servermod | currently supported: remod, suckerserv, spaghettimod, oomod and hopmod
extinfoupdate | cn, ping, name, team, frags, flags, deaths, teamkills, acc, health, armour, gun, privilege, state |
countryupdate | cn, country, countrycode |
Network Events:
connect | ip as string, port ip byte 1, ip byte 2, ip byte 3, ip byte 4 |
disconnect |
bandwidthupdate | in (kb/s), out (kb/s), in packets (p/s), out packets (p/s), in (total kb), out (total kb), in packets (total), out packets (total), reliable packets lost (total) | called once in a second when connected
Event System Events:
scriptinit | - | Only called in current file after loading, gets automatically uninstalled after execution
Demo Events:
clientdemostart | demofilename |
clientdemoend | demofilename |
GUI Events:
showgui | guiname |
closegui | guiname |

### Event Troubleshooting

Getting unused event variables warnings? Then you've declared event args, but you aren't using them.
You can simply fix this by replacing the variable name with ignore or null.
Hint: You can switch this warning off by setting eventsystemnounusedcallargwarning to 1.
Example:

    scriptevent "playerconnect" "player_cn player_name" [ echo $player_name ]

In this case "player_cn" is unused, the fixed version would be:

    scriptevent "playerconnect" "ignore player_name" [ echo $player_name ]

## Time Functions

    gettimestamp

Get current unix timestamp.

    getgametimestamp

Get game timestamp.
Note: Returns 0 if not available.

    formattimestamp <timestamp> <format>

Format given timestamp. See Link for available format specifiers.

## Script Vector

    scriptvector <name> [[<index>] [<value>] [<no-warnings>]]

Stores "value" with index "index" in vector "name".
If no value is given, then the value of "index" in vector "name" is returned.
Note: You always need to create a scriptvector first, before you can store values to it.
scriptvector "test" - creates / clears scriptvector test
scriptvector "test" "x" "z" - stores z in index x
scriptvector "test" "x" - returns value of index "x" = z

    scriptvectorlength <name>

Return how many objects are stored in the given Script Vector.

    loopscriptvector <name> <index (ident)> <value (ident)> <code> [<start> <end>]

Iterate through a Script Vector.

    loadscriptvector <file>

Load Script Vector from a file.

    writescriptvector <file>

Write Script Vector to a file.

    delscriptvectorindex <name> <index>

Delete index "index" in vector "name", returns 1 on success.

    delscriptvector <name>

Delete Script Vector "name", returns 1 on success.

## HTTP Requests

    httpproxy <host:port>

Use proxy for http requests.
(default: "")

    httpspeedlimit <limit in kb/sec>

Limit download tranfser rate per request to .. kb/s - 0 for unlimited.
Will also take affect on active http requests.
(default: 0)

    httprequest <url> [[<callback args>] [<callback>] [<referer>] [<useragent>]

Returns the request handle id, or 0 on error. This function returns 0, when there are too many active requests or no url is given.
Binary files are NOT supported, because they may contain zeroes which cannot be seen from cubescript!
Limit is 10 concurrent requests. Connect timeout is 5 seconds.

    delhttprequest <id>

Uninstalls an active http request. Returns 1 on success, otherwise 0.
Attention: Callback will be still called, but responsecode will be set to -2,
therefore always use httpresponsecodeok to check the response code.

    httpresponsecodeok <response code>

Returns 1 if there haven't happened any internal errors, and response code is equal to 200.

example:

        rv = (httprequest "http://wc-ng.sauerworld.org/ipecho.php" "request_ok response_code response_data response_datalen" [
            if (&& ($request_ok) (httpresponsecodeok $response_code)) [
                echo (format "Response Code: %1  Response Data Length: %2  Response Data: %3" $response_code $response_datalen $response_data)
            ] [
                error "http request failed, or was interrupted with delhttprequest"
            ]
        ])

        if (= $rv 0) [
            error "failed to create http request: too many active requests"
        ]

## Global Chat

Please see TODO in how to setup a chat server.

    wcchatserver

Fmt: [ssl:]<hostname>[:<port>]

    wcchatpassword

Password for the chat server.

    wcchatconnect

Connect to the chat server.

    wcchatdisconnect

Disconnect from the chat server.

    wcchatautoconnect

Automatically connect to the chat server on startup.
(default: 0)

    wcchatprefix <num or hash>

Delete a certificate.

    wcchatprefix

Clear all certificates.

    wcchatlistcerts

List added certificates.

    wcchatshowcertdetails

Show certificate details (root certs + current server).

    wcchataddrevokedcert <hash>

Permanently revoke a certificate.

    wcchatshowconnects

Show connects and disconnects.
(default: 1)

    wcchatshowservconnects

Show connects to game servers.
(default: 1)

    wcchatprefix

Prefix for chat messages.
(default: "^fs^f9[c]^fr")

    wcchatprefix <hash> [<hostname>]

Add a chat server certificate (hostname = bind the certificate to a specific host).
Supported hash types are: MD5, SHA1, SHA224, SHA256, SHA384 and SHA512.

    wcchatlist

List connected clients.

    wcchatlatency

Show round trip time (ping).

    wcchatgoto <id or name>

Connect to the (game-)server of given client.

    wcchat <msg>

Write a chat message (this is bound to the keys P and C by default)

## Plugins

### Plugin Commands

    loadplugins

Load all available plugins. Returns the number of loaded plugins for cubescript usage.

    unloadplugins

Unload all loaded plugins. Returns the number of unloaded plugins for cubescript usage.

    loadplugin <name>

Load a plugin by name. Returns 1 if the plugin was successfully loaded, otherwise 0 (for cubescript usage).

    unloadplugin <name>

Unload a plugin by name. Returns 1 if the plugin was successfully unloaded, otherwise 0 (for cubescript usage).

    requireplugin <name>

Load plugin by name when not already loaded. Returns 1 on success, otherwise 0 (for cubescript usage).

    ispluginloaded <name>

Check if given plugin is loaded.

    listloadedplugins [<val>]

List loaded plugins (pass 1 for val to get a string for cubescript usage).

    listplugincommands [<val>]"

List supported plugin commands (pass 1 for val to get a string for cubescript usage).

    plugincommand <command> [<val>]

Execute a plugin command.

### Available Plugins

### g15lcd (windows and linux)

    drawtext <line text>

example: drawtext "1 drawn on first line"

    updatelcd

Flush text buffer to keyboard.

### hwtemp (windows, linux and OS X)

    interface <interface to use>

Interfaces:

Windows:

Interface | Description | Note
coretemp | cpu temperature | coretemp must be running
nvgpu | nvidia gpu temperature |

Linux:

Interface | Description | Note
lm-sensors | misc temperatures | you may need to run sensors-detect
nvgpu | nvidia gpu temperature | proprietary nvidia driver needs to be used (use lm-sensors for nouveau)
atigpu | amd/ati gpu temperature | proprietary amd catalyst driver needs to be used
amdgpu | same as atigpu |

    gettemp

Request temperatures

The result is delievered through an event:

Event | Arguments | Note
hwtemp_interface | interface n-temperatures-following |
hwtemp | device-name temperature hw-load | hw-load is coretemp only

    Example

    requireplugin hwtemp
    scriptevent "hwtemp" "device temperature" [ echo (format "temperature of %1 is %2 C" $device $temperature) ]
    setplugin hwtemp interface nvgpu
    getplugin hwtemp gettemp

    Note

Don't be scared about high GPU temperatures like 70-80°c and above, that's quite normal for a GPU (especially for newer nvidia cards) but not for a CPU.

### FAQ (Frequently Asked Questions)

Q: Why is my ping in the scoreboard different compared to the one on the game hud?
A: Ping in scoreboard is less accurate due to rounding.