[TI BASIC] Optimizing
Moderator: MaxCoderz Staff
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
Hey, I was wondering what the fastest GetKey routine would be? I use
:DelVar A
:Repeat A(not equal)0
:GetKey->A
:End
:If A=21
:do this
:if A=31
:do this
and this is really slow. I'll post some more bits of code i need optimized. Thanks in advance!
:DelVar A
:Repeat A(not equal)0
:GetKey->A
:End
:If A=21
:do this
:if A=31
:do this
and this is really slow. I'll post some more bits of code i need optimized. Thanks in advance!
Truly great madness cannot be achieved without significant intelligence.
http://www.xanga.com/jakku_kun, rants by me.
http://www.xanga.com/jakku_kun, rants by me.
-
- Calc Wizard
- Posts: 526
- Joined: Tue 08 Mar, 2005 1:37 am
- Location: who wants to know?
- Contact:
Repeat Ans
getKey->A
End
If A=21:Then
...
End
If A=31:Then
...
End
if you only need the key once and don't have to save the keypress:
Repeat Ans
getKey
End
If Ans=21:Then
..2nd pressed...
Else
..other keys pressed..
End
if you don't need the key at all and just want to wait for any key:
Repeat getKey
End
getKey->A
End
If A=21:Then
...
End
If A=31:Then
...
End
if you only need the key once and don't have to save the keypress:
Repeat Ans
getKey
End
If Ans=21:Then
..2nd pressed...
Else
..other keys pressed..
End
if you don't need the key at all and just want to wait for any key:
Repeat getKey
End
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
Thanks a lot, every little bit helps. is there a faster way than:
Repeat Ans
GetKey
End
If Ans=24
Y-1->Y
If Ans=25
X-1->X
If Ans=26
Y+1->Y
If Ans=34
X+1->X
I seem to recall someone mentioning a faster way, but if not, oh well.
Repeat Ans
GetKey
End
If Ans=24
Y-1->Y
If Ans=25
X-1->X
If Ans=26
Y+1->Y
If Ans=34
X+1->X
I seem to recall someone mentioning a faster way, but if not, oh well.
Truly great madness cannot be achieved without significant intelligence.
http://www.xanga.com/jakku_kun, rants by me.
http://www.xanga.com/jakku_kun, rants by me.
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
That works, but only the Y one works. The X one doesnt do anything. But other than that, very speedy.kalan_vod wrote:Repeat Ans
GetKey
End
Y+(Ans=26)-(Ans=24->Y
X+(Ans=34)-(Ans=25->X
Truly great madness cannot be achieved without significant intelligence.
http://www.xanga.com/jakku_kun, rants by me.
http://www.xanga.com/jakku_kun, rants by me.
Ans is fucked up by the Y statement... you will need to store the getkey value somewhere I'm affraid...
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
No worries, it'll only slow it down a tad bit, if that. And true, minus one variable, but i never use many variables, unless im working on something big. this is just to satisfy boredom. May go big, but doubt it
Truly great madness cannot be achieved without significant intelligence.
http://www.xanga.com/jakku_kun, rants by me.
http://www.xanga.com/jakku_kun, rants by me.
- dysfunction
- Calc Master
- Posts: 1454
- Joined: Wed 22 Dec, 2004 3:07 am
- Location: Through the Aura
Yes, I had that too... And Q also has some problems; I managed to reset my calc with a basic program getting input in Q once
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
This happens with Y and X, when in Func mode. If you put the calc in another mode I believe this cause problems with other variables like theta, R and P or something, basically all real veriables that cannot be archived. The only way to prevent this is to cleardraw at the beginning of your program, use the Disp command followed with a Dispgraph and every time you need to clear the screen BCALL ClrLCDFull using Omnicalc execasm function or use an Asm lib to clear the screen