Here is a preliminary simulation of this in Spatterlight (contains mild spoilers for The Count and Strange Odyssey). The delay is probably a little too long:
As far as I can tell, this effect is a glitch caused by programming tricks, or rather by hacks that work around the limitations of the game engine.
The game engine has a special variable holding a room number, referred to by ScottKit as “backup location”. This is commonly used to dynamically teleport the player back-and-forth between two locations, as illustrated by the hexagonal room in Strange Odyssey. There is no way for the game to set the backup location variable to a particular room directly. Instead you have to temporarily move the player to the room you want to set it to, and issue a
swap_room instruction, which will set it to the current location number.
From the ScottFree documentation:
swap_room – Swaps the player between the current location and a backup location. The backup location is initially undefined, so the first use of this should be immediately followed by a
goto to a known room; the next use will bring the player back where it was first used.
This is exactly what happens in Strange Odyssey: At the very start, the player is temporarily moved to the hexagonal room, the backup location is set, and the player is returned to the starting location. Later, when alien machine is set to teleport the player to a new location (i.e. when the player touches the piece of plastic), the player is again temporarily moved to this new location in order to set the variable, and then moved back.
Things are a little more interesting in The Count: when the player falls asleep, some crucial items will be removed from the game unless they are in a safe place, i.e. in a locked closet. The way the game checks this is by temporarily moving the player to the closet and then running a number of tests to see if any of the relevant items are
here, in the current location. If not, they will be moved there, and the message “I’ve a hunch I’ve been robbed!” will be printed at the end.
Doing it this way may seem strange at first. Why not just check if those items are in the closet directly instead? Well, if the closet door isn’t locked, then the player is moved to room 0 (the “out of play room”) instead of the closet, and all the code that checked if the items were in the closet, and moved them there if not, can now be reused. The exact same code will now check if they are in room 0 instead of the closet, and if any of the items are not in room 0 already, the same code will now move them there instead.