Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: meishe91 on March 26, 2010, 09:18:59 pm

Title: Glitches with the "Y" variable?
Post 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")
Title: Re: Glitches with the "Y" variable?
Post by: _player1537 on March 26, 2010, 09:20:41 pm
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. 
Title: Re: Glitches with the "Y" variable?
Post by: Eeems on March 26, 2010, 09:22:48 pm
What graph screen commands are you using?
Title: Re: Glitches with the "Y" variable?
Post by: meishe91 on March 26, 2010, 09:30:13 pm
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.

Code: [Select]
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
Title: Re: Glitches with the "Y" variable?
Post by: DJ Omnimaga on March 26, 2010, 09:41:31 pm
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
Title: Re: Glitches with the "Y" variable?
Post by: meishe91 on March 26, 2010, 09:45:13 pm
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)
Title: Re: Glitches with the "Y" variable?
Post by: DJ Omnimaga on March 26, 2010, 09:54:02 pm
yep it appears to be so ^^

Nice
Title: Re: Glitches with the "Y" variable?
Post by: meishe91 on March 26, 2010, 10:04:51 pm
Ok, sweet :)