Author Topic: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines  (Read 14916 times)

0 Members and 2 Guests are viewing this topic.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« on: October 27, 2010, 05:22:02 pm »
I thought it would be good if we compiled a list of all the awesome BASIC tricks, and optimization stuff.  ;)
so we'd just post, and it would be easy to find hints and other cool stiff to make a more efficient and awesome program. Also, ask if you don't understand a routine.  ;)

So I'll start:

I make this myself, but I think I read this one from ztrumpet somewhere.  ;)

in game subroutines:

Code: [Select]
:Goto 2
:Lbl 1
:<stuff>
:End
:Lbl 2
:While <condition>
:<stuff>
:Goto 1
:End

Greyscale-ish/Wave-ish RPG effect:

This really doesn't have that may uses, but the wave effect looks kinda cool.  ;)

have Shade(-10,10) somewhere in the beginning and noting else in the graph screen, or have people download the pic, then:

Code: [Select]
:For(A,1,40
:DispGraph/RclPic 1, depending on what your doing
:Disp
:End


Thats all I've got for now, but I'm sure you guys will come up with more!  ;)
« Last Edit: January 22, 2011, 04:56:37 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #1 on: October 27, 2010, 05:25:35 pm »
Oho Great, thanks for the shadow info.

BTW, I wish there was a 'goto' function in all programming languages, TI Basic is cool for that :)

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #2 on: October 27, 2010, 05:26:35 pm »
Well, Goto eats memory, whihc is probably why most languages don't have it anymore, or its just now used.  ;)

but doesn't Python have Goto?  or am I confused?

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #3 on: October 27, 2010, 05:27:20 pm »
Well, Goto eats memory, whihc is probably why most languages don't have it anymore, or its just now used.  ;)

but doesn't Python have Goto?  or am I confused?

no, python doesn't have goto... :(

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #4 on: October 27, 2010, 07:14:51 pm »
Pause for an amount of time
Code: [Select]
rand(XX is a number.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







ASHBAD_ALVIN

  • Guest
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #5 on: October 27, 2010, 07:16:25 pm »
that's what was used in that portal game in BASIC on ticalc...

basically, it works by returning a random number between 0-1 X number of times (I believe when x=40 it takes ~= 1 second on a 15 mhz calc)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #6 on: October 27, 2010, 07:22:40 pm »
Thats my Portal game :D And yeah, with rand(#) the # is the length of a List of random numbers to be generated.  More elements means more random numbers means a lot slower :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #7 on: October 28, 2010, 12:50:31 am »
There is also that old thread containing TI-BASIC tricks, but I will not merge it with this one, because it also covers assembly and other stuff, it seems. http://ourl.ca/2627

Plus there is http://web.archive.org/web/20071023204415/omnimaga.org/index.php?showforum=7 as well, but most links might either be slow or not working.

Just thought I would add those to this thread too, in case someone wants to paste them into here or find additional tricks ;)

My favorite tricks are Circle(X,Y,Radius,{i and Text(-1,Y,X,"Stuff. They're well known among experienced coders now that they are documented on TI-BD, but not as much to newer coders, since they were never documented by TI themselves. Note that the i after the { is the imaginary i when pressing 2nd then dot. The first tricks display circles about 4 times faster than normal and the second one displays large fonts on graph screen, useful for dual-layer ASCII graphics. Text(-1 doesn't work with Omnicalc fonts, though.
« Last Edit: October 28, 2010, 12:52:04 am by DJ Omnimaga »

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #8 on: October 29, 2010, 04:51:21 pm »
whoa, why does the Circle one work?

An efficient way to jump without Goto:

Code: [Select]
:Delvar KRepeat K=21
:<stuff>
:Repeat K=21 or K=105
:getkey->K
:End
:End

this is useful for when you want a back and a go on option.  ;)  of course you can replace the keycodes and stuff though.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #9 on: October 29, 2010, 10:34:46 pm »
The fast circles are supposedly less accurate, but I barely notice any difference and if there is, then it's not that bad considering the low 96x64 resolution.  It's an undocumented TI-BASIC trick.

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #10 on: October 29, 2010, 10:39:14 pm »
Yeah, they are pretty nice.
Honestly, I think the fast circles look better when being drawn and when fully drawn compared to the regular circle drawing method.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #11 on: October 29, 2010, 10:52:29 pm »
Well, Goto eats memory, whihc is probably why most languages don't have it anymore, or its just now used.  ;)

There are some programs where you face the choice of either rewriting all of the code or using one goto.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline MRide

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 711
  • Rating: +14/-0
  • You can't see this.
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #12 on: October 29, 2010, 11:11:54 pm »
Or you just get in the practice of writing without them.  Using loops isn't all that difficult.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #13 on: October 30, 2010, 12:15:43 am »
True. Using Gotos is fine in certain situations, though, but I recommend avoiding them as much as possible, especially in large programs.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: TI-83+/84+ (SE) BASIC Tips, Tricks, and Routines
« Reply #14 on: October 30, 2010, 12:28:29 am »
Quote
Or you just get in the practice of writing without them.  Using loops isn't all that difficult.

In the team program, there's a section of code that just can't be done efficiently without a Goto unless a memory leak is acceptable. I looked at that section half a dozen times trying to not use the Goto, but it just doesn't work. Goto occasionally has uses beyond loops.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ