Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: Brian Alvarez on July 31, 2019, 01:49:03 PM

Title: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 01:49:03 PM
 Hello Charles, i am almost done with my excersize clone of Dr Mario.
But im having trouble with a stray comma that i dont see. Can you take a look? It was compiling
fine and when i added something it suddenly broke.

 I tries attaching a sample of the PowerBASIC compilation, but i couldnt because of the size.

 Until a few changes ago... it was compiling fine also for Oxygen... but no more. :(

 Help? By the way... comparisons still return 1.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 01:52:54 PM

 By itself this line doesnt cause any problems:

Code: [Select]
sprframe = (CHOOSE(offframe + 1, INT {1, 2, 3, 2}, countof))
 But something else in my program caused it to start complaining about this:

Code: [Select]
ERROR: ERROR: stray comma:
WORD: ,
IN: dlgproc
LINE: 3076
FILE: "main source
Title: Re: Dr Mario WIP (Playable)
Post by: Brian Alvarez on July 31, 2019, 02:26:41 PM
 Attached is a playable demo of this code. This one is compiled in PowerBASIC,
but until a couple hours ago it was running fine on oxygen as well...

 Note: it is unfinished.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Charles Pegge on July 31, 2019, 03:36:15 PM
Something goes wrong in line 2221...

      IF ( area.lng(area.m(x,i), (0)).color = area.lng(area.m(x,y), (0) ) THEN
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Arnold on July 31, 2019, 03:38:13 PM
Hi Brian,

as long as I do not understand the diagnostic tools of Charles, I can only let me lead by the error messages. This is what I have done (I did not look much at the code, this is too much for me at the moment):

commented out line 4 and line 6 ($ filename .. / uses rtl32) - I run the code directly
commented out line 3076: sprframe = (CHOOSE(offframe + 1, INT {1, 2, 3, 2}, countof))
commented out line 3093: sprframe = (CHOOSE((offframe + 1), INT {5, 6}, countof))

replaced all GetModuleHandle with ¤GetModuleHandle (1539, 3009-3013)

Now I can see at least the (empty) window of the app and hear the sound of the .mid file. I assume something in function CHOOSE does not work properly.

Roland
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 03:39:06 PM
Gahhhh!! im blind!!

 Thanks Charles!  :o
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 03:40:53 PM
Now I can see at least the (empty) window of the app and hear the sound of the .mid file. I assume something in function CHOOSE does not work properly.

Arnold, i posted a playable version, in case you want to try it. Its very limited, i have only been working on it for a little bit. I need to go out now, but i hope tonight i can post an update. :)
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Charles Pegge on July 31, 2019, 03:48:09 PM
Another similar around line 2422

      IF (area.lng(area.m(i,y), (0)).color=area.lng(area.m(x,y), (0)) THEN
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 03:49:43 PM
Another similar around line 2422

 I found dozens Charles... i think my engine is acting dumb.  :o
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 03:58:12 PM
Fixed the engine for the wrong generation of .color, but the original problem still remains. In fact, i believe Oxygen was
compiling it correctly even with that error before (So, Arnold is correct, it compiles when removing CHOOSE).

Attached the code, because it is now over 10000 characters and the forum doesnt allow me to put it between code tags.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Charles Pegge on July 31, 2019, 04:00:11 PM
Okay, I'm off to bed.

I traced it by insertions of  this expression as bug bait:

int g={1,2,3}
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on July 31, 2019, 09:04:35 PM
 If i comment out the code from BlockFell() and part of the code
from Destroyed()... it all works fine, but loses that functionality.

 In fact, if i remove anything, just to make the code smaller, it sometimes
compiles fine. The attached executable was compiled with oxygen...
but doesnt work like the other one.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Charles Pegge on August 01, 2019, 08:56:11 AM
I've updated oxygen.dll to trap those expression nesting errors on the line. (OxygenProgress.zip). I think there were about 7 in all.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Aurel on August 01, 2019, 09:09:36 AM
Brian

you started self-destruction sequence  ;D ;D ;D
one thing stray comma is a very powerful enemy

when you use o2 you must not think in a power basic way with whole bunch of UDT-s
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Aurel on August 01, 2019, 09:19:40 AM
Is it really necessary to have custom AND,OR NOT ?
gee i cannot recognize what kind of programming language is that .

 :o
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on August 01, 2019, 10:50:39 AM
Is it really necessary to have custom AND,OR NOT ?

 Current AND and NOT operators work finw with 32bit or smaller variabless, but
Try them with QUADS and see what happens.
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on August 01, 2019, 11:30:34 AM
I've updated oxygen.dll to trap those expression nesting errors on the line. (OxygenProgress.zip). I think there were about 7 in all.

Thanks Charles, oxygen now is reporting some errors i made in my code, i will fix them to see if
that allows me to compile the game. :)
Title: Re: Dr Mario WIP and problem with stray comma...
Post by: Brian Alvarez on August 01, 2019, 12:11:16 PM
 Success!! With this update it is now compiling perfectly good. :)

 Thanks Charles!