Code not working?

Blitz3D Forums/Blitz3D Programming/Code not working?

Mike V(Posted 2004) [#1]
Hello all.. I'm running into a bit of a problem here...

I'm trying to get some terrain with a rotatable/moveable camera to display in B3D. I'm using code that is pretty much verbatim to what is in the help file, however, when I actually implement it, with only a couple changes that shouldn't affect anything, it's not working. I keep getting a "Expecting Wend" - and there's a Wend in there, as there is in the sample code...

Just to show what I mean..
Here's the code in the B3D Help file (I have no idea why the font is coming out so tiny, so I'm sorry for that)

Graphics3D 800,600

  SetBuffer BackBuffer()

  camera=CreateCamera()
  CameraViewport camera,0,0,800,600

  light=CreateLight()

  house=LoadMesh( "house.3ds" )
  RotateEntity house,0,90,0

  While Not KeyHit(1)

      If KeyDown(200) Then
          MoveEntity camera,0,0,1
      EndIf

      If KeyDown(208) Then
          MoveEntity camera,0,0,-1
      EndIf

      If KeyDown(203) Then
          TurnEntity camera,0,1.0,0
      EndIf

      If KeyDown(205) Then
          TurnEntity camera,0,-1.0,0
      EndIf

  UpdateWorld
  RenderWorld

  Text 335,500,"Camera Movement"

  Flip

  Wend
  End


And here's what I'm using:

Graphics3D 1024,768

SetBuffer BackBuffer()

land=LoadMesh("terrdirectx.x") ; find this in the .zip file and also copy the textures & lightmap to your working dir

AmbientLight 180,180,210

camera=CreateCamera()
PositionEntity camera,0,8,0

While Not KeyHit(1)

IfKeyDown(200) Then
	MoveEntity camera,0,0,1
EndIf

If KeyDown(208) Then
	MoveEntity camera,0,0,-1
EndIf

If KeyDown(203) Then
	TurnEntity camera,0,1.0,0
EndIf

IfKeyDown(205) Then
	TurnEntity camera,0,-1.0,0
EndIf

UpdateWorld
RenderWorld

Flip
Wend

End


Can someone please let me know what I'm doing wrong here? Because to my eyes, everything looks as it's supposed to be..

Thanks!
Mike


GfK(Posted 2004) [#2]
I think you're missing some spaces in "IfKeyDown(200)" and "IfKeyDown(205)"...


Mike V(Posted 2004) [#3]
That was exactly it... Not sure how I overlooked that.. I mean one showed up all in Blue the other all in white.. ugh.. Okay


Thanks again!

Oh.. also.. because I cannot seem to remember it, where you can find the key values to use in the If KeyDown(xxx) commands? I used to know exactly where it was but it's escaping me now and I'm not sure exactly what to search for on Google to find it...

Thanks!

:-)


VIP3R(Posted 2004) [#4]
The key values are contained in the Command Reference under Scancodes.