Author Topic: strange  (Read 2218 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
strange
« on: August 31, 2011, 11:20:57 AM »
Hi Charles,

This is a bit strange.

InitSound: sys_mode=4
with this position you cannot hear the sound!
This will not initialised.

If you jump out of an 'elseif' into a  'Sub' and come back, the program crashes.

for example: only pseudo code.

sub maingame()
while key(vk_space)=0
print "Huhu"
wend
end sub

sub simple()
if     key(vk_return) and cury=100
do nothing
elseif key(vk_return) and cury=112 
maingame
elseif kye(vk_return) and cury=124
exit sub 'or return'   
endif
end sub

Done

my solution:
WinEnd: ExitProcess 0,   but I have not any FreeLibrary!
   

Charles Pegge

  • Guest
Re: strange
« Reply #1 on: August 31, 2011, 12:44:26 PM »

Quote
InitSound: sys_mode=4
with this position you cannot hear the sound!

I think InitSound: is being interpreted as a label.

You can either place a space between the name and the colon InitSound :
or insert a pair of brackets InitSound():

I will check the parsing sequence to see if this misinterpretation can be avoided.

The pseudocode looks okay.
Equivalent test:

Code: OxygenBasic
  1. sub f()
  2. '======
  3. do
  4.   print "ok"
  5.   exit do
  6. end do
  7. end sub
  8.  
  9. sub g()
  10. '======
  11. sys a=3
  12. if a=1
  13.   '
  14. elseif a=2
  15.   '
  16. elseif a=3
  17.   f : a=0
  18.   exit sub
  19. end if
  20.  
  21. end sub
  22.  
  23. g
  24.  

Charles