Author Topic: Help for a newby please  (Read 1515 times)

Offline yaKC

  • Mc. Print
  • *
  • Posts: 17
    • View Profile
Help for a newby please
« on: 2009-Dec-13 »
Hiya, just started using GLBasic a couple of days ago and already love it, however as can be expected I'm experienceing some rather weird problems.

Firstly, I have a few lines such as the following:-

IF c<>14062080 THEN LET p=p+1

and everything was working perfectly, and all of a sudden on
one of the lines it is now saying :-

(70) error : IF without ENDIF / THEN

even though it was working...

in a similar manner if i try

IF c<>14062080
LET p=p+1
ENDIF

or indeed any other IF ENDIF statement i get:-

(70) error : IF without ENDIF / THEN

even though I'm using it correctly :(

also, if i do a command like:-

IF KEY(50) and x>0 THEN LET x=x-1

it errors, forget the error, but if i only do one check in the line, like leaving out the extra AND x>0 it works

Can anybody help me please, I dearly want to start creating
games using GLBasic but everything sems to be not working as it should :(

anyway, as i say, great language and from a brief look around the forums looks like quite a community :)

Oh, and I've tried on both version 6.2 and the new version 7.

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4158
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Help for a newby please
« Reply #1 on: 2009-Dec-13 »
Try using your code without the "LET" command

Code: (glbasic) [Select]
IF c<>14062080
 p=p+1
ENDIF

or even

Code: (glbasic) [Select]
IF c<>14062080
 INC p
ENDIF

Those shouldn't bring up an errors. LET isn't necessary in GLBasic.

I'm at work so can't test this. The only other thing I can think of is that the maximum integer value for "c" has perhaps been reached (although I can't remember what the max and min values are). Try a lower value to check.
« Last Edit: 2009-Dec-13 by Ian Price »
I came. I saw. I played.

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1786
    • View Profile
    • Homepage
Re: Help for a newby please
« Reply #2 on: 2009-Dec-13 »
I have tested them all now with version 7.181 and they all work fine.
The error might be on a row earlier, check that all while/if/select/for and so on is matching up with the wend/endif/endselect/next statements or try the lines alone in a program to see if it still won't compile. If that works then post your whole code so we can have a look :-)

MrTAToad

  • Guest
Re: Help for a newby please
« Reply #3 on: 2009-Dec-13 »
Indeed - it sounds like an end terminator command is missing

Offline yaKC

  • Mc. Print
  • *
  • Posts: 17
    • View Profile
Re: Help for a newby please
« Reply #4 on: 2009-Dec-23 »
I'm sorry for not getting straight back to this... thanks for the replys and the command list looks to be a great asset whether learning the language or not.

Finally fixed this a couple of days back, and loving coding again :)

As you guys said, there didn't appear to be any problem with the code i was using, I dug a bit into the forum and found a post where someone fixed a similar problem (whereby GLBasic just wouldn't work), by downloading and installing the C++ 2005 redist... As soon as i did that everything worked fine :)

thanks, and once again, sorry for not getting straight back, appreciate the hlp ;)

edit:- and just for the laugh my game now is experiencing the same bugs as it should (porting a game of mine from an old 8-bit) :D lol
« Last Edit: 2009-Dec-23 by yaKC »