|Note - this entity is a modification for The Underworld. Visit the new Mods Portal for more mods, mods on the wiki are no longer maintained. You can put it in-game by visiting the Debug Mod Control Panel in the debug rooms and browse to this mod or copy/paste the JSON below into the program window.|
This entity is intended for example purposes to demonstrate an object that can check its location and the player's location. It could also be useful for finding the RoomID of various in-game rooms.
Entity JSON Code
LUA Source Code
function description() -- 'this' is a predefined keyword that refers to this entity (in this case, -- the GPS) location = this.getLocation(); -- All text will be added to 'descriptionText' string, and returned. descriptionText = "The GPS blinks, displaying black text on a lime green " .. "LCD screen: '"; -- Check if GPS item is in inventory or in world if location == null then -- Item's Location is null, which means GPS is in player inventory. -- Because of this, this script must check player location instead of -- item location. location = Player.getInstance().getLocation(); descriptionText = descriptionText .. "In player's inventory @ "; else descriptionText = descriptionText .. "In the world @ "; end -- Add RoomID & Map Name to description text descriptionText = descriptionText .. "RoomID " .. location.roomID .. ", Map " .. location.getMap().getName() .. "'"; -- Return text to be displayed by game return descriptionText; end