Author Topic: Unknown  (Read 7248 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Unknown
« on: July 21, 2011, 12:57:32 PM »
Hi Charles,

what means this accurately:
eighteen excess brackets?

[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Unknown
« Reply #1 on: July 21, 2011, 02:19:47 PM »
That a lot!

It is often a symptom of Unclosed conditions or procedures.

Charles

Peter

  • Guest
Re: Unknown
« Reply #2 on: July 23, 2011, 05:12:33 AM »
Hi Charles,

After two days searching I got the following result:
'OxyGenBasic version o36  Forbidden secrets',  must go to hell.  >:(

There are two hazardous Bugs. I have got eighteen 'Exit Sub' and got eighteen 'excess left brackets in source ((..)'

'Exit Function' is also a handy cap!
Your explanation for that?  I need quickly a better version.

[attachment deleted by admin]

[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Unknown
« Reply #3 on: July 23, 2011, 06:45:41 AM »

Hi Peter,

I have not seen any problems with these symptoms for a very long time. If you can show me your code I should be able to trace the bug and find a better way to trap it in future releases.

Charles

Peter

  • Guest
Re: Unknown
« Reply #4 on: July 23, 2011, 08:11:33 AM »
Hi Charles,

is not executable here!

Code: [Select]
Sub MainMenu()
While EscKey() =0
glClearColor 0.0, 0.0, 0.0, 0.0
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
DrawTexture Bild,0,0,800,600
DrawText Font,"MINI BOULDER",208,16,32,32
DrawText Font, a,64,32,12,8
DrawText Font,"LEVELS " + zLev,336,224,16,16
DrawText Font,"PLAYER " + xName,336,240,16,16
DrawText Font,"HSCORE ",336,256,16,16
DrawText Font,"GOHOME ",336,272,16,16
DrawText Font,"SECRET ",336,288,16,16
DrawText Font,"OXYGENBASIC GAME",272,528,16,64
DrawTexture Quad,xCur,yCur,96,16
iF Key(vk_down) <0 and yCur <288 and CurD=0
yCur +=16: CurD=1
PlaySound s30
ElseiF Key(vk_up) <0 and yCur >224 and CurU=0
yCur -=16: CurU=1
PlaySound s30
ElseiF Key(vk_right) <0 and zlev <50 and yCur=224 and CurR=0
zlev +=1: CurR=1
PlaySound s30
ElseiF Key(vk_left)  <0 and zlev > 1 and yCur=224 and CurL=0
zlev -=1: CurL=1
PlaySound s30
ElseiF Key(vk_space) <0 And yCur =224 and iRet=0    
iRet=1
'DataInit()
'Times = xTime(zLev)
'Gems  = xGems(zLev)
LoadFile "Maps\Map" + zLev + ".bin",cMap
'FindDigger()
'MainGame()
'ElseiF yCur =240
'PlayerInput()
ElseiF Key(vk_space) <0 And yCur =256 and iRet=0
iRet=1
'ShowHighScore()
ElseiF Key(vk_space) <0 And yCur =288
DrawTexture Peti,430,300,128,128
ElseiF Key(vk_space) <0 And yCur =272
'SavePlayer()
Exit Sub       '< 1 excess left brackets in source ((..)  
End iF
DoEvents
SwapBuffers hDC
WaitFrames 25
iF Key(vk_right) =0 Then CurR=0
iF Key(vk_left)  =0 Then CurL=0
iF Key(vk_Up)    =0 Then CurU=0
iF Key(vk_Down)  =0 Then CurD=0
iF Key(vk_space  =0 Then iRet=0
Wend
End Sub

yCur=224: xCur=336
MainMenu
  

I also noticed that  'ElseiF Key(vk_return) <0' has no effect!   Key is = GetAsyncKeyState() : vk_return = 0x0D  
The other 17 'excess left brackets in source ((..)' are similar built.

I have got 4574 lines right now. If I leave aside 'Exit Sub' then is anything Okay!   
« Last Edit: July 23, 2011, 08:14:17 AM by peter »

Charles Pegge

  • Guest
Re: Unknown
« Reply #5 on: July 23, 2011, 09:28:19 AM »

Peter,

I noticed there is a missing right bracket towards the end:

iF Key(vk_space  =0 Then iRet=0

Charles

Peter

  • Guest
Re: Unknown
« Reply #6 on: July 23, 2011, 11:14:34 AM »
Yes,  but it gave no error.  It is a case for the administrator.
I stuck in a trap.   >:(

Better error handling would be good.  ;D

Charles Pegge

  • Guest
Re: Unknown
« Reply #7 on: July 23, 2011, 11:41:15 AM »
Quote
'ElseiF Key(vk_return) <0' has no effect!

GetAsyncKeyState returns a short integer. If you use low level binding then this fact will not be known to the compiler and it will assume a sys value (long) is the return type, resulting in a negative value being seen as a positive value.

http://msdn.microsoft.com/en-us/library/ms646293(v=vs.85).aspx

Charles

Peter

  • Guest
Re: Unknown
« Reply #8 on: July 23, 2011, 11:47:45 AM »
I knows it!  That is no problem here.

modifications:
Every 'Exit Sub' is now Return 0. That goes! No error message here!
« Last Edit: July 23, 2011, 12:11:48 PM by peter »

Charles Pegge

  • Guest
Re: Unknown
« Reply #9 on: July 23, 2011, 01:12:34 PM »
With subs you can use simple return

I don't know why you are getting errors with exit sub though.

Charles

Peter

  • Guest
Re: Unknown
« Reply #10 on: July 23, 2011, 01:38:02 PM »
Hi Charles,

I translate each of the 500 routines in a single manner.

(SUB EXIT) stays problematic.
This will become the first GL-GAME, and  I am quite new therewith.

But I will try it likewise.
I hope that I will find some bugs for you.
« Last Edit: July 23, 2011, 01:43:17 PM by peter »

Charles Pegge

  • Guest
Re: Unknown
« Reply #11 on: July 23, 2011, 05:08:39 PM »
Peter,

I was able to simulate the problem you were having with exit sub and excess left brackets:

suppose the word "exit" got redefined by accident..

Code: OxygenBasic
  1. %exit 1
  2.  
  3. sub f1(sys a)
  4.   print "ok"
  5.   exit sub
  6. end sub
  7.  
  8. sub f2(sys a)
  9.   print "ok"
  10.   exit sub
  11. end sub
  12.  
  13.  
  14. f1 1
  15.  
  16.  

Charles

Peter

  • Guest
Re: Unknown
« Reply #12 on: July 24, 2011, 03:47:18 AM »
Hi Charles,

Our last hope, new Installation of OxygenBasic v o36 macabre version.

[attachment deleted by admin]

Peter

  • Guest
Re: Unknown
« Reply #13 on: July 24, 2011, 04:04:23 AM »
More stuff.  :D

[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Unknown
« Reply #14 on: July 24, 2011, 04:38:16 AM »
Peter,

Yes that is what happens.

There is a directive that will prevent things being defined more than once:

#unique on

this is generally the default behaviour in Basic but not in Oxygen.

It may help to have this active at least for debugging.

Charles