Re: TIB: Basic '86- My Mistake (and another problem yet..)


[Prev][Next][Index][Thread]

Re: TIB: Basic '86- My Mistake (and another problem yet..)




I'm sorry... I just can't help myself...

You've got a bunch of extra stuff in the program that you can get rid of

--Want to turn the Y= functions off so there's no functions being
drawn on the screen? Add FnOff at the beginning. And FnOn at the end
if you feel like it.
--Get rid of the DispG's, when you draw the graph will automatically
be displayed.
--Get rid of the Stop at the end, it will do it on it's own at the end
of the program.
--Get rid of the first Then, you only need to use that if there is
more than one line of code you want to happen. Also get rid of the End
that goes with the first Then. If you don't say Then after an If, the
TI-86 will treat the first line of code after the If as the Then
command.
--Get rid of the Else command, you don't need it because it will do
that afterwards anyway. Isolate the Goto ABC's into one command.
--It might be nice to delete YM and YX at the end.
--You don't need any of the end parentheses on your commands

Lbl NonsensicalFantasyProg
If new program==old program
Then
Change old program(store to)new program
Else
DispInEmail new program
End

:ClLCD
:ClDrw
:FnOff
:45(storeto)Y
:yMin(storeto)YM
:yMax(storeto)YX
:-6(storeto)yMin
:6(storeto)yMax
:Line(-5,-5,-5,5
:Line(-5,5,5,5
:Line(5,5,5,-5
:Line(5,-5,-5,-5
:Text(30,Y,"@"
:Lbl ABC
:getKy(storeto)A
:If A==22
:Goto OFF
:If A==26
:Then
:Text(30,Y," "
:Y+5(storeto)X
:X(storeto)Y
:DelVar(X
:Text(30,Y,"@"
:End
:Goto ABC
:Lbl OFF
:ClDrw
:FnOn
:YM(storeto)yMin
:YX(storeto)yMax
:DelVar(YM
:DelVar(YX

Actually, I prefer another way of doing getKy any time. If you do it
that way then it would look like this:

:Lbl ABC
:Repeat A==22 or A==26
:getKy(store to)A
:End
:If A==22
:Then
:Goto OFF
:Else
:Text(30,Y," "
:Y+5(storeto)X
:X(storeto)Y
:DelVar(X
:Text(30,Y,"@"
:Goto ABC
:End
:Lbl Off

You see, that way, the loop is much smaller so you will get a faster
response time once the key is pressed, for one thing. And the
calculator will keep repeating the command getKy(store to)A until A
equals either of the keys that you want. For other programs, you can
add other keys, or change it to

:Repeat A(does not equal)0
:getKy(store to)A
:End

I use that routine in all of my programs where most people would use
Pause. It will continue the program once you press any key (except ON,
of course...). But back to your program. Once one of the two keys that
you want is pressed once, the routine is exited. Then the program sees
if the key that was pressed was 22. If it was, then it goes to OFF. If
it sees that A does NOT equal 22, then A must equal 26 since
getKy(store to)A was repeated until A equaled one of those two
numbers. Since A equals 26, then right was pressed and it executes the
commands associated with pressing the right key. Then it goes back to
the Repeat routine.
   Hope this helps you understand BASIC a little better. And sorry if
I rambled. I'm good at that. Or bad, depending on the way you look at
it. Oops, there I go again :-).




---Nick Clark <roachnik@home.com> wrote:
>
> 
> Thanks for your help find that bug so obvious I'd never had noticed
> it(I'm not kidding. I never see things like that..). That was just a
> little qwirk, but now, I ran into a slightly different problem. What's
> wrong with this code? I tried it, but it doesn't do anything at all
when
> I press right or exit. What gives?
> 
> :ClLCD
> :ClDrw
> :45(storeto)Y
> :yMin(storeto)YM
> :yMax(storeto)YX
> :-6(storeto)yMin
> :6(storeto)yMax
> :DispG
> :Line(-5,-5,-5,5)
> :Line(-5,5,5,5)
> :Line(5,5,5,-5)
> :Line(5,-5,-5,-5)
> :Text(30,Y,"@")
> :DispG
> :getKy(storeto)A
> :Lbl ABC
> :If A==22
> :Then
> :Goto OFF
> :End
> :If A==26
> :Then
> :Text(30,Y," ")
> :Y+5(storeto)X
> :X(storeto)Y
> :DelVar(X)
> :Text(30,Y,"@")
> :Goto ABC
> :Else
> :Goto ABC
> :Lbl OFF
> :ClDrw
> :YM(storeto)yMin
> :YX(storeto)yMax
> :Stop



==
Da Cajun Cheetah
Cajun_Cheetah@yahoo.com
<=======--------------=======>
I live in da Big Easy!
Laissez les bon temps roulez à Franklin!
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com