Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: Spyro543 on July 16, 2011, 08:11:01 am

Title: Invalid token?
Post by: Spyro543 on July 16, 2011, 08:11:01 am
Hi, first time Axe programmer here. :P

At 15% of compiling, I get an Invalid Token error.

Here is the code:
Code: (program source code) [Select]
.MOVEDEMO
1->A
1->B
Pt-On(1,1,[FF818181999999FF]):DispGraph
Lbl 1
Getkey->C
If C=4
Then
A+1->A:Pt-On(A,B,[FF999999818181FF]):DispGraph
End
If C=1
Then
A-1->A:Pt-On(A,B,[FF818181999999FF]):DispGraph
End
If C=2
Then
B-1->B:Pt-On(A,B,[FF8181F1F18181FF]):DispGraph
End
If C=3
Then
B+1->B:Pt-On(A,B,[FF81818F8F8181FF]):DispGraph
End
Goto 1

How can I make this code work?
Title: Re: Invalid token?
Post by: Munchor on July 16, 2011, 08:13:28 am
Invalid Token? Please upload 8XP Source it's easier to help that way :)
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:22:22 am
NEVER use Then in an Axe-code.
If is already like a If with a Then.
No need for Then

Example:

If A=2
3->A
B+1->B
End
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 08:24:11 am
p2 is right. Never put a Then but always put a End.
Also, pressing Prgm while there is the error message leads you to the error if the program is unarchived, like the "Error, Goto" in Basic.
Title: Re: Invalid token?
Post by: Spyro543 on July 16, 2011, 08:26:30 am
Ok, will eliminate the "Then"s. I'm just used to Casio-Basic, which requires Thens.
EDIT: Still doesn't work. I'm not sure how to get individual files from my calc with TILP. ???
Title: Re: Invalid token?
Post by: Ti-Programmer on July 16, 2011, 08:29:13 am
Ti basic doesn't require them, its just better to put them in. (can't have an else without a then in basic) though i do see why then was removed from axe, its just extra typing.
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:33:09 am
The getkey is wrong!
Axe allows multitasking!

Code: [Select]
.MOVEDEMO
1->A
1->B
[FF818181999999FF->Pic1
Pt-On(1,1,Pic1
DispGraph
Lbl 1
If Getkey (4)
A+1->A
[FF999999818181FF]->Pic2
Pt-On(A,B,Pic2
DispGraph
End
...
Title: Re: Invalid token?
Post by: Spyro543 on July 16, 2011, 08:34:17 am
The getkey is wrong!
Axe allows multitasking!

Code: [Select]
.MOVEDEMO
1->A
1->B
[FF818181999999FF->Pic1
Pt-On(1,1,Pic1
DispGraph
Lbl 1
If Getkey (4)
A+1->A
[FF999999818181FF]->Pic2
Pt-On(A,B,Pic2
DispGraph
End
...

I think....I understand that...

WAIT - Should I do Getkey(4) or Getkey (4)
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 08:38:25 am
The getkey is not "wrong", it doesn't create a bug. It is just very slow.
You should do getkey(4).
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:38:35 am
No extra spece between them.

The Axe getKey makes a list.
Every getKey is a 0 or a 1
Title: Re: Invalid token?
Post by: Spyro543 on July 16, 2011, 08:39:10 am
Oh, well then if that's not a bug, what's up with my code ???
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:40:44 am
Try not to write the DispGraph in the same line.
Make it always in the next line.
then it should work.
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 08:43:25 am
New try ;D
Also, Spyro, you forgot a lot of things such as erasing the previous sprite and inverting the Y and the X and all, because it is Pt-On(X,Y,... not Pt-On(Y,X,...
Code: [Select]

.MOVEDEMO
1->A->B->E->F
Pt-On(1,1,[FF818181999999FF]):DispGraph

Repeat getkey(15)
 Pt-Off(F,E,[0000000000000000])
 A->E
 B->F
 Pause 100
  Repeat getkey(0)
  End
 If getkey(4)
  A-1->A
  Pt-Off(B,A,[FF999999818181FF])
 End
 If getkey(1)
  A+1->A
  Pt-Off(B,A,[FF818181999999FF])
 End
 If getkey(2)
  B-1->B
  Pt-Off(B,A,[FF8181F1F18181FF])
 End
 If getkey(3)
  B+1->B
  Pt-Off(B,A,[FF81818F8F8181FF])
 End
 DispGraph
End
Title: Re: Invalid token?
Post by: Ti-Programmer on July 16, 2011, 08:43:57 am
What axe are u usin? caus in 1.0 its changed the ':''s function to somethin different i think.
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:45:24 am
You can write spaces in front of the commands.
Axe ignors them.
But Then you can see better, where you are. (The code becomes easier to read)
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 08:46:47 am
Stupid me, I forgot somethings in the code
I use 0.5.3 ;D
Code: [Select]

.MOVEDEMO
1->A->B->E->F
Pt-On(1,1,[FF818181999999FF]):DispGraph

Repeat getkey(15)
 Pt-Off(F,E,[0000000000000000])
 A->E
 B->F
 Pause 100
  Repeat getkey(0)
  End
 If getkey(4)
  A-1->A
  Pt-Off(B,A,[FF999999818181FF])
 End
 If getkey(1)
  A+1->A
  Pt-Off(B,A,[FF818181999999FF])
 End
 If getkey(2)
  B-1->B
  Pt-Off(B,A,[FF8181F1F18181FF])
 End
 If getkey(3)
  B+1->B
  Pt-Off(B,A,[FF81818F8F8181FF])
 End
 DispGraph
End
Title: Re: Invalid token?
Post by: Spyro543 on July 16, 2011, 08:47:10 am
What axe are u usin? caus in 1.0 its changed the ':''s function to somethin different i think.

1.0 :P
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:47:32 am
I'm using 0.5.3
(My TI don't like the newer Version.)
Exactlier: The bug in my OS hates the newer versions.


Has the code worked?



Spoiler For Hayleia:
I expected you to write USELESS ME  ;)
What's missing?
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 08:51:05 am
Hey ! My new code (http://ourl.ca/12117/228595) works well (except if you press more than 1 key) !

EDIT: I attached the file for the lazy ones :P
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 08:53:31 am
Looks correct.
And it's smaller because you've taken the GispGraph to the end, where you only need one.
Title: Re: Invalid token?
Post by: Ti-Programmer on July 16, 2011, 08:57:39 am
Thank you!
^^^^^^^ the lazy ppl agree.
Title: Re: Invalid token?
Post by: Spyro543 on July 16, 2011, 09:03:12 am
Hey ! Wy new code (http://ourl.ca/12117/228595) works well (except if you press more than 1 key) !

EDIT: I attached the file for the lazy ones :P

Compiled and I got ERR:SYNTAX.
Title: Re: Invalid token?
Post by: p2 on July 16, 2011, 09:06:14 am
While Compiling or when you started it?

While Compiling
>Press PRGM

When Starting Game
>asm(PROGRAM-NAME
Or something else.
You must look as what you've compiled it.
(Mirage/Doors/asm/app)
Title: Re: Invalid token?
Post by: Hayleia on July 16, 2011, 12:02:26 pm
??? I don't see any problem (except the erasing), what did you do ?
I downloaded the code I uploaded and compiled it, everything worked (except the erasing) ??? :crazy:
!!! you use 1.0 and I use 0.5.3 version of Axe !!! the problem must come from here.
Title: Re: Invalid token?
Post by: squidgetx on July 17, 2011, 08:38:04 pm
You can't have labels beginning with a number in Axe 1.0.0 or later.