Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: meishe91 on March 26, 2010, 09:18:59 pm
-
So I'm trying to make a change to one of my convertion programs. I used "Y" to store the value of the y-axis starting point but when I enter it into a For( loop it for some reason resets to zero...I have no idea why this is happening. I can post the code if need be. (By the way, I changed "Y" to "C" and it seemed to work fine...so it is "Y")
-
Y is used by the OS ussually to store the Y position for things like "Input". I believe it is also reset by "ClrDraw". I would recomend not using Y for anything unless you aren't using the graph screen.
-
What graph screen commands are you using?
-
Well here is the code for it. From what _player said I don't see anything that would reset it. I'm just using pxl-Test( though.
This code is the faulty code:
"_→Str1
ClrHome
ClrDraw
AxesOff
FnOff
Prompt X,Y,W,H
Recall 1
For(A,Y,H-1+Y
For(B,X,W-1+X
Str1+sub(" Θ",1+pxl-Test(A,B),1→Str1
End
End
sub(Str1,2,WH→Str1
This code works:
"_→Str1
ClrHome
ClrDraw
AxesOff
FnOff
Prompt X,Y,W,H
Y→C
Recall 1
For(A,C,H-1+C
For(B,X,W-1+X
Str1+sub(" Θ",1+pxl-Test(A,B),1→Str1
End
End
sub(Str1,2,WH→Str1
-
yeah Y has issues being reset by some graph commands. I think it's a TI-OS glitch. Very annoying when you don't know it, during debugging. I learned the hard way.
The solution is to never use Y altogether unless you never use the graph screen commands
-
Ah ok. Well makes sense and yes it is quite annoying :P
By the way, DJ, is that the kind of effect you were looking for? (Try the second code)
-
yep it appears to be so ^^
Nice
-
Ok, sweet :)