Thanks krisper it stopped crashing.
Now it runs and closes without showing anything.
One step forward.
sync on
sync rate 30
autocam off
set camera range 0.5, 30000
hide mouse
b=0
player_speed#=10 'sets the players speed
'make player
make object sphere 2,2 'sets up basic player
position object 2,0,0,0 'sets up the position of the player by the x,y,z axes
hide object 2 ' hides the player from veiw
SC_SetupObject 2,2,0
` set the directory to media
load object "worldworld.dbo",1
'loads the 3d world and sky in to memory
load object "sky16sky16.x",3
set object texture 3,2,1
set object light 3,0
scale object 3,140000,140000,140000
position object 3,0,200,1000
sc_setupComplexObject 3,1,2
'main programming loop
while b=0
rem player movement
x2# = object position x(2)
y2# = object position y(2)
z2# = object position z(2)
ay2# = object angle y(2)
if upkey()=1 then move object 2,player_speed#
if downkey()=1 then move object 2,-player_speed#
if leftkey()=1 then rotate object 2,0,(ay2#)-3,0
if rightkey()=1 then rotate object 2,0,(ay2#)+3,0
set camera to follow x2#,y2#,z2#,ay2#,5,5,1,1
position object 3,x2#,y2#,z2#
SC_updateObject 2
sync
endwhile
I'll add something later on.