Got home from work and my washing machine flooded my kitchen. *facepalm* Lost some time sorting that out but here is a very quick menu implementation to the original example. It is nothing special but hopefully has some value, lol.
rem Setup the window
set display mode 1024, 768, 32
set window on
set window size 1040, 806
set window title "Pause menu"
rem Take over control of rendering
sync on
sync rate 60
rem Setup the font
set text font "Arial"
set text size 30
set text to bold
rem Show a loading message
sync
center text screen width() / 2, screen height() / 2, "LOADING..."
sync
rem Stop escape key from exiting
disable escapeKey
rem Set the default state
global currentState as integer
currentState = 0
rem Handle the escape key being held
global escapeHeld as boolean
escapeHeld = 0
global mouseHeld as boolean
mouseHeld = 0
rem Create a floor
make object plane 1, 100, 100
rotate object 1, 270, 0, 0
rem Create a player
make object box 2, 2, 5, 2
set shadow shading on 2, -1, 20, 1
rem Setup atmosphere
color ambient light 0xffffff
set ambient light 20
color light 0, 0xffdd99
position light 0, 0, 20, -100
rem Start off player and camera
type type_floatXYZ
x as float
y as float
z as float
endType
global cameraAngle as type_floatXYZ
global cameraPosition as type_floatXYZ
global playerAngle as type_floatXYZ
global playerPosition as type_floatXYZ
playerPosition.x = 0
playerPosition.y = 2.5
playerPosition.z = 0
rem Setup the menu options
global dim menuOption(5) as string
menuOption(0) = "Resume"
menuOption(1) = "Red Light"
menuOption(2) = "Green Light"
menuOption(3) = "Blue Light"
menuOption(4) = "Exit"
rem Track when to end the loop
global breakLoop as boolean
rem Hide the mouse in game mode
hide mouse
rem Start the main loop
repeat
rem Check if we're in the game or menu
if (currentState = 0)
updateGame()
else
updateMenu()
endIf
rem Swap between states
if (escapeKey() = 1)
if (escapeHeld = 0)
inc currentState
show mouse
if (currentState = 2)
currentState = 0
hide mouse
endIf
endIf
escapeHeld = 1
else
escapeHeld = 0
endIf
rem Render
sync
rem End the loop when escape is pushed
until (breakLoop = 1)
rem Exit the application
end
rem Function to handle the game updates
function updateGame()
rem Render UI
text 0, 0, "Use the mouse to look around and W / S to move."
text 0, 20, "Press escape to pause."
rem Update the player object
inc playerAngle.y, mouseMoveX()
w = keyState(17)
s = keyState(31)
inc playerPosition.x, sin(playerAngle.y) * (w - s)
inc playerPosition.z, cos(playerAngle.y) * (w - s)
if (playerPosition.x < -48)
playerPosition.x = -48
endIf
if (playerPosition.x > 48)
playerPosition.x = 48
endIf
if (playerPosition.z < -48)
playerPosition.z = -48
endIf
if (playerPosition.z > 48)
playerPosition.z = 48
endIf
rotate object 2, playerAngle.x, playerAngle.y, playerAngle.z
position object 2, playerPosition.x, playerPosition.y, playerPosition.z
rem Update the camera
cameraPosition.x = playerPosition.x + (sin(playerAngle.Y) * -30)
cameraPosition.y = 20
cameraPosition.z = playerPosition.z + (cos(playerAngle.Y) * -30)
position camera curveValue(cameraPosition.x, camera position x(), 15), curveValue(cameraPosition.y, camera position y(), 15), curveValue(cameraPosition.z, camera position z(), 15)
cameraAngle.x = 30
cameraAngle.y = playerAngle.y
rotate camera curveAngle(cameraAngle.x, camera angle x(), 15), curveAngle(cameraAngle.y, camera angle y(), 15), curveAngle(cameraAngle.z, camera angle z(), 15)
rem End the function
endFunction
rem Function to handle the menu updates
function updateMenu()
rem Render the background
color1 = 0x00000000
color2 = 0xcc000000
box 0, 0, 256, 768, color1, color1, color2, color2
box 768, 0, 1024, 768, color2, color2, color1, color1
box 256, 0, 768, 768, color2
rem Loop through and render the menu options
mX = mouseX()
mY = mouseY()
local selected as string
selected = ""
for i = 0 to (array count(menuOption(0)) - 1)
l = 256
t = 240 + (i * 64)
r = 768
b = t + 48
ink 0xffffffff, 0x000000
if (mouseOver(mX, mY, l, t, r, b) = 1)
box l, t, r, b
ink 0xff000000, 0x000000
selected = menuOption(i)
endIf
center text 512, 248 + (i * 64), menuOption(i)
next i
rem Check there is a selected option
if (selected <> "")
rem Check for a mouse click
if (mouseClick() = 1)
rem Check it isn't being held
if (mouseHeld = 0)
rem Respond to the option
select selected
rem Close the menu
case "Resume":
currentState = 0
hide mouse
endCase
rem Set the light to red
case "Red Light":
color light 0, 0xff0000
color ambient light 0xff0000
endCase
rem Set the light to green
case "Green Light":
color light 0, 0x00ff00
color ambient light 0x00ff00
endCase
rem Set the light to blue
case "Blue Light":
color light 0, 0x0000ff
color ambient light 0x0000ff
endCase
rem Exit
case "Exit":
breakLoop = 1
endCase
endSelect
rem Store the click
mouseHeld = 1
endIf
else
rem Store that the mouse was released
mouseHeld = 0
endIf
endIf
rem Update the camera
cameraPosition.x = playerPosition.x + (sin(cameraAngle.Y) * -30)
cameraPosition.y = 20
cameraPosition.z = playerPosition.z + (cos(cameraAngle.Y) * -30)
position camera curveValue(cameraPosition.x, camera position x(), 15), curveValue(cameraPosition.y, camera position y(), 15), curveValue(cameraPosition.z, camera position z(), 15)
cameraAngle.x = 30
cameraAngle.y = cameraAngle.y + 0.5
rotate camera curveAngle(cameraAngle.x, camera angle x(), 15), curveAngle(cameraAngle.y, camera angle y(), 15), curveAngle(cameraAngle.z, camera angle z(), 15)
rem End the function
endFunction
rem Function to check if the mouse is over the specified rectangle
function mouseOver(_mouseX, _mouseY, _left, _top, _right, _bottom)
rem Check if the mouse is over the rectangle
local result as boolean
result = 0
if (_mouseX > _left)
if (_mouseX < _right)
if (_mouseY > _top)
if (_mouseY < _bottom)
result = 1
endIf
endIf
endIf
endIf
rem End the function
endFunction result

Previously TEH_CODERER.