Difference between revisions of "TI-BASIC:SK:Homescreen"

From Learn @ Cemetech
Jump to navigationJump to search
(Automated internal link correction)
(Automated internal link correction)
Line 44: Line 44:
  
 
{{Template:TI-BASIC:Next-prev
 
{{Template:TI-BASIC:Next-prev
|prevpage = sk:guessing-game
+
|prevpage = TI-BASIC:SK:Guessing-game
 
|prevtitle = Sample Program: Guessing Game
 
|prevtitle = Sample Program: Guessing Game
|tocpage = starter-kit
+
|tocpage = TI-BASIC:Starter_Kit
 
|toctitle = Table of Contents
 
|toctitle = Table of Contents
|nextpage = sk:getkey
+
|nextpage = TI-BASIC:SK:Getkey
 
|nexttitle = Using getKey}}[[Category:TI-BASIC]]
 
|nexttitle = Using getKey}}[[Category:TI-BASIC]]
 
[[Category:TIBD]]
 
[[Category:TIBD]]

Revision as of 00:47, 25 February 2016

Whee! You got through the first part of the starter kit! Now, we come to the second part, which will get into the finer points of the homescreen and data types. We will start off the second part of the kit by discussing more of the homescreen. Let's begin, shall we?

Letting the User See Something

Back in the first part, you only learned of one command that can display information, the Disp command. We will learn two more commands that deal with output, starting with the ClrHome command.

ClrHome

The ClrHome command clears the homescreen, giving you an empty space to work with. No arguments are needed, just select it from the I/O menu of the PRGM button (only accessible this way while editing).

Two Notes

  1. Output( will write over anything on the homescreen
  2. Disp, Input, and Prompt will not recognize Output( commands, so if you have some text printed at 1,1 and then use Input, you will write over the Output(

Output

The Output( command lets you print text, just like the Disp command. There are two differences, though: You can choose where to start the text, and it word wraps! To use it, you need three arguments: the row where the first character appears, the column, and the text. You use it like so:

:Output(8,1,"PRESS ENTER")

This text starts at the bottom-left corner of the screen, and prints PRESS ENTER. The most useful application for Output is to have dynamic update of the home screen. If you had money in the top left corner and life in the bottom left for a game, using Disp to update those would be a pain. You would have the un-updated text blink, because you had to ClrHome first. Output allows you to avoid the flicker.

Making the Program Smart

In the past, you only knew of the Input command for input. Now we will cover two more input methods, the first being Prompt.

Prompt

Prompt is a much more primitive command than Input, but it gets the job done. It only needs one argument: the variable. You can add more variables to one Prompt statement, as long as they are separated by commas. Here is a basic use:

Prompt A

The code will show A=?, which means, "What do you want A to equal?". Prompt has limitations, and quality programs are unlikely to use it because the A=? thing doesn't look very professional. The limitations are outlined below:

  • Cryptic - Prompt doesn't allow custom text to be displayed, unlike Input. The casual calculator user can be intimated by the cryptic look that is forced.
  • No Exception - If you want someone to enter a string using Prompt, the user must put quotation marks around the string or risk error. Input doesn't care.

Final Notes

These are the last of the commands that can directly influence the home screen. The furthest from direct influence is getKey, which you will discover in detail in the next lesson. More on the commands you just learned can be found on their respective pages. Try searching for them in the upper right hand corner of the site! Hopefully you can use the homescreen commands well. Next up we explore the hidden elements of input: data types, and the getKey command.

<< Sample Program: Guessing Game Table of Contents Using getKey >>