Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: mdjenkins86 on July 18, 2006, 12:54:00 pm

Title: Undocumented BASIC tricks (TI89 series)
Post by: mdjenkins86 on July 18, 2006, 12:54:00 pm
For the ti-89 BASIC
Don't know if this belongs...delete if not.
Try to Program with out using

c1-->
CODE
ec1Stopc2
ec2

Stop is Evil
Use Return and Break

-------------------------------------------------------

Like I said before to test for HW2, HW3

c1
-->
CODE
ec1if getConfg()[22]>2000000: Text "Titanium"c2
ec2

----------------------------------------------------------
To measure time on HW2 or HW3

c1
-->
CODE
ec1StartTmr()->trm
.....//code
.....//code
getTime()->trm2
Disp "Elapsed Time", timeCnv(trm2-trm)[1] & " Days",timeCnv(trm2-trm)[2] &" Hours", timeCnv(rtrm2-trm)[3] & " Minutes",timeCnv(trm2-trm)[4] & "Seconds"c2
ec2

---------------------------------------------------------------

in 89 Basic you can load strings on top of cells in list and matricies.  This is useful for event programming:

c1
-->
CODE
ec1"This code is in a list"->fl[1]//assumes fl exist as a list var
Text fl[1]c2
ec2

This way you can trim your programs down by storing all dialog into list and matricies.
-----------------------------------------------------------------

to convert getkey() directly to characters

c1
-->
CODE
ec1while a=a
char(getkey())
endwhilec2
ec2
Title: Undocumented BASIC tricks (TI89 series)
Post by: DJ Omnimaga on July 19, 2006, 02:26:00 am
sound cool, we should start another basic optimising/tricks thread for 68k ^^
Title: Undocumented BASIC tricks (TI89 series)
Post by: kalan_vod on July 19, 2006, 11:34:00 am
I think it would be better to seperate the two so others will not get confused XDsmiley.gif, not saying people would >.>
Title: Undocumented BASIC tricks (TI89 series)
Post by: DJ Omnimaga on July 19, 2006, 11:43:00 am
yeha I'll split both I think  
Title: Undocumented BASIC tricks (TI89 series)
Post by: mdjenkins86 on July 25, 2006, 04:04:00 am
to make a magnifing program in basic with flib:
this program also saves the product
Warning this program is very slow, so it is best used for game development, in game execution, except for maybe a pic of 4x4 lol

c1-->
CODE
ec1magnify(picstr,mag)


// this program is for magnifing small pics only not bigger than 40x40
// anything bigger than 40x40 wont fit on the screen when magnified

flib("clrscr","rclscr:"&picstr)
flib("picsize:"&picstr)
fl[1]->w
fl[2]->h
fl*mag->savep
mag->mag2
Title: Undocumented BASIC tricks (TI89 series)
Post by: DJ Omnimaga on July 25, 2006, 04:10:00 am
what does magnifing do?
Title: Undocumented BASIC tricks (TI89 series)
Post by: mdjenkins86 on July 25, 2006, 04:36:00 am
Well, it takes picture 'picstr' and zoom magnifies the picture by a factor of 'mag'.  First the program finds out the hight and width of a picture in pixels.  Then the program scans each pixel to see it is turned on or not.  if so the program draws a rectangle and fills it in black.  If not it draws a rectangle and fills in in white.  the program scans down and across, respectively and updates the progress at the bottom of the screen in real time.  You can also see the image being rendered in real time as well.  after the image is rendered.  The output is saved into a picture file called zp.