Re: TIB: Re:GetKey


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

Re: TIB: Re:GetKey





On Thu, 3 Dec 1998 18:20:02 EST Tatsuo64@aol.com writes:
>
>	Thanks.  I believe you are right.  The loop to tell if 
>something is in your
>way goes...
>
>:If sub(Str0,E-16,1) =/= " ":Then
>:Goto A
>:Else
>and then the stuff to do if there is a blank space.  

First, remove the 'Then' statement because you don't need it.  You only
need 'Then' if there is >1 command to execute after the 'If'.

 do like this...     :If sub(Str0,E-16,1)==" "
                         :Goto A
              (No END is required)

Do the best you can to make every loop in your program like the one
above.  This is crucial to making the game stay at a constant rate of
execution speed.

If there are times when you just have to use an IF-THEN loop, know that
the END statement does not have to follow directly after the loop.  It
can come after the jump is made to Lbl A, etc.

Once you can keep the speed constant, then you can work on increasing the
overall speed.

Here are 2 hints to increase OVERALL prgm speed:

1.) Make your main loop as small as possible by removing IF's.  
     For example, If your main prgm loop starts with a Getky, and then
checks for about 5 keypresses, and then does some other code if no key
was pressed and then returns to the beginning of the loop for another
Getkey.... Make this loop smaller by just doing this:
       :Getky
       :If Ans>0
       :Goto Keypress
       :...code if no keys pressed....

This will keep the main loop fast.  

2.) In TI-BASIC, I think that when a Goto statement is executed the prgm
goes to the beginning and searches through the entire prgm for the
matching Lbl.  That is why samller prgms with subprgms are faster.  (Even
though we all hate those sub-prgms :-P )
If you've ever played FFX^3 (I think a TI83 BASIC RPG) it was very fast
because the  
author used speed tricks such as tons of sub-prgms!

>I thought the calculator dumped any 
>routine from
>the stack after exiting.

The stack is cleared when you exit the main prgm and return to the TI-OS.

Philip 
------------------------------
pmadsen@juno.com
------------------------------



___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]