Chat
phantom.aj.chatOther players
Chat: saying things, hearing them, emotes, balloons, the chat bar.
Scripts and plugins
A script has all of it, as phantom.aj.chat, and so does a plugin, from ctx.phantom(): the SDK runs in the plugin's own frame. Each call is marked with what it needs: game:read for what the area knows and hears, which "game": "read" in the manifest grants, and game:act for doing things in it as the player, which needs "game": "act" (see Permissions).
Overview
| Member | What it does | Plugins |
|---|---|---|
say() | Says something as if typed into the chat bar and sent (UserCommXtCommManager.onSendMessage): an emote's text shows the emote, an action's plays it, a phrase's words send the phrase, and anything else is free chat with the client's spelling fixes. | game:act |
sayFree() | Says something as free chat whatever it looks like (sendChatMessage), so :) is sent as two characters. | game:act |
onAdminMessage() | Hears Animal Jam's own messages, system and broadcast (ua). | game:read |
onMessage() | Hears everything said in the room as the server sends it (uc): emotes, actions and phrases included, the player's own as the server echoes them. | game:read |
onSaid() | Hears what is said in the room in words, with the speaker looked up: a phrase read from its code, an emote as its text, and who said it and where they stand, read from the client as each line arrives. | game:read |
chat.emotes: The emotes: phantom.aj.chat.emotes.
| Member | What it does | Plugins |
|---|---|---|
all() | Every emote the client has, in id order, with every spelling that makes it and whether it is members only. | game:read |
closeMenu() | Closes the emote menu (closeEmotes). | game:act |
dimMenu() | Dims the menu to half, or brightens it back (dimEmotes, brightenEmotes). | game:act |
get() | One emote by its id, or null for an id the client has none for. | game:read |
isEmote() | Whether the client would turn that text into an emote (doesStringMatchAnEmote), which say then sends instead of the words; sayFree sends them as words. | game:read |
menu() | The HUD's emote menu as the client has it now, or null before the first HUD. | game:read |
openMenu() | Opens the emote menu, as its button does (EmoticonManager.openEmotes). | game:act |
send() | Shows an emote by its id, as picking it from the menu does, and resolves with the room's echo of it. | game:act |
onMenu() | Hears the emote menu open (true) and close (false), however it moves. | game:read |
onSent() | Hears every emote this client sends, wherever from (the menu, the player wall's, typing :), a minigame, send), where the client turns it into the number it sends (idForEmote). | game:read |
chat.phrases: The predefined phrases: phantom.aj.chat.phrases.
| Member | What it does | Plugins |
|---|---|---|
all() | A whole list, each phrase with what may follow it; empty before the lists are in. | game:read |
code() | A phrase's code from its words (safeChatCodeForString), a two part one matched whole as the tree reads it. | game:act |
has() | Whether a list holds that text exactly (containsInTreeArray): either half of a two part phrase on its own, not the two joined (code matches those). | game:read |
isReady() | Whether the client has all five lists in (SafeChatManager.hasLoadedLists). | game:read |
load() | Has the client fetch its phrase lists, as it does the first time a phrase is needed, and resolves once all five are in; at once when they are already. | game:act |
say() | Says a phrase by its code (sendAvatarSafeChat), fetching the lists first if need be, and resolves with the room's echo. | game:act |
text() | A phrase's words from its code, such as 12,3 (safeChatStringForCode): what a safeChat message carries. | game:act |
chat.balloons: Balloons over animals: phantom.aj.chat.balloons.
| Member | What it does | Plugins |
|---|---|---|
show() | Puts the game's balloon over an animal in the room (AvatarManager.addAvatarMessage), in a colour of your own if asked, and resolves with it once it is drawn. | game:act |
chat.log: The chat box: phantom.aj.chat.log.
| Member | What it does | Plugins |
|---|---|---|
clear() | Empties the box, and the repeat list with it (ChatHistory.clearChat). | game:act |
close() | Slides the box shut, as its arrow does (ChatHistory.closeChat), once it is shut. | game:act |
count() | How many lines the box shows: at most a hundred, which the client keeps. | game:read |
dim() | Dims the open box to half, or brightens it (dimChat, brightenChat). | game:act |
isOpen() | Whether the box is open: the client's own test, its clip's frame label (openCloseHandler). | game:read |
isSelectable() | Whether the player can select and copy the words (_chatText.selectable); the client says no. | game:read |
keepSelectable() | Keeps the words selectable, so the player can copy out of the box, against the client turning it off as it rebuilds the HUD. | game:act |
lines() | Every line the box shows, oldest first, its name and words read out of the markup. | game:read |
notice() | Writes a line of your own, the words escaped so they show as written, in any colour and under any name, then keeps the box to its hundred lines and scrolls to it unless the player has the mouse over the box, as the client does. | game:act |
open() | Slides the box open, as its arrow does (ChatHistory.openChat), once it is open. | game:act |
remove() | Takes one line out, counting from 0 at the oldest; resolves with it. | game:act |
scroll() | Where the box is scrolled to, or null when there is none. | game:read |
scrollTo() | Scrolls the box to a line from 1, or to the newest (end); resolves with where it is. | game:act |
write() | Writes a line as the player's own, as the client writes what they say (UserCommXtCommManager.addChatMessage), or under from (ChatHistory.addPrivateMessage). | game:act |
writeAs() | Writes a line as somebody speaking in the room (ChatHistory.addMessage), their name a link that opens their buddy card. | game:act |
writeAvatar() | Writes a line as somebody standing in the room, by their user id (ChatHistory.addMessageById), which looks their names up itself. | game:act |
onLine() | Hears every line the client writes into the box through its own two calls (addMessage and addPrivateMessage): the room's chat, the client's own lines, and write, writeAs and writeAvatar. | game:read |
chat.input: The chat bar as a control: phantom.aj.chat.input.
| Member | What it does | Plugins |
|---|---|---|
allowFreeChat() | Lets the bar take anything typed, or holds it to the letters a SafeChat account may use (ChatHistory.enableFreeChat). | game:act |
dropEmoteRepeats() | Takes the emotes out of the repeat list (removeEmotesFromChatRepeat); resolves with the rest. | game:act |
hasKeys() | Whether the bar's key listener, which drives its predictive text, is on. | game:read |
hideRepeats() | Shuts the repeat window (closeChatRepeatWindow). | game:act |
isShown() | Whether the chat bar shows (chatMsgText.visible); false with no HUD. | game:read |
isTyping() | Whether the bar has the keyboard (stage.focus): the player is typing, not walking. | game:read |
keepLimit() | Holds the bar to a length of your own, against the client putting 70 or 40 back (toggleInGameHud, setupInitialItems); 0 for no limit. | game:act |
limit() | The most characters the bar takes (chatMsgText.maxChars): 70 in a room, 40 in a minigame. | game:read |
repeats() | The lines a member is offered to say again (_chatRepeatArray), oldest first. | game:read |
resetRules() | Puts the bar back as the account's chat type wants it (ChatHistory.resetChatPrivs). | game:act |
setKeys() | Takes the bar's key listener off, or puts it back (removeKeyListeners, reAddKeyListeners). | game:act |
setRepeats() | Puts lines of your own behind the repeat button, the last five kept as the client keeps them, and redraws the button and an open window as the client does after a line is said (setupRepeatChat, onChatRepeatBtn). | game:act |
show() | Shows or hides the chat bar, its send button and the arrow (ChatHistory.showChatInput), until the client shows it again as it rebuilds the HUD. | game:act |
showRepeats() | Opens the repeat window with its lines, as its button does (onChatRepeatBtn). | game:act |
chat.bar: The chat bar: phantom.aj.chat.bar.
| Member | What it does | Plugins |
|---|---|---|
addWord() | Teaches the typist a word for this sitting (addWordToPredictiveText), so it completes and accepts it as it does the approved ones. | game:act |
closeHistory() | Closes the chat history panel (ChatHistory.closeChat). | game:act |
focus() | Puts the keyboard in the chat bar (GuiManager.setFocusToChatText). | game:act |
history() | The lines of the chat history above the bar, oldest first (GuiHud.chatHistTxt). | game:read |
isFreeChat() | Whether free chat is on for this sitting (ChatHistory.enableFreeChatValue). | game:read |
predictive() | The chat bar's approved words typist, or null before the bar has one. | game:read |
reset() | Has the typist start over on the word being typed (resetTreeSearch). | game:act |
setUseType() | Which part of the word list the chat bar's typist offers and checks against. | game:act |
text() | What is typed in the chat bar and not yet sent; empty when nothing is, or there is no bar. | game:read |
type() | Puts words in the chat bar without sending them, with the change typing sends so the bar reacts as if the player typed them. | game:act |
onFreeChat() | Hears free chat being turned on or off (ChatHistory.enableFreeChat). | game:read |
onType() | Hears what is being typed in the chat bar as it is typed, read in the game a few times a second and told on each change, and once at the start. | game:read |
chat.signals: What the room is told about the player's animal through the chat channel: phantom.aj.chat.signals.
| Member | What it does | Plugins |
|---|---|---|
attachmentEmote() | Plays an emote from something the animal wears (sendAvatarAttachmentEmot), with its extra. | game:act |
blend() | Tints the player's animal for the room (sendAvatarBlendColor): 0xSSRRGGBB, the top byte how strong (0 none, 255 full), 0 for no tint. | game:act |
fade() | How solid the player's animal is to the room (sendAvatarAlphaLevel), 0 gone to 1 solid, sent in whole percent. | game:act |
permanentEmote() | Puts a lasting emote over the player's animal (sendPermEmote), which stays rather than fading; null takes it away. | game:act |
petAction() | Plays one of the pet's actions for the room (sendPetAction), with the value it carries. | game:act |
slide() | Tells the room the player rides a slide, by the name the room's slide carries (sendAvatarSlide('bounceslide1')). | game:act |
chat.custom: Phantom's own chat pieces, in place of or beside the client's: phantom.aj.chat.custom.
| Member | What it does | Plugins |
|---|---|---|
box() | Replaces the client's chat bar and send button with an input and a button of Phantom's, styled as asked. | game:act |
shortcuts() | Expands shortcuts in, and blocks, what the player sends: from the chat bar, say and the custom box alike, by overriding the one send they share (`UserCommXtCommManager. | game:act |
window() | A draggable, resizable window of what the room says, each name in a colour of its own and a link: by default the speaker's animal glows for a moment, or onNameClick is told. | game:act |
Methods
say
say(text: string, options?: ActOptions) => Promise<ChatMessage>Says something as if typed into the chat bar and sent (UserCommXtCommManager.onSendMessage): an emote's text shows the emote, an action's plays it, a phrase's words send the phrase, and anything else is free chat with the client's spelling fixes. Resolves with what the room heard, the server's echo.
Throws NOT_READY outside a room, REFUSED while the player is invisible, and TIMEOUT when the room never hears it (a silenced account, words the server dropped).
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | ActOptions |
Returns
Promise<ChatMessage>
Types
ActOptions · ChatMessage · ChatKind
Example
await phantom.aj.chat.say('Hello, Jamaa!');
await phantom.aj.chat.say(':)');sayFree
sayFree(text: string, options?: ActOptions) => Promise<ChatMessage>Says something as free chat whatever it looks like (sendChatMessage), so :) is sent as two characters. The client still mends its spellings, and refuses on an account that may not chat.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | ActOptions |
Returns
Promise<ChatMessage>
Types
Events
onAdminMessage
onAdminMessage(listener: (notice: AdminNotice) => void) => () => voidHears Animal Jam's own messages, system and broadcast (ua).
Parameters
| Name | Type | |
|---|---|---|
listener | (notice: AdminNotice) => void |
Returns
() => void. Call it to stop listening.
Types
onMessage
onMessage(listener: (message: ChatMessage) => void) => () => voidHears everything said in the room as the server sends it (uc): emotes, actions and phrases included, the player's own as the server echoes them. kind says what text holds; onSaid reads it into words.
Parameters
| Name | Type | |
|---|---|---|
listener | (message: ChatMessage) => void |
Returns
() => void. Call it to stop listening.
Types
onSaid
onSaid(listener: (said: Said) => void) => () => voidHears what is said in the room in words, with the speaker looked up: a phrase read from its code, an emote as its text, and who said it and where they stand, read from the client as each line arrives. Lines are told in the order said. Tints, fades and other signals are not told.
Parameters
| Name | Type | |
|---|---|---|
listener | (said: Said) => void |
Returns
() => void. Call it to stop listening.
Types
chat.emotes
The emotes: phantom.aj.chat.emotes. The client's catalogue (gui.EmoticonUtility), sending one, and the HUD's emote menu (GuiManager.emoteMgr).
all
all() => Promise<ChatEmote[]>Every emote the client has, in id order, with every spelling that makes it and whether it is members only. Two reads however many there are; empty before the client has its interface.
Returns
Promise<ChatEmote[]>
Types
closeMenu
closeMenu(options?: ActOptions) => Promise<EmoteMenu>Closes the emote menu (closeEmotes). Throws REFUSED during a new player's first five minutes, when the client keeps it open by its own rule.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<EmoteMenu>
Types
dimMenu
dimMenu(dim: boolean, options?: ActOptions) => Promise<EmoteMenu>Dims the menu to half, or brightens it back (dimEmotes, brightenEmotes). The client only dims an open menu, so dimming a shut one throws REFUSED.
Parameters
| Name | Type | |
|---|---|---|
dim | boolean | |
options optional | ActOptions |
Returns
Promise<EmoteMenu>
Types
get
get(id: number) => Promise<ChatEmote | null>One emote by its id, or null for an id the client has none for.
Parameters
| Name | Type | |
|---|---|---|
id | number |
Returns
Promise<ChatEmote \| null>
Types
isEmote
isEmote(text: string) => Promise<boolean>Whether the client would turn that text into an emote (doesStringMatchAnEmote), which say then sends instead of the words; sayFree sends them as words.
Parameters
| Name | Type | |
|---|---|---|
text | string |
Returns
Promise<boolean>
menu
menu() => Promise<EmoteMenu | null>The HUD's emote menu as the client has it now, or null before the first HUD.
Returns
Promise<EmoteMenu \| null>
Types
openMenu
openMenu(options?: ActOptions) => Promise<EmoteMenu>Opens the emote menu, as its button does (EmoticonManager.openEmotes). On this screen only.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<EmoteMenu>
Types
send
send(id: number, options?: ActOptions) => Promise<ChatMessage>Shows an emote by its id, as picking it from the menu does, and resolves with the room's echo of it. Throws RangeError for an id the client has none for and REFUSED for a member's emote on a free account, which the client answers with its join popup instead.
Parameters
| Name | Type | |
|---|---|---|
id | number | |
options optional | ActOptions |
Returns
Promise<ChatMessage>
Types
Example
const free = (await phantom.aj.chat.emotes.all()).filter((emote) => !emote.membersOnly);
await phantom.aj.chat.emotes.send(free[0]!.id);onMenu
onMenu(listener: (open: boolean) => void) => () => voidHears the emote menu open (true) and close (false), however it moves. A close is heard as the client is asked, so one it refuses is heard too; menu() says where it ended up.
Parameters
| Name | Type | |
|---|---|---|
listener | (open: boolean) => void |
Returns
() => void. Call it to stop listening.
onSent
onSent(listener: (emote: { id: number; text: string; }) => void) => () => voidHears every emote this client sends, wherever from (the menu, the player wall's, typing :), a minigame, send), where the client turns it into the number it sends (idForEmote).
Parameters
| Name | Type | |
|---|---|---|
listener | (emote: { id: number; text: string; }) => void |
Returns
() => void. Call it to stop listening.
chat.phrases
The predefined phrases: phantom.aj.chat.phrases. The lists the client keeps (gui.SafeChatManager), which room chat, jam-a-grams and the player wall send codes from.
The client asks the server for them the first time something needs them. Until they are in, the reads here answer null, false or nothing; load() fetches them and resolves once they are.
all
all(tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure") => Promise<PhraseGroup[]>A whole list, each phrase with what may follow it; empty before the lists are in.
Parameters
| Name | Type | |
|---|---|---|
tree optional | "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" |
Returns
Promise<PhraseGroup[]>
Types
code
code(text: string, options?: { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; }) => Promise<string | null>A phrase's code from its words (safeChatCodeForString), a two part one matched whole as the tree reads it. Null for none and before the lists are in. The room's list by default.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; } |
Returns
Promise<string \| null>
has
has(text: string, options?: { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; }) => Promise<boolean>Whether a list holds that text exactly (containsInTreeArray): either half of a two part phrase on its own, not the two joined (code matches those). False before the lists are in.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; } |
Returns
Promise<boolean>
isReady
isReady() => Promise<boolean>Whether the client has all five lists in (SafeChatManager.hasLoadedLists).
Returns
Promise<boolean>
load
load(options?: ActOptions) => Promise<void>Has the client fetch its phrase lists, as it does the first time a phrase is needed, and resolves once all five are in; at once when they are already. 30 seconds by default.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
say
say(code: string, options?: ActOptions & { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; }) => Promise<ChatMessage>Says a phrase by its code (sendAvatarSafeChat), fetching the lists first if need be, and resolves with the room's echo. Throws RangeError for a code the list has no phrase for.
Parameters
| Name | Type | |
|---|---|---|
code | string | |
options optional | ActOptions & { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; } |
Returns
Promise<ChatMessage>
Types
Example
const code = await phantom.aj.chat.phrases.code('Hello!');
if (code) await phantom.aj.chat.phrases.say(code);text
text(code: string, options?: { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; }) => Promise<string | null>A phrase's words from its code, such as 12,3 (safeChatStringForCode): what a safeChat message carries. Null for no such phrase and before the lists are in. Without a tree the client picks the list, as it does for the room's chat.
Parameters
| Name | Type | |
|---|---|---|
code | string | |
options optional | { tree?: "chat" | "wall" | "ecard" | "report" | "photobooth" | "adventure" | undefined; } |
Returns
Promise<string \| null>
chat.balloons
Balloons over animals: phantom.aj.chat.balloons. Animal Jam's own balloon, drawn on this screen only: nothing is sent and nobody else sees it.
show
show(userId: number, text: string, options?: BalloonOptions & ActOptions) => Promise<Balloon>Puts the game's balloon over an animal in the room (AvatarManager.addAvatarMessage), in a colour of your own if asked, and resolves with it once it is drawn. It follows the animal, and fades on its own after seconds; calling the handle takes it down now. Saying something again over the same animal replaces it.
Throws NOT_READY naming who is in the room when nobody has that user id, and REFUSED when the client draws none (a minigame is on screen). With an image the picture shows in the game's emote bubble, and the text may be empty.
Parameters
| Name | Type | |
|---|---|---|
userId | number | |
text | string | |
options optional | BalloonOptions & ActOptions |
Returns
Promise<Balloon>
Types
BalloonOptions · Balloon · ActOptions
Example
const me = (await phantom.aj.player.current())!.userId;
const balloon = await phantom.aj.chat.balloons.show(me, 'hello', { colour: 0x22c55e });
await balloon.gone;chat.log
The chat box: phantom.aj.chat.log. The history panel along the bottom of the game (GuiManager.chatHist), read and written on this screen only: nothing here is sent to Animal Jam, and nobody else sees a line written here.
The panel is one HTML field (ChatHistory._chatText). The client empties it when it builds the HUD afresh on an account that may chat freely (resetChatPrivs), so a line written here does not outlive that.
await phantom.aj.chat.log.notice('a buddy came online', { colour: 0x22c55e, from: 'Phantom' });clear
clear(options?: ActOptions) => Promise<void>Empties the box, and the repeat list with it (ChatHistory.clearChat).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
close
close(options?: ActOptions) => Promise<void>Slides the box shut, as its arrow does (ChatHistory.closeChat), once it is shut.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
count
count() => Promise<number>How many lines the box shows: at most a hundred, which the client keeps.
Returns
Promise<number>
dim
dim(dim: boolean, options?: ActOptions) => Promise<void>Dims the open box to half, or brightens it (dimChat, brightenChat). The client only dims an open box, so dimming a shut one throws REFUSED.
Parameters
| Name | Type | |
|---|---|---|
dim | boolean | |
options optional | ActOptions |
Returns
Promise<void>
Types
isOpen
isOpen() => Promise<boolean>Whether the box is open: the client's own test, its clip's frame label (openCloseHandler).
Returns
Promise<boolean>
isSelectable
isSelectable() => Promise<boolean>Whether the player can select and copy the words (_chatText.selectable); the client says no.
Returns
Promise<boolean>
keepSelectable
keepSelectable(selectable?: boolean) => Promise<ChatHold>Keeps the words selectable, so the player can copy out of the box, against the client turning it off as it rebuilds the HUD. The handle puts the client's own answer back.
Parameters
| Name | Type | |
|---|---|---|
selectable optional | boolean |
Returns
Promise<ChatHold>
Types
lines
lines() => Promise<ChatLine[]>Every line the box shows, oldest first, its name and words read out of the markup.
Returns
Promise<ChatLine[]>
Types
notice
notice(text: string, style?: NoticeStyle & ActOptions) => Promise<ChatLine>Writes a line of your own, the words escaped so they show as written, in any colour and under any name, then keeps the box to its hundred lines and scrolls to it unless the player has the mouse over the box, as the client does. Resolves with the line written.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
style optional | NoticeStyle & ActOptions |
Returns
Promise<ChatLine>
Types
open
open(options?: ActOptions) => Promise<void>Slides the box open, as its arrow does (ChatHistory.openChat), once it is open.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
remove
remove(index: number, options?: ActOptions) => Promise<ChatLine>Takes one line out, counting from 0 at the oldest; resolves with it. RangeError for none.
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<ChatLine>
Types
scroll
scroll() => Promise<LogScroll | null>Where the box is scrolled to, or null when there is none.
Returns
Promise<LogScroll \| null>
Types
scrollTo
scrollTo(line: number | "end", options?: ActOptions) => Promise<LogScroll>Scrolls the box to a line from 1, or to the newest (end); resolves with where it is.
Parameters
| Name | Type | |
|---|---|---|
line | number | "end" | |
options optional | ActOptions |
Returns
Promise<LogScroll>
Types
write
write(text: string, options?: ActOptions & { from?: string | undefined; }) => Promise<ChatLine>Writes a line as the player's own, as the client writes what they say (UserCommXtCommManager.addChatMessage), or under from (ChatHistory.addPrivateMessage). Resolves with the line written. The text is markup as the client takes it: use notice for words that came from somewhere else.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | ActOptions & { from?: string | undefined; } |
Returns
Promise<ChatLine>
Types
writeAs
writeAs(name: string, text: string, options?: ActOptions) => Promise<ChatLine>Writes a line as somebody speaking in the room (ChatHistory.addMessage), their name a link that opens their buddy card. Resolves with the line written.
Parameters
| Name | Type | |
|---|---|---|
name | string | |
text | string | |
options optional | ActOptions |
Returns
Promise<ChatLine>
Types
writeAvatar
writeAvatar(userId: number, text: string, options?: ActOptions) => Promise<ChatLine>Writes a line as somebody standing in the room, by their user id (ChatHistory.addMessageById), which looks their names up itself. Throws NOT_READY when nobody in the room has that id, and REFUSED when the client wrote nothing.
Parameters
| Name | Type | |
|---|---|---|
userId | number | |
text | string | |
options optional | ActOptions |
Returns
Promise<ChatLine>
Types
onLine
onLine(listener: (line: LoggedLine) => void) => () => voidHears every line the client writes into the box through its own two calls (addMessage and addPrivateMessage): the room's chat, the client's own lines, and write, writeAs and writeAvatar. A notice writes the field itself and is not heard.
Parameters
| Name | Type | |
|---|---|---|
listener | (line: LoggedLine) => void |
Returns
() => void. Call it to stop listening.
Types
chat.input
The chat bar as a control: phantom.aj.chat.input. Whether it shows, how much it takes, free chat, its key listener, whether the player is typing, and the member repeat list beside it (GuiManager.chatHist). On this screen only. What is typed in it is phantom.aj.chat.bar (text, type, onType).
allowFreeChat
allowFreeChat(allow: boolean, options?: ActOptions) => Promise<void>Lets the bar take anything typed, or holds it to the letters a SafeChat account may use (ChatHistory.enableFreeChat). It empties the bar, as the client does. The server still decides what it accepts.
Parameters
| Name | Type | |
|---|---|---|
allow | boolean | |
options optional | ActOptions |
Returns
Promise<void>
Types
dropEmoteRepeats
dropEmoteRepeats(options?: ActOptions) => Promise<string[]>Takes the emotes out of the repeat list (removeEmotesFromChatRepeat); resolves with the rest.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<string[]>
Types
hasKeys
hasKeys() => Promise<boolean>Whether the bar's key listener, which drives its predictive text, is on.
Returns
Promise<boolean>
hideRepeats
hideRepeats(options?: ActOptions) => Promise<void>Shuts the repeat window (closeChatRepeatWindow).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isShown
isShown() => Promise<boolean>Whether the chat bar shows (chatMsgText.visible); false with no HUD.
Returns
Promise<boolean>
isTyping
isTyping() => Promise<boolean>Whether the bar has the keyboard (stage.focus): the player is typing, not walking.
Returns
Promise<boolean>
keepLimit
keepLimit(characters: number) => Promise<ChatHold>Holds the bar to a length of your own, against the client putting 70 or 40 back (toggleInGameHud, setupInitialItems); 0 for no limit. The box's limit only: what Animal Jam accepts is its own. The handle puts the client's back.
Parameters
| Name | Type | |
|---|---|---|
characters | number |
Returns
Promise<ChatHold>
Types
limit
limit() => Promise<number | null>The most characters the bar takes (chatMsgText.maxChars): 70 in a room, 40 in a minigame.
Returns
Promise<number \| null>
repeats
repeats() => Promise<string[]>The lines a member is offered to say again (_chatRepeatArray), oldest first.
Returns
Promise<string[]>
resetRules
resetRules(options?: ActOptions) => Promise<void>Puts the bar back as the account's chat type wants it (ChatHistory.resetChatPrivs). On an account that may chat freely the client empties the chat box with it.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
setKeys
setKeys(listening: boolean, options?: ActOptions) => Promise<void>Takes the bar's key listener off, or puts it back (removeKeyListeners, reAddKeyListeners).
Parameters
| Name | Type | |
|---|---|---|
listening | boolean | |
options optional | ActOptions |
Returns
Promise<void>
Types
setRepeats
setRepeats(lines: readonly string[], options?: ActOptions) => Promise<string[]>Puts lines of your own behind the repeat button, the last five kept as the client keeps them, and redraws the button and an open window as the client does after a line is said (setupRepeatChat, onChatRepeatBtn). Resolves with what it holds.
Parameters
| Name | Type | |
|---|---|---|
lines | readonly string[] | |
options optional | ActOptions |
Returns
Promise<string[]>
Types
show
show(shown: boolean, options?: ActOptions) => Promise<void>Shows or hides the chat bar, its send button and the arrow (ChatHistory.showChatInput), until the client shows it again as it rebuilds the HUD.
Parameters
| Name | Type | |
|---|---|---|
shown | boolean | |
options optional | ActOptions |
Returns
Promise<void>
Types
showRepeats
showRepeats(options?: ActOptions) => Promise<void>Opens the repeat window with its lines, as its button does (onChatRepeatBtn). Throws NOT_READY when there are none to show.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
chat.bar
The chat bar: phantom.aj.chat.bar. What is typed and not yet sent, the history above it, free chat, and the approved words typist. Sending is phantom.aj.chat's.
addWord
addWord(word: string, options?: ActOptions) => Promise<void>Teaches the typist a word for this sitting (addWordToPredictiveText), so it completes and accepts it as it does the approved ones. Only this screen changes.
Parameters
| Name | Type | |
|---|---|---|
word | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
closeHistory
closeHistory(options?: ActOptions) => Promise<void>Closes the chat history panel (ChatHistory.closeChat).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
focus
focus(options?: ActOptions) => Promise<void>Puts the keyboard in the chat bar (GuiManager.setFocusToChatText).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
history
history() => Promise<string[]>The lines of the chat history above the bar, oldest first (GuiHud.chatHistTxt).
Returns
Promise<string[]>
isFreeChat
isFreeChat() => Promise<boolean>Whether free chat is on for this sitting (ChatHistory.enableFreeChatValue).
Returns
Promise<boolean>
predictive
predictive() => Promise<PredictiveText | null>The chat bar's approved words typist, or null before the bar has one.
Returns
Promise<PredictiveText \| null>
Types
reset
reset(options?: ActOptions) => Promise<void>Has the typist start over on the word being typed (resetTreeSearch).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
setUseType
setUseType(useType: PredictiveUseType, options?: ActOptions) => Promise<void>Which part of the word list the chat bar's typist offers and checks against.
Parameters
| Name | Type | |
|---|---|---|
useType | PredictiveUseType | |
options optional | ActOptions |
Returns
Promise<void>
Types
text
text() => Promise<string>What is typed in the chat bar and not yet sent; empty when nothing is, or there is no bar.
Returns
Promise<string>
type
type(text: string, options?: ActOptions) => Promise<string>Puts words in the chat bar without sending them, with the change typing sends so the bar reacts as if the player typed them. Resolves with what the bar now holds.
Parameters
| Name | Type | |
|---|---|---|
text | string | |
options optional | ActOptions |
Returns
Promise<string>
Types
onFreeChat
onFreeChat(listener: (on: boolean) => void) => () => voidHears free chat being turned on or off (ChatHistory.enableFreeChat).
Parameters
| Name | Type | |
|---|---|---|
listener | (on: boolean) => void |
Returns
() => void. Call it to stop listening.
onType
onType(listener: (text: string) => void, { everyFrames }?: { everyFrames?: number | undefined; }) => () => voidHears what is being typed in the chat bar as it is typed, read in the game a few times a second and told on each change, and once at the start.
Parameters
| Name | Type | |
|---|---|---|
listener | (text: string) => void | |
__1 optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
chat.signals
What the room is told about the player's animal through the chat channel: phantom.aj.chat.signals. Each is one pubMsg of its own kind (UserCommXtCommManager.send*), which every other player's client acts on. Each resolves once the client has sent it; the client draws none of it on the player's own screen unless it says so.
attachmentEmote
attachmentEmote(id: number, options?: ActOptions & { extra?: string | undefined; }) => Promise<void>Plays an emote from something the animal wears (sendAvatarAttachmentEmot), with its extra.
Parameters
| Name | Type | |
|---|---|---|
id | number | |
options optional | ActOptions & { extra?: string | undefined; } |
Returns
Promise<void>
Types
blend
blend(colour: number, options?: ActOptions) => Promise<void>Tints the player's animal for the room (sendAvatarBlendColor): 0xSSRRGGBB, the top byte how strong (0 none, 255 full), 0 for no tint. The client sends its own again as its splash tint changes.
Parameters
| Name | Type | |
|---|---|---|
colour | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
fade
fade(alpha: number, options?: ActOptions) => Promise<void>How solid the player's animal is to the room (sendAvatarAlphaLevel), 0 gone to 1 solid, sent in whole percent. The client's own fading goes no lower than 0.45.
Parameters
| Name | Type | |
|---|---|---|
alpha | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
permanentEmote
permanentEmote(id: number | null, options?: ActOptions) => Promise<void>Puts a lasting emote over the player's animal (sendPermEmote), which stays rather than fading; null takes it away. A second covers the first, and taking it away puts the first back.
Parameters
| Name | Type | |
|---|---|---|
id | number | null | |
options optional | ActOptions |
Returns
Promise<void>
Types
petAction
petAction(action: number, options?: ActOptions & { value?: number | undefined; }) => Promise<void>Plays one of the pet's actions for the room (sendPetAction), with the value it carries.
Parameters
| Name | Type | |
|---|---|---|
action | number | |
options optional | ActOptions & { value?: number | undefined; } |
Returns
Promise<void>
Types
slide
slide(name: string, options?: ActOptions) => Promise<void>Tells the room the player rides a slide, by the name the room's slide carries (sendAvatarSlide('bounceslide1')). Only others see it; the player's own animal stays put.
Parameters
| Name | Type | |
|---|---|---|
name | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
chat.custom
Phantom's own chat pieces, in place of or beside the client's: phantom.aj.chat.custom. Each starts with one call and resolves with the handle that undoes it.
box
box(options?: ChatBoxOptions) => Promise<ChatBox>Replaces the client's chat bar and send button with an input and a button of Phantom's, styled as asked. What is typed is said as say says it, so emotes, phrases and shortcuts still work. While it lasts, the client putting the keyboard in its own bar puts it in this box. The handle gives the client's bar back.
Parameters
| Name | Type | |
|---|---|---|
options optional | ChatBoxOptions |
Returns
Promise<ChatBox>
Types
ChatBoxOptions · ChatBoxStyle · ChatBox · InputNode · OverlayOptions · InputOptions · OverlayBounds · Position
shortcuts
shortcuts(options?: ChatShortcutOptions) => Promise<() => Promise<void>>Expands shortcuts in, and blocks, what the player sends: from the chat bar, say and the custom box alike, by overriding the one send they share (UserCommXtCommManager. onSendMessage). The message then goes on through the client's own path, so emotes, actions and phrases still work. The bar itself refuses some characters (/), so keys like /wave work from say and the custom box.
Parameters
| Name | Type | |
|---|---|---|
options optional | ChatShortcutOptions |
Returns
Promise<() => Promise<void>>
Types
Example
const stop = await phantom.aj.chat.custom.shortcuts({ shortcuts: { brb: 'be right back' }, blocked: [/phone/i] });window
window(options?: ChatWindowOptions) => Promise<ChatWindow>A draggable, resizable window of what the room says, each name in a colour of its own and a link: by default the speaker's animal glows for a moment, or onNameClick is told. It starts with what the chat box already shows. Emotes and actions are left out; phrases show as words.
Parameters
| Name | Type | |
|---|---|---|
options optional | ChatWindowOptions |
Returns
Promise<ChatWindow>
Types
ChatWindowOptions · ChatWindowStyle · ChatWindow · PanelNode
Types
The types the calls above take and give, with every field. Import any of them in a plugin from @phantomclient/plugin/sdk, or use them as they are in a script.
ActOptions
How long something that acts may take, and what may end it first.
| Field | Type | |
|---|---|---|
timeoutMs optional | number | undefined | 10 seconds by default. |
signal optional | AbortSignal | undefined |
ChatMessage
Something said in the room, as the server tells it (uc).
| Field | Type | |
|---|---|---|
room | number | The room it was said in, as the message names it. |
userId | number | Who said it, by their user id in the room. |
text | string | What the message carries: the words, or for a phrase its code and for an emote its id. |
kind | ChatKind | How it was made: free, safeChat (a phrase), emote, action… |
level | number | null | How the balloon shows it: 0 plainly, above 1 highlighted; null when the server left it out. |
ChatKind
How a chat message was made, by name (CHAT_KIND).
type ChatKind = keyof typeof CHAT_KIND | 'other'Said
Something said in the room with its speaker looked up and its words read, as onSaid hears.
type Said = ChatMessage & {
/** What was said in words: a phrase read from its code, an emote as the text that makes it. */
text: string;
/** What the message carried before that: a phrase's code, an emote's id. */
raw: string;
/** The speaker's account name; null for somebody the client does not hold. */
userName: string | null;
/** Their animal's name; null for somebody the client does not hold. */
avatarName: string | null;
/** Where their animal stands in the room, or null when it is not drawn. */
at: { x: number; y: number } | null;
}AdminNotice
A message from Animal Jam itself (ua).
| Field | Type | |
|---|---|---|
text | string | |
system | boolean | A system message, shown wherever the player is; otherwise a broadcast. |
ChatEmote
One of the client's emotes.
| Field | Type | |
|---|---|---|
id | number | Its id: its place in EmoticonUtility.emoteSprites, which an emote message carries. |
text | string | The text that shows it, its first spelling: :). |
spellings | string[] | Every spelling that makes it: :angry:, X(, X-(. |
sprite | string | The sprite it is drawn as: emo_happy, emoMO_phantom. |
membersOnly | boolean | Members only: the client's own test, MO as the sprite name's third and fourth letters. |
EmoteMenu
The HUD's emote menu as the client has it (gui.EmoticonManager).
| Field | Type | |
|---|---|---|
open | boolean | |
dimmed | boolean | Dimmed to half, as the client shows it while the player is busy elsewhere. |
count | number | How many emotes it was built with. |
memberEmotes | boolean | Whether it was built with the member emotes. |
PhraseGroup
One line of a phrase list: the phrase, and what may follow it when it is half of one.
| Field | Type | |
|---|---|---|
phrase | string | The phrase; it ends in ... when it is the first half of a two part one. |
follows | string[] | What may follow it; empty for a phrase said on its own. |
BalloonOptions
How a balloon looks and how long it stays.
| Field | Type | |
|---|---|---|
colour optional | number | undefined | The balloon's colour, 0xrrggbb; the game's white one when left out. It colours the game's own artwork, so the shape, tail and fade are the game's, and the words take whichever of the game's ink or white reads on it. |
seconds optional | number | undefined | How long it stays, in seconds, the second of fading included: 8, as the game's own. |
most optional | number | undefined | The most characters shown, since a line does not wrap: 48. |
level optional | number | undefined | How the client marks it, as a message's own level does: 0, plain. |
image optional | LoadSource | undefined | A picture shown inside the balloon: the game's own emote bubble (ChatBalloon.setEmote, the one a lasting emote or a sticker shows in) in place of the plain one, so the shape, the tail and the paper are still the game's. Anything phantom.aj.content.load takes: a file on this computer, bytes, a base64 data: URL, or { address } for one the client's network reaches. With a picture the text may be left empty, and the balloon's words are not shown while the picture is. Drawn at its own size unless width or height say otherwise. ts await phantom.aj.chat.balloons.show(me, '', { image: '/home/me/wave.png', width: 48 }); |
width optional | number | undefined | The picture's width; with height left out, the height keeps its shape. |
height optional | number | undefined | The picture's height; with width left out, the width keeps its shape. |
Balloon
A balloon up over an animal. Call it to take the balloon down now.
type Balloon = (() => Promise<void>) & {
readonly userId: number;
/** What it shows, cut to `most`. */
readonly text: string;
/** Resolves once the balloon is gone, taken down or faded on its own. */
readonly gone: Promise<void>;
}ChatLine
One line of the chat history panel, as phantom.aj.chat.log.lines() hands it over.
| Field | Type | |
|---|---|---|
from | string | The name the line shows, without its colon: an animal's name, or the account name when the player has asked for those (MySettings.SETTINGS_USERNAME_BADGE). Empty for a line with no name, such as one written by phantom.aj.chat.log.notice. |
account | string | The account the name links to, which the client puts in the link a room line is wrapped in (event:<userName>) and opens the buddy card for when it is clicked. Empty for a line whose name is not a link, which is every line the client did not write as somebody speaking in the room. |
to | string | Who it was said to, for a line written as one person to another; empty otherwise. |
text | string | What was said, with the markup taken out and its entities read. |
markup | string | The line as the field holds it, markup and all. |
NoticeStyle
How a line of Phantom's own is written: a colour, a name in front of it, and the weight.
| Field | Type | |
|---|---|---|
colour optional | number | undefined | The whole line's colour, as 0xrrggbb. Left out, the panel's own. |
from optional | string | undefined | A name to write in front of it, as the client writes a speaker's; none by default. |
bold optional | boolean | undefined | Whether the name is written in bold, which it is by default when there is one. |
italic optional | boolean | undefined | Whether the words are written in italics. |
ChatHold
Something kept on the client until the handle is called, which puts back what was there.
type ChatHold = () => Promise<void>LogScroll
Where the chat box is scrolled to, counted from 1 as Flash counts.
| Field | Type | |
|---|---|---|
line | number | The line at the top. |
last | number | The furthest down it can go; equal to line at the newest line. |
LoggedLine
A line written into the chat box, as log.onLine hears it.
| Field | Type | |
|---|---|---|
kind | "room" | "named" | room for a line written as somebody speaking (addMessage), named for a plain one. |
from | string | The name it is written under. |
shown | string | The name the panel shows: the moderated one where the client has it. |
to | string | Who it was written to, for a named line addressed to somebody; empty otherwise. |
text | string |
PredictiveText
The chat bar's approved words typist (ChatHistory._predictiveTextManager).
| Field | Type | |
|---|---|---|
useType | PredictiveUseType | |
suggestions | number | How many completions it has for the word being typed, at most three. |
suggestionsShown | boolean | |
specialCharsShown | boolean | |
dictionaryLoaded | boolean | Whether the shared word list has arrived; nothing is predicted or underlined before. |
dictionaryLanguage | number | null | The language the list is for, in LocalizationManager's numbering. |
freeChat | boolean | Free chat: the typist then does nothing at all. |
PredictiveUseType
Which part of the approved word list a typist offers and checks against.
type PredictiveUseType = 'chat' | 'eCard' | 'playerWall'ChatShortcutOptions
How shortcuts changes what the player sends.
| Field | Type | |
|---|---|---|
shortcuts optional | Record<string, string> | undefined | Words and what they become, without regard to case: { brb: 'be right back' }. |
blocked optional | readonly (string | RegExp)[] | undefined | Messages not sent at all: holding one of these strings (any case) or matching a pattern. |
onBlocked optional | ((text: string) => void) | undefined | Told of each message kept back. |
ChatBoxOptions
| Field | Type | |
|---|---|---|
style optional | ChatBoxStyle | undefined | |
maxLength optional | number | undefined | At most this many characters: the client's own limit by default. |
focus optional | boolean | undefined | Take the keyboard as the box appears: true by default. |
ChatBoxStyle
How Phantom's own chat box looks.
| Field | Type | |
|---|---|---|
background optional | number | undefined | |
border optional | number | undefined | |
text optional | number | undefined | |
placeholderText optional | string | undefined | |
font optional | string | undefined | |
size optional | number | undefined | |
cornerRadius optional | number | undefined | |
button optional | number | undefined | |
buttonHover optional | number | undefined | |
buttonText optional | number | undefined | |
buttonLabel optional | string | undefined |
ChatBox
Phantom's chat box, standing in for the client's. Call it to put the client's back.
type ChatBox = (() => Promise<void>) & {
/** The overlay input it types into. */
readonly input: InputNode;
/** Sends what is typed, as Enter does, and resolves with what the room heard. */
send(): Promise<ChatMessage | null>;
}InputNode
type InputNode = OverlayNode & {
update(changes: InputOptions): Promise<void>;
/** Its text, as last heard from Flash or set. */
value(): string;
setValue(value: string): Promise<void>;
/** Takes the keyboard, so typing goes to it and not to the game. */
focus(): Promise<void>;
/** Hears its text change as typed, or Enter (Ctrl+Enter when multiline) pressed. */
on(event: 'change' | 'submit', listener: (value: string) => void): () => Promise<void>;
on(event: 'focus' | 'blur', listener: () => void): () => Promise<void>;
}OverlayOptions
A node, as scripts describe it. Colours may be numbers; the anchor may be any place.
| Field | Type | |
|---|---|---|
parent optional | OverlayNode | null | undefined | The group or panel it is drawn in. |
host optional | OverlayPlaceOptions | null | undefined | A container of the client's it is drawn in (see FlashOverlay.attach). |
replaces optional | OverlayPlaceOptions | null | undefined | A display object of the client's it stands in for (see FlashOverlay.replace). |
layer optional | OverlayLayer | null | undefined | Where a node drawn in the overlay itself (no parent, host or replaces) goes: above everything, top, by default; or room, inside the game's room just under its chat balloons. A mark over an animal belongs in the room: it stays over the animals and the scenery in front of them, but never covers what anybody says, the HUD, a popup or the World Map. It is placed and sized just as it would be on top, so an anchor is followed the same way. A node in a group goes where its group does, so give the group the layer. Where the game has no room to draw in, and with a loader from before roomLayer (overlay.can('roomLayer')), it is drawn on top. ts const view = phantom.flash.use('avatar.AvatarManager').playerAvatarWorldView; const star = await phantom.flash.overlay.text('★', { layer: 'room', anchor: { place: view, y: -90 }, centered: true, }); |
x optional | number | undefined | |
y optional | number | undefined | |
anchor optional | OverlayAnchorOptions | null | undefined | |
align optional | OverlayAlign | null | undefined | Where it sits in the box it is drawn in: the stage, the group or panel it is in, or the client object it replaces. x and y are then an offset from that point. Not with anchor. |
drag optional | boolean | OverlayDrag | null | undefined | Moved by the player with the mouse: true, or the rules it moves by. on('move') hears it. |
visible optional | boolean | undefined | |
alpha optional | number | undefined | |
rotation optional | number | undefined | |
scale optional | number | undefined | |
centered optional | boolean | undefined | |
fill optional | OverlayColor | null | undefined | |
stroke optional | number | { color: number; alpha?: number | undefined; width?: number | undefined; } | null | undefined | |
width optional | number | undefined | |
height optional | number | undefined | |
cornerRadius optional | number | undefined | |
radius optional | number | undefined | |
toX optional | number | undefined | |
toY optional | number | undefined | |
text optional | string | undefined | |
rich optional | string | TextSpan[] | null | undefined | Rich text: spans, or markup (parseMarkup), in place of text. |
font optional | Partial<OverlayFont> | undefined | |
background optional | OverlayColor | null | undefined | |
padding optional | number | undefined | |
outline optional | number | null | undefined | |
wrapWidth optional | number | undefined | text: wrap at this width, over as many lines as it takes; one line, however long, when left out. |
url optional | string | undefined | |
hand optional | boolean | undefined |
InputOptions
type InputOptions = OverlayOptions & {
value?: string;
placeholder?: string;
/** At most this many characters; 0 for no limit. */
maxLength?: number;
/** The characters that may be typed, as Flash's `TextField.restrict` reads them. */
restrict?: string | null;
/** Several lines: Enter starts a new line, and Ctrl+Enter submits. */
multiline?: boolean;
disabled?: boolean;
}OverlayBounds
Where a node is, and how big, as Flash has it now.
| Field | Type | |
|---|---|---|
x | number | Its box in the coordinates of whatever it is drawn in, children and all. |
y | number | |
width | number | |
height | number | |
shown | boolean | Whether it is on the stage and visible, with every parent visible too. |
Position
| Field | Type | |
|---|---|---|
x | number | |
y | number |
ChatWindowOptions
| Field | Type | |
|---|---|---|
style optional | ChatWindowStyle | undefined | |
title optional | string | undefined | |
x optional | number | undefined | |
y optional | number | undefined | |
width optional | number | undefined | |
height optional | number | undefined | |
onMove optional | ((position: { x: number; y: number; }) => void) | undefined | |
onResize optional | ((size: { width: number; height: number; }) => void) | undefined | |
maxRows optional | number | undefined | Rows kept: 200 by default. |
onNameClick optional | ((player: { userId: number; name: string; }) => void) | undefined | Told when a name is clicked. By default that player's animal glows for a moment. |
ChatWindowStyle
| Field | Type | |
|---|---|---|
background optional | number | undefined | |
backgroundAlpha optional | number | undefined | |
border optional | number | undefined | |
titleBar optional | number | undefined | |
titleText optional | number | undefined | |
text optional | number | undefined | |
size optional | number | undefined | |
font optional | string | undefined | |
nameColors optional | readonly number[] | undefined | Colours names are given from, the same player always the same one. |
ChatWindow
A window of the room's chat. Call it to close it.
type ChatWindow = (() => Promise<void>) & {
readonly panel: PanelNode;
/** Adds a line of the plugin's own, as markup (`parseMarkup`). */
note(markup: string): Promise<void>;
}PanelNode
type PanelNode = OverlayNode & {
update(changes: Omit<PanelOptions, 'onMove' | 'onResize'>): Promise<void>;
on(event: 'move', listener: (position: Position) => void): () => Promise<void>;
on(
event: 'resize',
listener: (size: { width: number; height: number }) => void
): () => Promise<void>;
}