September 23, 2019, 09:55:31 PM

Author Topic: ok someone can help me i am sure :)  (Read 462 times)

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
ok someone can help me i am sure :)
« on: July 13, 2019, 06:21:47 PM »
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



Offline Henri

  • Full Member
  • ***
  • Posts: 208
Re: ok someone can help me i am sure :)
« Reply #1 on: July 13, 2019, 08:53:11 PM »
Hi,

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

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

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
Re: ok someone can help me i am sure :)
« Reply #2 on: July 13, 2019, 09:19:44 PM »
Thanks for the reply

so there is no way around it ??

cheers

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
Re: ok someone can help me i am sure :)
« Reply #3 on: July 13, 2019, 09:31:19 PM »
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



Offline Derron

  • Hero Member
  • *****
  • Posts: 2419
Re: ok someone can help me i am sure :)
« Reply #4 on: July 13, 2019, 10:51:57 PM »
Replace your goto/label stuff with some more "modern" approach:

Code: BlitzMax
  1. Repeat
  2.   Cls
  3.  
  4.   DrawText "hello" ,0,20
  5.  
  6.   Flip
  7.   WaitKey()
  8. Forever
  9. 'or
  10. 'Until KeyHit(KEY_ESCAPE) or AppTerminate()
  11.  


bye
Ron

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 247
  • No.
Re: ok someone can help me i am sure :)
« Reply #5 on: July 14, 2019, 04:19:18 AM »
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.

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 429
Re: ok someone can help me i am sure :)
« Reply #6 on: July 14, 2019, 06:15:21 AM »
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.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
Re: ok someone can help me i am sure :)
« Reply #7 on: July 14, 2019, 12:42:30 PM »
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.


Offline Derron

  • Hero Member
  • *****
  • Posts: 2419
Re: ok someone can help me i am sure :)
« Reply #8 on: July 14, 2019, 03:13:49 PM »
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

Offline fielder

  • Jr. Member
  • **
  • Posts: 76
Re: ok someone can help me i am sure :)
« Reply #9 on: July 15, 2019, 07:31:55 AM »
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...

Offline Derron

  • Hero Member
  • *****
  • Posts: 2419
Re: ok someone can help me i am sure :)
« Reply #10 on: July 15, 2019, 07:36:05 AM »
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

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1249
Re: ok someone can help me i am sure :)
« Reply #11 on: July 15, 2019, 08:08:21 AM »
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 :)

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
Re: ok someone can help me i am sure :)
« Reply #12 on: July 21, 2019, 09:55:27 PM »
ok thanks guys :)

i finally sorted it :)

:)

thanks for all the advice

Lee

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 31
Re: ok someone can help me i am sure :)
« Reply #13 on: July 28, 2019, 12:51:51 AM »
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