ok someone can help me i am sure :)

Started by wadmixfm, July 13, 2019, 18:21:47

Previous topic - Next topic

wadmixfm

here is my problem

i used to use blitzmax 1.48 and it worked fine and dandy and i went on to write a drum machine program based on the old Spectrum 48k -SpecDrum from cheetah software.

so far whilst using that i did complete the software and it runs and works fine , so now comes the crunch .........

i installed Blitzmax NG and copied my code to this and in the old version you could use labels in conjunction with the goto command

for example

Graphics 640,480
#Start
Cls


DrawText "hello" ,0,20

Flip
WaitKey()

goto Start

when i run this in Blitzmax NG it says

MaxIDE 1.52 [ng]

Compile Error

Labels must appear before a loop or DefData statement

can someone explain to me why has this changed or is there a command to jump to labels that i have missed ??

Lee



Henri

Hi,

labels are deprecated in strict mode, and NG is strict by default.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

wadmixfm

Thanks for the reply

so there is no way around it ??

cheers

wadmixfm

this is weird , if i do this

Graphics 640,480
Local u
#Start
Cls
DrawText "hello" ,0,20
Flip
WaitKey()

and run it , it brings up the error

but if i do this

Graphics 640,480
Local u
#Start
for u=1 to 1
next
Cls
DrawText "hello" ,0,20
Flip
WaitKey()

and run it

it works

but i cant use the goto in both instances :)

whats that all about lol

lee



Derron

Replace your goto/label stuff with some more "modern" approach:

Code (Blitzmax) Select

Repeat
  Cls
 
  DrawText "hello" ,0,20
 
  Flip
  WaitKey()
Forever
'or
'Until KeyHit(KEY_ESCAPE) or AppTerminate()



bye
Ron

Yellownakji

Quote from: wadmixfm on July 13, 2019, 18:21:47
here is my problem

i used to use blitzmax 1.48 and it worked fine and dandy and i went on to write a drum machine program based on the old Spectrum 48k -SpecDrum from cheetah software.

so far whilst using that i did complete the software and it runs and works fine , so now comes the crunch .........

i installed Blitzmax NG and copied my code to this and in the old version you could use labels in conjunction with the goto command

for example

Graphics 640,480
#Start
Cls


DrawText "hello" ,0,20

Flip
WaitKey()

goto Start

when i run this in Blitzmax NG it says

MaxIDE 1.52 [ng]

Compile Error

Labels must appear before a loop or DefData statement

can someone explain to me why has this changed or is there a command to jump to labels that i have missed ??

Lee


You really shouldn't use labels anymore.   I suggest swapping them out for while loops or you can make your application run a specific process every frame by changing and setting a custom loop variable.

TomToad

The problem is not with the labels, it is with goto.  NG uses strict mode which doesn't allow goto. Labels are still allowed in NG, but only for the purpose of exiting nested loops or with DefData/ReadData, hence the error.

Instead of using Goto, use the more structured commands instead. For creating loops, use While/Wend, Repeat/Until/Forever, For/Next.  For creating branches, use If/Then/Else, Select/Case.  It might take a bit of getting use to, especially if you've used goto a lot, but your code will be much easier to follow and have fewer potential bugs.
------------------------------------------------
8 rabbits equals 1 rabbyte.

wadmixfm

#7
wow thanks for the replies peeps

yes it is the goto command thats causing the error!!!!!!

so why is it still implemented when you type it , it goes yellow :-)

my code was written way back in 2013 and there is a lot of code and about 250 goto's and they all do different things for example a key press then goto next bit

in blitzmax 1.50 it works and compiles but i do want to move foward and start with NG and yes i hear what you say but i read somewhere that when you compile you can use a switch on the compiler like

bmk.exe -nostrict bla bla bla

is this true ??

lee

additional

this is what i am on about

Some BMK params would even allow for "compatibility":
bmk -w -nostrictupgrade


Maybe we should add these options to MaxIDE too.


Derron

I already opened an issue for this some time ago - just nobody found time yet to implement it (it is not a biggy...).
https://github.com/bmx-ng/maxide/issues/61


@ goto
Just replace your gotos with the proposed code structures - it would work then in 1.50 (legacy) and also in NG.


bye
Ron

fielder

Quote from: wadmixfm on July 14, 2019, 12:42:30
my code was written way back in 2013 and there is a lot of code and about 250 goto's and they all do different things
better to leave this code to 32bit :) .. if you want to do a cross compiling... maybe is better to compile sources directly on the target platform... using standard (old) Blitzmax 1.5...  use a Mac to compile for Mac... and Windows to compile for Windows...

Derron

You will have fun on newer Macs then - regarding 32bit limitation.


Convert once - you most most most probably won't loose any functionality when moving from "goto" to a proper function call, whileWend, repeatUntil, ...

bye
Ron

iWasAdam

yep - as Derron says MacOS wont run 32bit apps in a few months with their new OS.

Now it the time to rid yourself of using goto's :)

wadmixfm

ok thanks guys :)

i finally sorted it :)

:)

thanks for all the advice

Lee

wadmixfm

i did actually forget to tell you i am using a mac at the moment and when i finish this program will port it onto the pc , mac osx Mojave compiles great and works fine

just got to convert it all for pc :)

that should be fun hehe

Lee