Author Topic: Invalid token?  (Read 11132 times)

0 Members and 1 Guest are viewing this topic.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Invalid token?
« 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?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Invalid token?
« Reply #1 on: July 16, 2011, 08:13:28 am »
Invalid Token? Please upload 8XP Source it's easier to help that way :)

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Invalid token?
« Reply #2 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
*insert supercool signature*

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Invalid token?
« Reply #3 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.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Invalid token?
« Reply #4 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. ???
« Last Edit: July 16, 2011, 08:28:05 am by Spyro543 »

Offline Ti-Programmer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 84
  • Rating: +3/-0
  • Whats this? so many features...
    • View Profile
    • Ti-Programmer's website
Re: Invalid token?
« Reply #5 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.
Spoiler For Sig:







Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Invalid token?
« Reply #6 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
...
*insert supercool signature*

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Invalid token?
« Reply #7 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)
« Last Edit: July 16, 2011, 08:36:53 am by Spyro543 »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Invalid token?
« Reply #8 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).
« Last Edit: July 16, 2011, 08:38:38 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Invalid token?
« Reply #9 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
*insert supercool signature*

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Invalid token?
« Reply #10 on: July 16, 2011, 08:39:10 am »
Oh, well then if that's not a bug, what's up with my code ???

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Invalid token?
« Reply #11 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.
*insert supercool signature*

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Invalid token?
« Reply #12 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
« Last Edit: July 16, 2011, 08:47:38 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Ti-Programmer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 84
  • Rating: +3/-0
  • Whats this? so many features...
    • View Profile
    • Ti-Programmer's website
Re: Invalid token?
« Reply #13 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.
Spoiler For Sig:







Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Invalid token?
« Reply #14 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)
*insert supercool signature*