Can you spot the problem?
Blitz3D Forums/Blitz3D Programming/Can you spot the problem?
| ||
Ok, this is weird. I have a type ClientMap.Mapdata that is getting nulled if I leave a while/wend loop, and I cant seem to figure out why. Heres a snippet.
.lobbystart
While Not KeyDown(1)
If inlobby=1 Then
mp$=spawnlobby$(lobbycode)
removelobby()
clientmap.mapdata=clientloadmap(mp$)
If clientmap.mapdata=Null Then
lobbycode=1
Else
inlobby=0
Mic=CreateListener (cam,.3,5,.5)
home.tank=loadtank("media\tanks\tank1.b3d")
droptank home.tank,-10,100,-50
removetank(home.tank)
home.tank=loadtank("media\tanks\tank1.b3d")
settankactive(home.tank,1)
EntityParent mic,home\main,0
PointEntity cam,home\main
droptank home.tank,-10,100,-50
;connect to server
EndIf
framePeriod = 1000 / gameFPS
frameTime = MilliSecs () - framePeriod
Else
checktween()
LockBuffer BackBuffer()
UnlockBuffer BackBuffer()
RenderWorld(frametween)
If dofmode Then
CustomPostprocessDOF 300, 400, 1 , 3, 0.07, 0
RenderPostprocess FE_DOF
EndIf
Flip False
EndIf
If clientmap.mapdata=Null Then RuntimeError "clientmap IS valid.. this never errors out"
Wend
If clientmap.mapdata=Null Then RuntimeError "after esc is hit and loop broken.. now it always null. why?"
|
| ||
| Interesting. I have known similar instances in Blitz3D and wondered if it was just me. I usually recode what I am doing until the problem goes away. However, I too have been in a similar position. You are clearly checking the same thing both before termination of the While/Wend and straight afterwards. What you can do is shunt a whole load of Null checks all the way through that While/Wend loop - just to make sure. |
| ||
| oh, and just fyi, i lock and unlock the backbuffer because it removes input lag in windowed and debug modes. |
| ||
| You are leaving the loop though - which we cannot see - you don't goof it up do you outside of the loop? |
| ||
| Doh. think i got it. Edit.. yes. I swear the longer I sit at this PC the dumber I get. To clarify, I was using the wrong type of loop, I need the loop to end at the bottom of the snippet, not the top. (while vs repeat)
.lobbystart
framePeriod = 1000 / gameFPS
frameTime = MilliSecs () - framePeriod
Repeat
If inlobby=1 Then
mp$=spawnlobby$(lobbycode)
removelobby()
clientmap.mapdata=clientloadmap(mp$)
If clientmap.mapdata=Null Then
lobbycode=1
Else
inlobby=0
Mic=CreateListener (cam,.3,5,.5)
home.tank=loadtank("media\tanks\tank1.b3d")
droptank home.tank,-10,100,-50
removetank(home.tank)
home.tank=loadtank("media\tanks\tank1.b3d")
settankactive(home.tank,1)
EntityParent mic,home\main,0
PointEntity cam,home\main
droptank home.tank,-10,100,-50
;connect to server
EndIf
framePeriod = 1000 / gameFPS
frameTime = MilliSecs () - framePeriod
Else
checktween()
;LockBuffer FrontBuffer()
LockBuffer BackBuffer()
UnlockBuffer BackBuffer()
RenderWorld(frametween)
If dofmode Then
;-CustomPostprocessDOF 300, 400, 1 , 3, 0.07, 0
;-RenderPostprocess FE_DOF
EndIf
Flip False
EndIf
Until KeyHit(1)
Thanks for posting Puki. |
| ||
| I bet you tried my idea of injecting the Null test to find it. |
| ||
| nah, I was re reading this topic and it hit me while looking at the codebox, that I was using the wrong loop. |