Skip to content

Instantly share code, notes, and snippets.

@ndunks
Last active October 28, 2022 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndunks/863e59f93e4d3d5c8ddbff703b14c9b9 to your computer and use it in GitHub Desktop.
Save ndunks/863e59f93e4d3d5c8ddbff703b14c9b9 to your computer and use it in GitHub Desktop.

Usefull function

// Your player object
let me = game.getMyPlayer()

// Your player id
let id = Object.entries(game.players).filter( ([id,o]) => o.name == game.getMyPlayer().name)[0][0]

Send Actions

game.engine.sendAction({...})

Only Tail

outfit = {
    "skin": null,
    "hair": null,
    "facial_hair": null,
    "top": null,
    "bottom": null,
    "shoes": null,
    "hat": null,
    "glasses": null,
    "other": {
        "id": "w1TrLm6BuP5OGsHPRln9",
        "color": "black",
        "name": "animal tails",
        "type": "other",
        "subType": null,
        "style": null,
        "isDefault": true,
        "previewUrl": "https://cdn.gather.town/storage.googleapis.com/gather-town.appspot.com/wearables/D9sWZ4TdR7rm6Prsn9W_X",
        "startDate": null,
        "endDate": null,
        "createdAt": "2022-04-01T15:00:00.000Z",
        "updatedAt": "2022-09-27T18:09:13.117Z",
        "parts": [
            {
                "layerId": "other back",
                "spritesheetId": "34wOTOTmZwrSSdJiEz9a"
            },
            {
                "layerId": "other front",
                "spritesheetId": "WFeUuPCcj9VzwdjMhlVn"
            }
        ]
    },
    "costume": null,
    "mobility": null,
    "jacket": null
}
// Use it
game.setOutfitString(JSON.stringify(outfit), id)

Name

{
    "$case": "setName",
    "setName": {
        "name": "Hero"
    }
}

Emoji Status

{
    "$case": "setEmojiStatus",
    "setEmojiStatus": {
        "emojiStatus": "😱"
    }
}
game.engine.sendAction({
    "$case": "setAway",
    "setAway": {
        "away": false,
        targetId: game.engine.clientUid,
    }
})
sendAction(e, t=!1) {
                var n;
                return null === (n = this.engine) || void 0 === n ? void 0 : n.sendAction(e, !1, t)
            }
            sendAction2(e, t, n=!1) {
                var r;
                return null === (r = this.engine) || void 0 === r ? void 0 : r.sendAction({
                    $case: e,
                    [e]: t
                }, !1, n)
            }
            enter(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.queueOrExecuteEnter(e, t, n)
            }
            exit() {
                var e;
                null === (e = this.engine) || void 0 === e || e.exit()
            }
            respawn(e) {
                return this.sendAction({
                    $case: "respawn",
                    respawn: {}
                }, e)
            }
            spawn(e) {
                this.sendAction({
                    $case: "spawn",
                    spawn: {
                        spawnToken: e
                    }
                })
            }
            move(e, t=!1, n) {
                var r;
                const o = this.inputId++;
                null === (r = this.onInput) || void 0 === r || r.call(this, e, t, o),
                this.sendAction({
                    $case: "move",
                    move: {
                        dir: e,
                        stopped: t,
                        inputId: o,
                        targetId: n
                    }
                })
            }
            playSound(e, t, n) {
                this.sendAction({
                    $case: "playSound",
                    playSound: {
                        src: e,
                        volume: t,
                        targetId: n
                    }
                })
            }
            stopSound(e, t) {
                this.sendAction({
                    $case: "stopSound",
                    stopSound: {
                        src: e,
                        targetId: t
                    }
                })
            }
            ghost(e, t) {
                this.sendAction({
                    $case: "ghost",
                    ghost: {
                        ghost: e,
                        targetId: t
                    }
                })
            }
            enterWhisper(e, t) {
                this.sendAction({
                    $case: "enterWhisper",
                    enterWhisper: {
                        recipientId: e,
                        dir: t
                    }
                })
            }
            leaveWhisper() {
                this.sendAction({
                    $case: "leaveWhisper",
                    leaveWhisper: {}
                })
            }
            teleport(e, t, n, r, o=l.SpriteDirection.Down) {
                this.sendAction({
                    $case: "teleport",
                    teleport: {
                        mapId: e,
                        x: t,
                        y: n,
                        direction: o,
                        targetId: r
                    }
                })
            }
            ring(e) {
                this.sendAction({
                    $case: "ring",
                    ring: {
                        user: e
                    }
                })
            }
            block(e, t) {
                this.sendAction({
                    $case: "block",
                    block: {
                        blockedUserId: e,
                        blocked: t
                    }
                })
            }
            pointer(e, t, n) {
                this.sendAction({
                    $case: "setImagePointer",
                    setImagePointer: {
                        objectId: e,
                        x: t,
                        y: n
                    }
                })
            }
            wave(e, t=!1) {
                this.sendAction({
                    $case: "wave",
                    wave: {
                        user: e,
                        isReply: t
                    }
                })
            }
            screenPointer(e, t, n) {
                this.sendAction({
                    $case: "setScreenPointer",
                    setScreenPointer: {
                        screenId: e,
                        x: t,
                        y: n
                    }
                })
            }
            setActivelySpeaking(e) {
                this.sendAction({
                    $case: "activelySpeaking",
                    activelySpeaking: {
                        activelySpeaking: e
                    }
                })
            }
            requestMute(e, t) {
                this.sendAction({
                    $case: "requestMute",
                    requestMute: {
                        target: e,
                        video: t
                    }
                })
            }
            setEmote(e, t, n) {
                this.sendAction({
                    $case: "setEmoteV2",
                    setEmoteV2: {
                        emote: e,
                        count: n,
                        targetId: t
                    }
                })
            }
            setWorkCondition(e, t) {
                this.sendAction({
                    $case: "setWorkCondition",
                    setWorkCondition: {
                        workCondition: e,
                        targetId: t
                    }
                })
            }
            setAway(e, t) {
                this.sendAction({
                    $case: "setAway",
                    setAway: {
                        away: e,
                        targetId: t
                    }
                })
            }
            setName(e, t) {
                this.sendAction({
                    $case: "setName",
                    setName: {
                        name: e,
                        targetId: t
                    }
                })
            }
            setIsMobile(e) {
                this.sendAction({
                    $case: "setIsMobile",
                    setIsMobile: {
                        isMobile: e
                    }
                })
            }
            setTextStatus(e, t) {
                this.sendAction({
                    $case: "setTextStatus",
                    setTextStatus: {
                        textStatus: e,
                        targetId: t
                    }
                })
            }
            setEmojiStatus(e, t) {
                this.sendAction({
                    $case: "setEmojiStatus",
                    setEmojiStatus: {
                        emojiStatus: e,
                        targetId: t
                    }
                })
            }
            setPronouns(e, t) {
                this.sendAction({
                    $case: "setPronouns",
                    setPronouns: {
                        pronouns: e,
                        targetId: t
                    }
                })
            }
            setTimezone(e, t) {
                this.sendAction({
                    $case: "setTimezone",
                    setTimezone: {
                        timezone: e,
                        targetId: t
                    }
                })
            }
            setTitle(e, t) {
                this.sendAction({
                    $case: "setTitle",
                    setTitle: {
                        title: e,
                        targetId: t
                    }
                })
            }
            setPhone(e, t) {
                this.sendAction({
                    $case: "setPhone",
                    setPhone: {
                        phone: e,
                        targetId: t
                    }
                })
            }
            setDescription(e, t) {
                this.sendAction({
                    $case: "setDescription",
                    setDescription: {
                        description: e,
                        targetId: t
                    }
                })
            }
            setProfileImageUrl(e, t) {
                this.sendAction({
                    $case: "setProfileImageUrl",
                    setProfileImageUrl: {
                        profileImageUrl: e,
                        targetId: t
                    }
                })
            }
            setPersonalImageUrl(e, t) {
                this.sendAction({
                    $case: "setPersonalImageUrl",
                    setPersonalImageUrl: {
                        personalImageUrl: e,
                        targetId: t
                    }
                })
            }
            setAffiliation(e, t) {
                this.sendAction({
                    $case: "setAffiliation",
                    setAffiliation: {
                        affiliation: e,
                        targetId: t
                    }
                })
            }
            setStatus(e, t) {
                this.sendAction({
                    $case: "setStatus",
                    setStatus: {
                        status: e,
                        targetId: t
                    }
                })
            }
            setEventStatus(e, t) {
                this.sendAction({
                    $case: "setEventStatus",
                    setEventStatus: {
                        eventStatus: e,
                        targetId: t
                    }
                })
            }
            setInConversation(e, t) {
                this.sendAction({
                    $case: "setInConversation",
                    setInConversation: {
                        inConversation: e,
                        targetId: t
                    }
                })
            }
            setCurrentDesk(e, t) {
                this.sendAction({
                    $case: "setCurrentDesk",
                    setCurrentDesk: {
                        currentDesk: e,
                        targetId: t
                    }
                })
            }
            setCurrentArea(e, t) {
                this.sendAction({
                    $case: "setCurrentArea",
                    setCurrentArea: {
                        currentArea: e,
                        targetId: t
                    }
                })
            }
            setOutfitString(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "setOutfitString",
                    setOutfitString: {
                        outfitString: e,
                        targetId: t
                    }
                })
            }
            clearItem(e) {
                var t;
                null === (t = this.engine) || void 0 === t || t.sendAction({
                    $case: "setItemString",
                    setItemString: {
                        itemString: "",
                        targetId: e
                    }
                })
            }
            setItem(e, t, n) {
                var r;
                const o = e ? JSON.stringify({
                    id: e,
                    image: t
                }) : "";
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "setItemString",
                    setItemString: {
                        itemString: o,
                        targetId: n
                    }
                })
            }
            triggerItem(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "triggerItem",
                    triggerItem: {
                        closestObject: e,
                        closestObjectTemplate: t
                    }
                })
            }
            setSpotlight(e, t) {
                this.sendAction({
                    $case: "spotlight",
                    spotlight: {
                        spotlightedUser: e,
                        isSpotlighted: t
                    }
                })
            }
            banPlayer(e) {
                this.sendAction({
                    $case: "ban",
                    ban: {
                        user: e
                    }
                })
            }
            kickPlayer(e) {
                this.sendAction({
                    $case: "kick",
                    kick: {
                        user: e
                    }
                })
            }
            interact(e, t, n) {
                this.sendAction({
                    $case: "interact",
                    interact: {
                        objId: e,
                        mapId: t,
                        dataJson: JSON.stringify(n)
                    }
                })
            }
            chat(e, t, n, r) {
                this.sendAction({
                    $case: "chat",
                    chat: Object.assign({
                        chatRecipient: e,
                        localPlayerIds: t,
                        mapId: n
                    }, r)
                })
            }
            chatMessageUpdated(e) {
                this.sendAction({
                    $case: "chatMessageUpdated",
                    chatMessageUpdated: e
                })
            }
            registerCommand(e) {
                return this.sendAction({
                    $case: "registerCommand",
                    registerCommand: {
                        command: e
                    }
                }, !0)
            }
            sendCommand(e, t) {
                this.sendAction({
                    $case: "sendCommand",
                    sendCommand: {
                        command: e,
                        targetId: t
                    }
                })
            }
            notify(e) {
                this.sendAction({
                    $case: "notify",
                    notify: {
                        notification: e
                    }
                })
            }
            shootConfetti(e) {
                var t;
                null === (t = this.engine) || void 0 === t || t.sendAction({
                    $case: "shootConfetti",
                    shootConfetti: {
                        targetId: e
                    }
                })
            }
            setVehicleId(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "setVehicleId",
                    setVehicleId: {
                        vehicleId: e,
                        targetId: n,
                        action: t
                    }
                })
            }
            setSpeedModifier(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "setSpeedModifier",
                    setSpeedModifier: {
                        speedModifier: e,
                        targetId: t
                    }
                })
            }
            setIsAlone(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "setIsAlone",
                    setIsAlone: {
                        isAlone: e,
                        targetId: t
                    }
                })
            }
            setFocusModeEndTime(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "setFocusModeEndTime",
                    setFocusModeEndTime: {
                        focusModeEndTime: e,
                        targetId: t
                    }
                })
            }
            setFollowTarget(e) {
                var t;
                null === (t = this.engine) || void 0 === t || t.sendAction({
                    $case: "setFollowTarget",
                    setFollowTarget: {
                        followTarget: e
                    }
                })
            }
            enterPortal(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "enterPortal",
                    enterPortal: {
                        targetUrl: e,
                        targetId: t,
                        bypassPrompt: n
                    }
                })
            }
            setMapDimensions(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "mapSetDimensions",
                    mapSetDimensions: {
                        mapId: e,
                        width: t,
                        height: n
                    }
                })
            }
            setMapCollisions(e, t, n, r, o, i) {
                var a;
                null === (a = this.engine) || void 0 === a || a.sendAction({
                    $case: "mapSetCollisions",
                    mapSetCollisions: {
                        mapId: e,
                        x: t,
                        y: n,
                        w: r,
                        h: o,
                        mask: i
                    }
                })
            }
            setMapBackgroundImagePath(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetBackgroundImagePath",
                    mapSetBackgroundImagePath: {
                        mapId: e,
                        backgroundImagePath: t
                    }
                })
            }
            setMapForegroundImagePath(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetForegroundImagePath",
                    mapSetForegroundImagePath: {
                        mapId: e,
                        foregroundImagePath: t
                    }
                })
            }
            setMapSprites(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetSprites",
                    mapSetSprites: {
                        mapId: e,
                        sprites: t
                    }
                })
            }
            setMapSpawns(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetSpawns",
                    mapSetSpawns: {
                        mapId: e,
                        spawns: t
                    }
                })
            }
            setMapNooks(e, t, n=!1, r=!1) {
                return this.sendAction({
                    $case: "mapSetNooks",
                    mapSetNooks: {
                        mapId: e,
                        nooks: t,
                        overwrite: n
                    }
                }, r)
            }
            setMapPortals(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetPortals",
                    mapSetPortals: {
                        mapId: e,
                        portals: t
                    }
                })
            }
            requestToJoinNook(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "requestToJoinNook",
                    requestToJoinNook: {
                        nookId: e,
                        mapId: t,
                        name: n
                    }
                })
            }
            updateNookPermission(e, t, n) {
                var r;
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "updateNookPermission",
                    updateNookPermission: {
                        playerId: e,
                        nookId: t,
                        granted: n
                    }
                })
            }
            setMapAnnouncer(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetAnnouncer",
                    mapSetAnnouncer: {
                        mapId: e,
                        announcer: t
                    }
                })
            }
            setMapObjects(e, t, n) {
                var r;
                const o = {};
                Object.keys(t).reduce(((e,n)=>{
                    const r = parseInt(n);
                    return e[r] = (0,
                    u.convertMapObjectToWireObject)(t[r]),
                    e
                }
                ), o),
                null === (r = this.engine) || void 0 === r || r.sendAction({
                    $case: "mapSetObjects",
                    mapSetObjects: {
                        mapId: e,
                        objects: o,
                        updatesAreOverwrites: n
                    }
                })
            }
            moveMapObject(e, t, n, r, o="Linear") {
                var i;
                null === (i = this.engine) || void 0 === i || i.sendAction({
                    $case: "mapMoveObject",
                    mapMoveObject: {
                        mapId: e,
                        objectId: t,
                        targetX: n.x,
                        targetY: n.y,
                        targetXOffset: n.xOffset || 0,
                        targetYOffset: n.yOffset || 0,
                        duration: r,
                        easing: o
                    }
                })
            }
            fxShakeObject(e, t, n=.1, r=1e3, o) {
                var i;
                null === (i = this.engine) || void 0 === i || i.sendAction({
                    $case: "fxShakeObject",
                    fxShakeObject: {
                        mapId: e,
                        targetId: t,
                        intensity: n,
                        durationMs: r,
                        mode: o
                    }
                })
            }
            fxShakeCamera(e, t, n=.1, r=1e3) {
                var o;
                null === (o = this.engine) || void 0 === o || o.sendAction({
                    $case: "fxShakeCamera",
                    fxShakeCamera: {
                        intensity: n,
                        durationMs: r,
                        mapId: e,
                        targetUserId: t
                    }
                })
            }
            setMapName(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetName",
                    mapSetName: {
                        mapId: e,
                        name: t
                    }
                })
            }
            setMapMuteOnEntry(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetMuteOnEntry",
                    mapSetMuteOnEntry: {
                        mapId: e,
                        muteOnEntry: t
                    }
                })
            }
            setMapUseDrawnBG(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetUseDrawnBG",
                    mapSetUseDrawnBG: {
                        mapId: e,
                        useDrawnBG: t
                    }
                })
            }
            setMapWalls(e, t) {
                var n;
                const r = this.partialMaps[e];
                if (!r.dimensions)
                    return;
                const o = (0,
                u.wallFloorConvertToDB)(t, r.dimensions);
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetWalls",
                    mapSetWalls: {
                        mapId: e,
                        walls: o
                    }
                })
            }
            setMapFloors(e, t) {
                var n;
                const r = this.partialMaps[e];
                if (!r.dimensions)
                    return;
                const o = (0,
                u.wallFloorConvertToDB)(t, r.dimensions);
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetFloors",
                    mapSetFloors: {
                        mapId: e,
                        floors: o
                    }
                })
            }
            setMapAreas(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetAreas",
                    mapSetAreas: {
                        mapId: e,
                        areas: t
                    }
                })
            }
            setMapMiniMapImagePath(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetMiniMapImagePath",
                    mapSetMiniMapImagePath: {
                        mapId: e,
                        miniMapImagePath: t
                    }
                })
            }
            setMapEnabledChats(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetEnabledChats",
                    mapSetEnabledChats: {
                        mapId: e,
                        enabledChats: t
                    }
                })
            }
            setMapDescription(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetDescription",
                    mapSetDescription: {
                        mapId: e,
                        description: t
                    }
                })
            }
            setMapDecoration(e, t) {
                var n;
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetDecoration",
                    mapSetDecoration: {
                        mapId: e,
                        decoration: t
                    }
                })
            }
            setMapTutorialTasks(e, t) {
                var n;
                const r = (0,
                u.convertTutorialTasksToWireTutorialTasks)(t);
                null === (n = this.engine) || void 0 === n || n.sendAction({
                    $case: "mapSetTutorialTasks",
                    mapSetTutorialTasks: {
                        mapId: e,
                        tutorialTasks: r
                    }
                })
            }
            setImpassable(e, t, n, r=!0) {
                this.sendAction({
                    $case: "setImpassable",
                    setImpassable: {
                        mapId: e,
                        x: t,
                        y: n,
                        impassable: r
                    }
                })
            }

Hacky Script Override

// this.ws.onopen = function() {
  //HACK
  window.app = n;
  window.TEXT="Your Name ";
  window.TEXT_DELAY = 700;
  let TEXT_COUNTER = 0;
  const TEXT_EVENT={
      "$case": "setName",
      "setName": {
          "name": TEXT
      }
  };

  function TEXT_RUNNER(){
  TEXT = TEXT.slice(1) + TEXT[0];
  TEXT_EVENT.setName.name = TEXT
  app.sendAction(TEXT_EVENT);
  setTimeout(TEXT_RUNNER, TEXT_DELAY);
  }
  window.TEXT_RUNNER = TEXT_RUNNER;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment