Jump to content
IGNORED

what is wrong with this code?


Animan

Recommended Posts

can someone tell me? it keeps on saying syntaz errors on vbB. even when it's clear nothing is wrong with it. even on lines with nothing on it! Is there something wrong, or is this a dumb glitch?

 

x=70
y=85
a=75
b=0   
 
 set romsize 2k
 
 AUDV0 = 5
 AUDC0 = 2
 AUDF0 = 8
playfield:
 XXXXXXXXXX............XXXXXXXXXXXX
 XXXXXXXXXXXXXXX..........XXXXXXXXX
 XXXXXXXXXXXXXXXX..........XXXXXXXXX
 XXXXXXXXX.............XXXXXXXXXXXX
 XXXXXXXXXX...........XXXXXXXXXXXXXXX
 XXXXXXXX............XXXXXXXXXXXX
 XXXXXX..............XXXXXXXXXXXXXX
 XXXXX............XXXXXXXXXXXXXXXXX
 XXX..............XXXX..XXXXXXXXXXXx
 XXXXXXX..............XXXXXXXXXXXXX
 XXXXXXX..............XXXXXXXXXXXXX
 XXXXXXXXXX..............XXXXXXXXXX
end

  

 

main
 

COLUP0=196
COLUPF=196
COLUBK=00
scorecolor = 196



player0:
%11111111
%01111110
%11111111
%11111111
%01111110
%01111110
%11111111
%11000011
%01000010
%00111100
end
pfscroll down
 score = 0+1
player0x=x
player0y=y
drawscreen
if joy0right then x=x+1 
if joy0left then x=x-1
if joy0up then pfscroll down
if joy0up then score= score +1
if collision(playfield,player0) then pfscroll up
if collision(playfield,player0) then if joy0right then x=x-1
if collision(playfield,player0) then if joy0left then x=x+1 
if collision(playfield,player0) then if joy0up then pfscroll up
if collision(playfield,player0) then if joy0up then score = score-1
if joy0fire then reboot 
if collision(playfield,player0) then score=score-1

goto main

Edited by Animan
Link to comment
Share on other sites

Please post errors and line numbers. Indicate where the erros are in the code. Could you edit the post and wrap it in "code tags" and not "spoiler tags"?

It keeps on saying "syntax error" on a random line. every time i compile it again, it's somewhere different, as if i fixed the first one (even if i didn't touch it), but screwed up a different one.

Link to comment
Share on other sites

Please post errors and line numbers. Indicate where the erros are in the code. Could you edit the post and wrap it in "code tags" and not "spoiler tags"?

It keeps on saying "syntax error" on a random line. every time i compile it again, it's somewhere different, as if i fixed the first one (even if i didn't touch it), but screwed up a different one.

 

Well, its hard to tell without you posting the actual BAS file, but from what you posted in the codebox it looks to me as though "player0x" and "player0y" don't have white space in front of them, in which case they are being treated as labels.

Link to comment
Share on other sites

Please post errors and line numbers. Indicate where the erros are in the code. Could you edit the post and wrap it in "code tags" and not "spoiler tags"?

It keeps on saying "syntax error" on a random line. every time i compile it again, it's somewhere different, as if i fixed the first one (even if i didn't touch it), but screwed up a different one.

 

Well, its hard to tell without you posting the actual BAS file, but from what you posted in the codebox it looks to me as though "player0x" and "player0y" don't have white space in front of them, in which case they are being treated as labels.

 

alright, i'll try that

Link to comment
Share on other sites

I copied your code, pasted it into Crimson Editor (well, into WordPad first, then from WordPad to Crimson Editor, so the line breaks would be there), and then added spaces to indent everything that needed to be indented. When I compiled it, it compiled without errors and ran fine. So if you're getting a syntax error, it must be from a line that isn't indented that should be. It looks like there might be three such lines in your code:

 

Line 1 -- x=70

Line 54 -- player0x=x

Line 55 -- player0y=y

 

And your playfield statement has a couple of issues, although they didn't cause an error:

 

Each playfield row should have 32 characters on it-- no more, no less. Several of your rows have more than 32, or less than 32.

 

Each playfield row should contain only periods (.) and capital exes (X), unless you include additional information in the statement to tell batari Basic which character will represent an "off" pixel, and which character will represent an "on" pixel. One of your playfield rows has a lowercase ex (x) instead of an uppercase ex (X).

 

Michael

Link to comment
Share on other sites

Okay, I downloaded your posted code, and I see the two bugs.

 

Line 1 is okay, it must has just lost the leading space when you copied and pasted it into the codebox.

 

Line 47 has no leading space, so batari Basic is treating it like a line label. And the first thing it sees after the "line label" is an equals sign (=), which it's trying to interpret as a batari Basic statement-- except there is no such statement in batari Basic. So it says "(47): Error: Unknown keyword: =" (at least, that's what it says when I compile it. The message is telling you that

 

(1) the problem is found on line 47 (that's what the "(47)" at the beginning of the message means);

 

(2) the problem is an error (as opposed to a warning);

 

(3) the error is that it encountered an unknown keyword while scanning or processing the code on that line; and

 

(4) the unknown keyword is "=" (an equals sign).

 

You have the same problem on line 50-- you're missing a space at the beginning of the line.

 

I don't know why I got different line numbers for those two statements when I copied and pasted the code from the codebox.

 

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...