3

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.

Private Caller
  • 121
  • 1
  • 5
  • 2
    1) There is no way to prevent ON breaking the program in pure TI-BASIC. You'll need to use an assembly program, which isn't as easy to program in. – lirtosiast Jul 05 '15 at 19:52
  • 2) There is no practical way to insert an Ans before the operation in TI-BASIC. – lirtosiast Jul 05 '15 at 19:57
  • What about a semi-complex getkey operation – Moshe Goldberg Jul 05 '15 at 20:00
  • @ThomasKwa is there a way to find the index of a string? If so then you can use getkey if there is nothing before the operation and disp 'ANS' – Moshe Goldberg Jul 05 '15 at 20:02
  • @JediPythonClone There's inString(, but that's very hackish—and it won't work because Ans is normally displayed right as the operation is typed, not after ENTER is pressed. Since you can't do getKey and Input at the same time, you'll need to display every token entered manually. – lirtosiast Jul 05 '15 at 20:28
  • @ThomasKwa in the beginning you can use getkey to intercept the first key pressed and if it is a operant disp ANS before it – Moshe Goldberg Jul 05 '15 at 20:32
  • @JediPythonClone Yes, but then you can't use Input to input the string. – lirtosiast Jul 05 '15 at 20:37
  • @ThomasKwa only purpose of input is to fake the home screen, you can do that with getkey, no? – Private Caller Jul 05 '15 at 20:39
  • @PrivateCaller You can use getKey, but you'll need to track a whole bunch of things manually: all of the different tokens that can be entered, the arrow keys, displaying the menus like MATH, the 2nd and ALPHA keys, etc. It's too much to do in TI-BASIC, and even if you could it would be the wrong way. Assembly is the only practical way. – lirtosiast Jul 05 '15 at 20:42
  • @ThomasKwa yes but the whole purpose is a prank on ti-basic so u can't use assembly – Private Caller Jul 05 '15 at 20:51
  • @PrivateCaller Then your request is essentially impossible. – lirtosiast Jul 05 '15 at 20:54
  • @True but during math class I now have something to think about. I'll eventually think of something – Private Caller Jul 05 '15 at 20:56
  • I use that same program, it's hilarious! – Douglas - 15 year old Pythoner Jan 11 '16 at 20:31

3 Answers3

2

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

Moshe Goldberg
  • 461
  • 2
  • 15
2

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

0

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.