Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: ztrumpet on September 22, 2010, 05:00:51 pm

Title: The input Command
Post by: ztrumpet on September 22, 2010, 05:00:51 pm
I've noticed that there are people that don't know how to use the input command, myself included.  Does anyone care to explain how to use input?  Thanks. :)

Quote
input - Prompts for an input string just like BASIC then returns a pointer to the string structure. Don't forget, its a string of tokens, not characters.
Title: Re: The input Command
Post by: LordConiupiter on September 22, 2010, 05:19:03 pm
well, this is how to Disp-lay the inputted text:

Code: [Select]
input->P    .store the pointer to the inputdata to var P
Disp P

you could also check the length or whatever, because the text will be stored to the pointer returned by the input command. I'm not sure where this is exactly, and the last time I heard something about it, Quigibo didn't know it either.

Code: (Axe) [Select]
.check length of inputdata to save screen to appvar with user-defined name:
Lbl IPT
input->P               .get the input for the name
length(P)->L           .get the length of the name
If L > 8               .check the length of the name
Disp "TOO LONG NAME!"
Goto IPT
End
Copy(P,L5+1,8)         .copy the name to L5
Copy("appv",L5,1)      .set the appv token in front of the name
GetCalc(L5,768)->V     .create a new appvar
Copy(L6,V,768)         .copy screen data to appvar

i hope you'll understand it a little more right now, and correct me if I'm wrong (which I don't think, but I know I'm good at making mistakes somtimes :P)
Title: Re: The input Command
Post by: Happybobjr on September 22, 2010, 05:38:39 pm
I think we should make a page devoted only to screenshots of how to do certain commands. such as input.  or displaying b as a number, and other things like that.
Title: Re: The input Command
Post by: LordConiupiter on September 22, 2010, 06:03:36 pm
well, I think this is a very good idea! let's call it the Axe Commands Catalog :P
Title: Re: The input Command
Post by: Quigibo on September 22, 2010, 06:19:33 pm
You should never use copy with only one byte:
Copy("appv",L5,1)

More simply, just do:
E15->{L5}

Which is the actual value of the appv token.
Title: Re: The input Command
Post by: Runer112 on September 22, 2010, 06:49:01 pm
well, this is how to Disp-lay the inputted text:

Code: [Select]
input->P    .store the pointer to the inputdata to var P
Disp P

you could also check the length or whatever, because the text will be stored to the pointer returned by the input command. I'm not sure where this is exactly, and the last time I heard something about it, Quigibo didn't know it either.

Code: (Axe) [Select]
.check length of inputdata to save screen to appvar with user-defined name:
Lbl IPT
input->P               .get the input for the name
length(P)->L           .get the length of the name
If L > 8               .check the length of the name
Disp "TOO LONG NAME!"
Goto IPT
End
Copy(P,L5+1,8)         .copy the name to L5
Copy("appv",L5,1)      .set the appv token in front of the name
GetCalc(L5,768)->V     .create a new appvar
Copy(L6,V,768)         .copy screen data to appvar

i hope you'll understand it a little more right now, and correct me if I'm wrong (which I don't think, but I know I'm good at making mistakes somtimes :P)

The input command is a string of tokens, not characters. For this reason, you shouldn't simply Disp-lay input as in your first example. Additionally, trying to create an appvar with GetCalc() using a string of tokens for the name is bound to have undesirable results if the user enters any non-alphanumeric tokens.
Title: Re: The input Command
Post by: Quigibo on September 22, 2010, 06:55:11 pm
Well, the uppercase characters and numbers luckily have the same token and ascii values (which might be fine for this purpose), but everything else I wouldn't count on.
Title: Re: The input Command
Post by: nemo on September 22, 2010, 06:59:06 pm
i know this isn't an explanation of the input command (i haven't used it very often myself), but here's a snippet of code that may be of interest. it reads a 2-character long string, converts it to a number and stores it into variable A. note that the only values this will work with is 0 - 99.

Code: [Select]
{input}^r->A/256-48*10*(A>255)+(A^256-48)->A
Title: Re: The input Command
Post by: Deep Toaster on September 23, 2010, 02:30:27 pm
Just wondering: Where does the input command store to?
Title: Re: The input Command
Post by: kindermoumoute on September 23, 2010, 04:06:15 pm
 I found a method:
Code: [Select]
:"Str1"=>Str1
:input=>A //now you can disp A everywhere
:lenght(A)=>L
:If L<9
:GetCalc(Str1,8)=>T
:Copy(L5,T,8)
:Archive Str1
:End

Why archive? Because always program crash attend the end (only at the end !)

So we can use input command.
Title: Re: The input Command
Post by: alberthrocks on September 25, 2010, 09:18:35 am
The input command for me corrupts everything. :P
Junk output shows up if I ever use it... :(
Title: Re: The input Command
Post by: Camdenmil on September 26, 2010, 10:07:25 pm
When I use the Input command on 2.43, it works as I expected. When I use it on 2.53, the cursor scrolls vertically and when I press enter, it crashes. Is there something we're supposed to do before input in 2.53?
Title: Re: The input Command
Post by: calc84maniac on September 26, 2010, 10:11:38 pm
The cursor scrolling vertically sounds like the cursor is located outside the bounds of the screen. Did you try putting ClrHome before Input?
Title: Re: The input Command
Post by: Camdenmil on September 26, 2010, 10:26:38 pm
Now it displays some tokens before the cursor, and I can use input but the tokens stay there. It doesn't crash though.
Title: Re: The input Command
Post by: calcdude84se on September 26, 2010, 10:27:44 pm
Now it displays some tokens before the cursor, and I can use input but the tokens stay there. It doesn't crash though.
Quigibo is working on this; I've had the same problem.
Title: Re: The input Command
Post by: Happybobjr on October 18, 2010, 12:04:08 pm
When I use the Input command on 2.43, it works as I expected. When I use it on 2.53, the cursor scrolls vertically and when I press enter, it crashes. Is there something we're supposed to do before input in 2.53?

solution: change from mathprint to classic in options.
Title: Re: The input Command
Post by: Deep Toaster on October 18, 2010, 06:37:17 pm
When I use the Input command on 2.43, it works as I expected. When I use it on 2.53, the cursor scrolls vertically and when I press enter, it crashes. Is there something we're supposed to do before input in 2.53?

solution: change from mathprint to classic in options.

Sounds like the problem is already fixed:

Now it displays some tokens before the cursor, and I can use input but the tokens stay there. It doesn't crash though.

Anyway, bump:

Just wondering: Where does the input command store to?