Appearance
Login server (platform) clientside
Platform-only: the privileged client API available to Login Server weapons (session, server list, friends, PMs). Game-server scripts cannot use it (loginserver weapons/system.client.d.ts).
Source
Generated from GServer/bin/Debug/net8.0/loginserver/data/scripts/weapons/system.client.d.ts. To change this page, edit the JSDoc in that file.
Overview
Ambient declarations for LOGIN SERVER weapons. Every weapon this server grants runs on the client in the privileged SYSTEM runtime — a V8 engine of its own, separate from game servers' weapons — which the client only uses for a server proving the pinned Login Server identity key.
Weapons listed in serveroptions.json persistentWeapons are PERSISTENT: they keep running (state, timers, open windows) for the whole client session, across every server switch, until sign-out. The rest unload when the player leaves the Login Server. Returning here re-sends the weapon list; an unchanged persistent weapon keeps running (no second onCreated).
There is no world here: no findimg, flags, collections, classes, tiles or camera. What there is: the GUI (gui.client.d.ts), input, timers, player, and the privileged API below — the server list and switching, friends, and the global PM system.
Batched calls (echo, sendPM, servers.connect, ...) queue JS-side and apply at the end of the current handler; calls that return values are direct.
Declarations
echo function
ts
declare function echo(msg: string): voidPrints to the client console. Batched.
sleep function
ts
declare function sleep(seconds: number): Promise<void>Cooperatively pauses the calling async script (seconds, frame resolution).
setTimeout function
ts
declare function setTimeout(handler: (...args: any[]) => void, ms?: number, ...args: any[]): numberCooperatively pauses the calling async script (seconds, frame resolution).
clearTimeout function
ts
declare function clearTimeout(id: number): voidCooperatively pauses the calling async script (seconds, frame resolution).
setInterval function
ts
declare function setInterval(handler: (...args: any[]) => void, ms?: number, ...args: any[]): numberCooperatively pauses the calling async script (seconds, frame resolution).
clearInterval function
ts
declare function clearInterval(id: number): voidCooperatively pauses the calling async script (seconds, frame resolution).
keydown function
ts
declare function keydown(key: string): booleanWhether a key is held this frame ("a".."z", "0".."9", "f1".."f12", "up", "space", "leftshift", ...). False while typing in a text box or while the window is inactive. Direct call.
mousex function
ts
declare function mousex(): numberMouse position in window pixels. Direct call.
mousey function
ts
declare function mousey(): numberMouse position in window pixels. Direct call.
mousedown function
ts
declare function mousedown(button: 'left' | 'right' | 'middle'): booleanMouse position in window pixels. Direct call.
mouseonui function
ts
declare function mouseonui(): booleanWhether the cursor is over any GUI control.
ScreenWidth global
ts
declare const ScreenWidth: numberLive viewport size in pixels.
ScreenHeight global
ts
declare const ScreenHeight: numberLive viewport size in pixels.
TextMeasurement interface
ts
interface TextMeasurementResult of measuretext().
TextMeasurement.width
ts
width: numberTextMeasurement.height
ts
height: numberTextMeasurement.lineheight
ts
lineheight: numberTextMeasurement.lines
ts
lines: string[]measuretext function
ts
declare function measuretext(
text: string,
opts?: { font?: string, fontsize?: number, style?: string, width?: number }
): TextMeasurementMeasures text the way a GuiTextCtrl renders it (width > 0 word-wraps). Direct call.
triggerServer function
ts
declare function triggerServer(scriptType: 'weapon' | 'script', scriptName: string, ...params: any[]): voidAsks the LOGIN SERVER to run onActionServerSide on a serverside script. Only delivered while the player is on the Login Server; elsewhere it is dropped (and logged) — persistent weapons can't reach it from game servers.
WeaponThis interface
ts
interface WeaponThisthis inside a system weapon's handlers.
WeaponThis.name
ts
name: stringWeaponThis.[key]
ts
[key: string]: anyWeaponHandle interface
ts
interface WeaponHandleA handle on another loaded SYSTEM weapon (game servers' weapons aren't visible).
WeaponHandle.name
ts
readonly name: stringWeaponHandle.trigger
ts
trigger(event: string, ...params: any[]): booleanfindweapon function
ts
declare function findweapon(name: string): WeaponHandle | nullA handle on another loaded SYSTEM weapon (game servers' weapons aren't visible).
findWeapon function
ts
declare function findWeapon(name: string): WeaponHandle | nullA handle on another loaded SYSTEM weapon (game servers' weapons aren't visible).
player global
ts
declare const player: { … }The local player on whichever server the client is on. On the Login Server (no world) only id/name/account/nick are meaningful; on a game server x/y/dir/chat/ani/level are live and writes to x/y/dir/chat apply there (batched, like game weapons').
player.id
ts
readonly id: numberplayer.name
ts
readonly name: stringAccount name.
player.account
ts
readonly account: stringAccount name (same as name).
player.nick
ts
readonly nick: stringAccount name (same as name).
player.x
ts
x: numberAccount name (same as name).
player.y
ts
y: numberAccount name (same as name).
player.dir
ts
dir: "up" | "down" | "left" | "right"Account name (same as name).
player.chat
ts
chat: stringAccount name (same as name).
player.ani
ts
readonly ani: stringAccount name (same as name).
player.level
ts
readonly level: stringCurrent level (or gmap) name; '' on the Login Server.
player.hasWeapon
ts
hasWeapon(name: string): booleanWhether a SYSTEM weapon with this name is loaded.
ChatPlayer interface
ts
interface ChatPlayerFrozen view of the local player handed to onPlayerChats.
ChatPlayer.id
ts
readonly id: numberChatPlayer.name
ts
readonly name: stringChatPlayer.account
ts
readonly account: stringChatPlayer.nick
ts
readonly nick: stringChatPlayer.x
ts
readonly x: numberChatPlayer.y
ts
readonly y: numberChatPlayer.dir
ts
readonly dir: "up" | "down" | "left" | "right"ChatPlayer.chat
ts
readonly chat: stringChatPlayer.level
ts
readonly level: stringPrivileged: session & servers
ServerInfo interface
ts
interface ServerInfoA server from the list (GLister), or where the player / a friend is.
ServerInfo.name
ts
readonly name: stringServerInfo.host
ts
readonly host: stringServerInfo.port
ts
readonly port: numberServerInfo.players
ts
readonly players?: numberPlayers online (server list only).
session global
ts
declare const session: { … }The signed-in session.
session.account
ts
readonly account: stringThe signed-in account.
session.onLoginServer
ts
readonly onLoginServer: booleanTrue while connected to the Login Server itself.
session.server
ts
readonly server: ServerInfo & { readonly login: boolean }The server the player is on (or connecting from). login marks the Login Server.
servers global
ts
declare const servers: { … }The game-server list and server switching (Login Server only).
servers.list
ts
list(): Promise<ServerInfo[]>Fetches the public server list (sorted by players, then name). Rejects when the lister is unreachable.
servers.connect
ts
connect(server: { host: string, port: number, name?: string }): voidSends the player to a game server: leaves the current server (Login Server weapons that aren't persistent unload), connects, and on success fires onServerChanged. On failure fires onServerSwitchFailed and the client returns to the Login Server. Batched; applies next frame.
servers.returnToLogin
ts
returnToLogin(): voidLeaves the current game server and returns to the Login Server.
logout function
ts
declare function logout(): voidSigns out: forgets the saved session and returns to the login form.
Privileged: friends & PMs
Friend interface
ts
interface FriendA friends-list entry. Plain data: a fresh copy on every read.
Friend.account
ts
account: stringFriend.online
ts
online: booleanFriend.server
ts
server: ServerInfo | nullWhere they are while online (the Login Server counts); null while offline.
friends global
ts
declare const friends: { … }Your cross-server friends list (GSocial). Changes are async: the result arrives as onFriendsChanged / onFriendRemoved / onFriendError.
friends.connected
ts
readonly connected: booleanfriends.account
ts
readonly account: stringfriends.list
ts
list(): Friend[]Sorted online-first, then by name.
friends.get
ts
get(account: string): Friend | nullSorted online-first, then by name.
friends.has
ts
has(account: string): booleanSorted online-first, then by name.
friends.add
ts
add(account: string): voidSorted online-first, then by name.
friends.remove
ts
remove(account: string): voidSorted online-first, then by name.
PMSender interface
ts
interface PMSenderWho a PM came from.
PMSender.account
ts
readonly account: stringSender's account, or the sending server's name for system PMs.
PMSender.server
ts
readonly server: stringName of the server the sender is on ('' if unknown).
PMSender.system
ts
readonly system: booleanTrue for PMs sent by a serverside script (sendPM on a GServer).
PMMessage interface
ts
interface PMMessageOne received message, from openPM.
PMMessage.text
ts
readonly text: stringPMMessage.at
ts
readonly at: numberReceive time, ms since the Unix epoch.
PMMessage.system
ts
readonly system: booleanReceive time, ms since the Unix epoch.
PMPending interface
ts
interface PMPending extends PMSenderA sender with unread messages, from pendingPMs.
PMPending.count
ts
readonly count: numbersendPM function
ts
declare function sendPM(account: string, text: string): voidSends a private message to a player on ANY server. Online-only: failures come back as onPMFailed(account, reason). Max 200 characters; 10 per 10s.
openPM function
ts
declare function openPM(sender: PMSender | string): PMMessage[]Returns — and marks read — the messages received from sender since the last openPM for them, oldest first. The ONLY way to read PM text: game servers' weapons just get onPMReceived(sender). Held for this session only (up to 200 per sender). Direct call.
pendingPMs function
ts
declare function pendingPMs(): PMPending[]Senders with unread messages, oldest first. Direct call.