Private Caller
Private Caller

Reputation: 121

How to stop the on button from breaking a program in TI-BASIC

So I made a TI-BASIC program that fakes the calculator's home screen but gives the wrong answer to math equations on purpose. This is the code:

:ClrHome
:Lbl 1
:Input "",A
:Disp rand
:Goto 1

It works great and all and it's fun to trick friends with it, but I would like to make it more sophisticated. For example:
1) How can I get around the automatic breaking of the program when "ON" is pressed,and
2) Are there any other ways to better fake the home screen (like when someone presses an operation without a number before it, it automatically fakes the 'ANS' variable), and how can I write those in the program.

Thanks in advance.

Upvotes: 3

Views: 1780

Answers (3)

Method 1:

(may or may not be answering your question)

The following website shows how you can use SortA to keep the ON button from working:

http://tibasicdev.wikidot.com/bunny-virus

Using SortA on a 999 element list will keep the calculator busy for a while, and keep the "on" button from working. The coding in the website can be used for jokes, but don't use it for anything destructive, like deleting people's code.

Method 2:

(probably answering your question)

If you want to disable the ON button while the calculator is actually doing something, try putting the following program onto your calculator, and be sure to read the README file:

http://www.ticalc.org/archives/files/fileinfo/330/33039.html

Upvotes: 2

BigSmoke3320
BigSmoke3320

Reputation: 31

There is no possible way to disable the on-break. It is there to prevent amateurs from sending the calculator into an endless loop.

As for the Ans, what I did (although not very realistic) was save the input to str1 and then use

sub(str1,1,1) -> str1
if str2 = "+" or str2 = "/" or str2 = "*" or str2 = "-"
then
expr(str1)
Else
Disp "Cannot begin function with an operation"
end

expr() can be found in the same area that you found the Strings.
Once you perform this operation it is now treated as a number, and not a string, so you are no longer able to use the string commands.

I haven't used TIBASIC in a long time so if there is a syntax error at expr(str1) or it is not showing up, just store it to a Variable and then use Disp <variable> to display the answer.

Also I have found that almost all of the features of TIBASIC can be found here.

Upvotes: 0

Moshe Goldberg
Moshe Goldberg

Reputation: 471

Well to avoid a syntax error by

like when someone presses an operation without a number before it

You can store the input as STR1 instead of A

Upvotes: 2

Related Questions