Sorted this now, most up to date code for menus is:
`menu system
`Paul Drage
`24/2/2008, 22:15
`this declares obj taken as a yes or no array
Dim __ObjTaken(0) as boolean ` Global array
Set display mode 800,600,0
set text font "Verdana"
do
doMakebutton(200,100,"Start Game",1)
doMakebutton(200,150,"Load Game",2)
doMakebutton(200,200,"Exit",3)
loop
function New_game()
`clear screen
CLS
print "this is a new game"
wait key
CLS
endfunction
function Load_game()
`clear screen
CLS
print "this is a load game page"
print "Press the any key to continue"
wait key
CLS
endfunction
function doMakebutton(buttonx,buttony,txtvalue$,ButtonAction)
`find out how long and high the text will be
`so can make a nice sized button
`here we also find the next available object number
length = Text width(txtvalue$) + 25
height = Text height(txtvalue$) + 15
buttontextoffset1# = 12.5
buttontextoffset2# = 7.5
`creates a blank bitmap off the screen
create bitmap 1, length+2, height+2
ink RGB(192,192,192),0
`paint a box off screen on the new bitmap, grab it as an image
`then set the curr bitmap back to 0, paste image to screen and then
`clear up by deleting the current bitmap
box 0,0,length,height,200,0,0,200
get image 1,0,0,length,height
set current bitmap 0
`put that bitmap on the screen where we want it
paste image 1,buttonx,buttony
`make a different version of this box
create bitmap 2, length+2, height+2
ink RGB(255,255,255),0
box 0,0,length,height,238,221,17,238
get image 2,0,0,length,height
set current bitmap 0
`print text for the button from values assigned to function
Text buttonx+buttontextoffset1#, buttony+buttontextoffset2#, txtvalue$
if mousex()>buttonx and mousex()<buttonx+length
if mousey()>buttony-height and mousey()<buttony+height
paste image 2,buttonx,buttony
Text buttonx+buttontextoffset1#, buttony+buttontextoffset2#, txtvalue$
if mouseclick()
SELECT ButtonAction
CASE 1 : gosub New_game : ENDCASE
CASE 2 : gosub Load_game : ENDCASE
CASE 3 : end : ENDCASE
ENDSELECT
endif
endif
endif
endfunction