Omnimaga
Calculator Community => TI Calculators => Grammer => Topic started by: persalteas on April 25, 2012, 07:59:41 am
-
Hello, first I have a question: who programs with Grammer here ? Just Xeda ?
Then I would these programers to tell we where are my error(s) in this program:
It's a base converter from decimal. (it is supposed to be ;D )
The display always starts with a value that I didn't ask for, and then the right value.
:.0:Return→B
:ClrDraw
:Line(1,5,9,95,6
:Line(0,6,9,95,6
:Text(8,5,"Base Converter
:/Text(18,0,"Base ?
:DispGraph
:expr(Input →G
:/Text(18,0,"Valeur Décimale ?
:DispGraph
:expr(Input →AC'
:/Text(30,0,"= "
:Text('°AC',G
:DispGraph
:Repeat getkey
:End
:If =15
:Goto B
:ClrDraw:DispGraph
:Stop
And then, I have some questions about the Input command:
- is there a mean to forbid other tokens than alphanumeric ? (like pressing a key [stat],[On] etc...)
- When should the "two-points" appear on the screen ? Before or after pressing the first key ? (ow my syntax... <_< )
- The text in the Input is displayed like with /Text( , letter-by-letter. Is that normal ?
-
Damn, grammer changed quite a lot since I last programmed with it O.o
And if these should be commented lines, they need a double-slash (//)
-
I believe Yeong also programs in grammer. I don't, so I can't really help you :(
-
Yeah, Yeong is quite good at grammer :)
-
I believe Yeong also programs in grammer. I don't, so I can't really help you :(
Yeah, Yeong is quite good at grammer :)
I believe he is also writing a tutorial (but in English), if you need help
(I am talking to persalteas, even if I quoted everyone but him :P)
-
Okay...
*persalteas poke Yeong... (or Xeda, sure)
-
I just saw this topic.
I'll have to leave soon, but I'll get you the answer by tomorrow ;)
EDIT: Actually, your code is not wrong, but it's input itself. It somehow stores "14" in A when I tried with number 255.
-
Do you know how to solve the problem ?
storing 0 in A before the Input ?
-
Okay, I believe the problem is just that you have :expr(Input →AC' Input will not normally handle numbers >65535 x.x. I also changed a few things:
:.0: ;This line gets ignored because it starts with "."
:Return→B
:ClrDraw
:Line(1,5,9,95,6
:Line(0,6,9,95,6
:Text(8,5,"Base Converter
:/Text(18,0,"Base ?
:DispGraph
:expr(Input →G
:/Text(18,0,"Valeur Décimale ?
:DispGraph
:expr(Input →A ;
:/Text(30,0,"= "
:Text('°A,G
:DispGraph
:Repeat ;Added a space here. Just a single space means it uses the last value
:getkey ;"Repeat getKey" does not change ans
:End
:If =15
:Goto B
:ClrDraw:DispGraph
:Stop
By the way, it looks nice o.o
-
OK, Thanks :)
but
:Repeat ;Added a space here. Just a single space means it uses the last value
:getkey ;"Repeat getKey" does not change ans
:End
Is one byte heavier...
-
Yeah :/ But otherwise, your next line would not work:
If =15
Goto B
-
euh....
yes, it works... That wasn't a problem, it worked fine...
-
If Grammer works the way that xeda had not intended it to do, just understand: Grammer has its own AI.
-
Just try it, you will see... The getkey is stored in Ans, even with my code... It works.
If you press enter, the program restarts, if you press another key, it exits.
-
I think xeda think it didn't works because the slight hold of the key makes it look like it doesn't work.
-
@persalteas: If you press Enter, it is executing again from the homescreen, not relooping. Your code is looking for the [Clear] key.
[clear]=15
[enter]=9
If you want, try to put a Pause 20 in there before the Repeat loop and see what happens ;)
@Yeong: I think it doesn't work because I programmed If, Repeat, and While to not affect Ans :P
-
@persalteas: If you press Enter, it is executing again from the homescreen, not relooping. Your code is looking for the [Clear] key.
[clear]=15
[enter]=9
/me runs far far away and never comes back...
-
Hehe :P 'Tis okay, you are using Return properly, which is great (Return is really fast, by the way, especially compared to using labels).
-
Oh I guess I wasn't reading posts clearly. :\