; WorldLoadError Example ; ---------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5 light=CreateLight() RotateEntity light,45,45,0 ; A warning-red cube marks the failed load in our scene cube=CreateCube() PositionEntity cube,0,1,0 EntityColor cube,255,80,80 ; Deliberately load a world file that does not exist bad_world=LoadWorldAsync("missing-example.world") ; Pump async loading until the failure is reported While WorldLoadState(bad_world)<>WORLD_LOAD_FAILED UpdateAsyncLoads -1 Wend ; The failed world retains an actionable error message message$=WorldLoadError(bad_world) FreeWorld bad_world While Not KeyDown(1) TurnEntity cube,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrow keys: move camera Esc: exit" Text 0,20,"The load failed as expected. WorldLoadError$ returned:" ; Show the retained message in screen-wide chunks For i=0 To 2 Text 0,44+i*20,Mid(message,1+i*70,70) Next Flip Wend End