SpelunkyFan wiki

The Teleporter's old target

Verified against the spelunky.ai port v0.1.11 on .

The Teleporter's old target is a quirk of Spelunky Classic in which a Teleporter used while a gun's shot waits takes the player back to an old spot.

The Teleporter picks a spot 4 to 8 blocks away, up or ahead, and moves the player there. It has no wait of its own between uses, but its sideways use checks the wait the guns and the Bow set between shots, and skips picking a spot while one runs. It moves the player all the same, to whatever spot was picked last.

What happens

#

The player teleports straight up and falls back. He fires a Shotgun, swaps it for the Teleporter and uses it facing left, before the Shotgun's wait is over: it takes him straight up again, to the spot its last use picked. Used once the wait is over, it takes him five blocks left [1].

The Teleporter goes back to its last spot. The player teleports straight up and falls back. He fires a shotgun, swaps it for the teleporter and uses it facing left, before the shotgun's wait is over: it takes him straight up again, to the spot its last use picked. Used once the wait is over, it takes him five blocks left.

Why

#

The Teleporter's spot is tx and ty. With up held it always picks one; facing left or right, only and firing == 0:

                if (kUp)
                {
                    tx = x;
                    ty = y - (16*rand(4,8));
                    while (ty < 16) { ty += 16; }   
                }
                else if (not scrPlayerIsDucking())
                {
                    if (facing == LEFT and firing == 0)
                    {
                        tx = x - (16*rand(4,8));
                        ty = y;
                        if (tx < 8) tx = 8;
                    }
                    else if (facing == RIGHT and firing == 0)
                    {
                        tx = x + (16*rand(4,8));
                        ty = y;
                        if (tx > room_width - 8) tx = room_width - 8;
                    }
                }
scripts/scrUseItem.gml:427-447, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).

firing is the wait a shot starts, counted down by the player's step [2]: 20 steps for the Pistol, the Web Cannon and the Sceptre, 40 for the Shotgun, 10 for the Bow. The Teleporter starts none, so it only matters after a swap. Then the use moves the player to tx and ty as they were [3]. They're the player's own variables, which two scripts besides write in his scope: checking whether a point is in a shop, and which room it's in [4] [5] [6]. His step asks them about where he is while he holds an unpaid ware or a readied bomb arrow, and when he presses the pay key [7] [8] [9]. So the spot is the Teleporter's last, or where he last held an unpaid ware, say. If nothing has set them on the level, the use reads an unset tx, an error that stops the game [10].

Reproducing it

#

Fire a gun, put it down, pick up a Teleporter and use it facing left or right, not crouching, before the gun's wait is over. The replay of the clip's staged scene, on a custom level, uses the Teleporter with up held, which moves the player 4 blocks up. He fires a Shotgun, swaps it for the Teleporter and uses it facing left with 6 steps of the wait to go: it moves him up there again. Used once the wait is over, it moves him 5 blocks left [11]. The same scene without the first use stops on the second, on the port and the original alike, and isn't kept as a replay, as a run that stops on an error has no fingerprint.

In the port

#

The spelunky.ai port reproduces it exactly, the error included: it's in docs/quirks.md's list of the 1.1 source's bugs [10], and the oracle's fingerprint of the replay pins every move. No option turns it off.

FAQ

#
Why does the Teleporter take you back where you were?

A sideways use of the Teleporter only picks a new spot once a gun's wait between shots is over. Used within it, as after swapping a Shotgun for it, it takes the player to the last spot picked, which is often where he last teleported to.

Can the Teleporter crash Spelunky Classic?

Yes. Used sideways within a gun's wait before anything on the level has set its spot, it reads a variable that has never been set, an error that stops the game.

Does teleporting straight up have the same problem?

No. A use with up held picks a new spot every time, wait or no wait.

See also

#

References

#
  1. Clip quirks/teleporter-old-target
  2. objects/oPlayer1/step.gml:175
  3. scripts/scrUseItem.gml:448-460
  4. scripts/isInShop.gml:7-8
  5. scripts/scrGetRoomX.gml:24
  6. scripts/scrGetRoomY.gml:24
  7. objects/oPlayer1/step.gml:43
  8. objects/oPlayer1/step.gml:543-545
  9. objects/oPlayer1/step.gml:1359-1361
  10. Quirk 1 (docs/quirks.md)
  11. Replay fidelity/replays/weapon-teleporter-old-target.txt

Source code

#