Author Topic: How to get a string as input in Axe?  (Read 5695 times)

0 Members and 1 Guest are viewing this topic.

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
How to get a string as input in Axe?
« on: January 14, 2013, 04:40:56 pm »
I have been looking at the docs and needed to get a string as input. However I couldn't find a way to do so.  Is there an easy way to get a whole string as the input in Axe? say the user inputs 8*7+6-5, I want all of that to be stored in Str0. How can I do this? (An Axiom is Fine)

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: How to get a string as input in Axe?
« Reply #1 on: January 14, 2013, 04:56:14 pm »
I don't believe that there's any way to easily do that with axe.
I don't know about axioms, though

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: How to get a string as input in Axe?
« Reply #2 on: January 14, 2013, 05:07:01 pm »
Here's a program ztrumpet made a while ago. It may or may not be what you are looking for, but it can be easily modified to fit your needs I think. :)

http://ourl.ca/4129/122465

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to get a string as input in Axe?
« Reply #3 on: January 14, 2013, 06:27:39 pm »
Sweet, Thanks for the link, does it work on numbers? And symbols like pi, e etc?

Here's a pastebin btw: http://pastebin.com/VMrzDVQN

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: How to get a string as input in Axe?
« Reply #4 on: January 14, 2013, 06:27:44 pm »
if you mean input to a string as in the OS variable, that is very possible. if you mean Str0 as it is used within Axe itself, that is not. Str0-9, Gdb0-9, and Pic0-9, as used in Axe, are not data structures that can be modified during runtime. rather, they are just pointers to locations in your program where data structures can be inserted at compile time. if you want to store temporary data, you need to either use one of the free ram areas or store it in an OS variable. for an in-depth explanation of exactly HOW to get that data from the keys and into your storage space, see the discussion that begins here.

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to get a string as input in Axe?
« Reply #5 on: January 14, 2013, 06:32:59 pm »
Essentially I mean I get a set of input from the user, put in a as a variable or "string" and do my manipulations in the program, and then when program exits it gets erased.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: How to get a string as input in Axe?
« Reply #6 on: January 14, 2013, 06:36:16 pm »
alrighty, then you'll have to manually interpret the key presses and dynamically display the current contents of the string as the user inputs his desired values. see the link i pasted above for more details.

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: How to get a string as input in Axe?
« Reply #7 on: January 14, 2013, 08:15:13 pm »
You can get string input using the Axe input command and then convert it to ASCII using the  Detokenize Axiom. The detokenize command is a bit large (about 115 bytes), but still smaller than a sophisticated input routine.
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to get a string as input in Axe?
« Reply #8 on: January 15, 2013, 03:32:59 pm »
Sweet, thats pretty much perfect :D Thanks.

Edit: Question? Will the input routine return stuff such as say a () or [] or maybe pi, e and so on?
« Last Edit: January 15, 2013, 03:48:12 pm by Link »

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: How to get a string as input in Axe?
« Reply #9 on: January 15, 2013, 04:13:11 pm »
Axe's input lets the user enter any token. The user can get tokens from the Catalog, and they can even use 2nd+Rcl to recall strings.
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to get a string as input in Axe?
« Reply #10 on: January 15, 2013, 04:26:32 pm »
But how do I use it? I called up #Axiom(DETOKENI) and then tried to run it with: Detokenize(K,Str0,768) but it says the command is undefined?

Never-mind, found the token, was typing in letters :p
« Last Edit: January 15, 2013, 04:39:18 pm by Link »

Offline Link

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 152
  • Rating: +7/-3
  • Well excuse me princess!
    • View Profile
Re: How to get a string as input in Axe?
« Reply #11 on: January 15, 2013, 07:08:42 pm »
Okay, Question, How do I use this in a loop?

Code: [Select]
input->K
Detokenize(K,L1,768)
Disp L1
I tried to get in a loop with a goto and label, but that kept crashing after one iteration, how do I go to the next start of the loop and get new input (on a new line after output) over and over again?

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: How to get a string as input in Axe?
« Reply #12 on: January 15, 2013, 11:09:34 pm »
You shouldn't have any problem putting that in a loop. It's probably an issue with pointers or memory; for example, you might have code that depends on previous results which have been overwritten. It might be helpful for us to see the code you're trying. Perhaps we can spot a mistake.

(I'm not ruling out a bug in the Axiom, but if there is a bug, I need to know how to reproduce it.)
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC