How does one assign user-input to an indexed text variable?

I am trying to take some user input such as, “Decode qrytzh” and assign the “qrytzh” portion to an indexed text variable.
Can anyone provide a code snippet to show how this is done?

Inform7 sees “qrytzh” as being an object and not something one can use to set the value of an indexed text variable.
The assignment to an indexed text variable is needed, since I will be parsing the input string “qrytzh” in order to decode each character.

I think the easiest way to do this would be by running whatever indexed text operations you desire on the “player’s command” variable – which is, I think, already indexed text? The relevant part of the manual is section 17.31.

So something like:

After reading a command: if the player's command includes "decode ": now my-indexed-text is player's command.
and then you can cut "decode " away from my-indexed-text and you’ll be left with the phrase you want. (This is untested code, but I believe the basic principle is right.)

If decoding is an action that applies to a topic, you can use “topic understood”.

[code]
Decoding is an action applying to one topic.

Understand “decode [text]” as decoding.

Carry out decoding:
let message be indexed text;
let message be topic understood;
say message in upper case.[/code]

I probably wouldn’t have written a decoder per se. I would probably have just changed the item’s printed name to the decoded text, as if a key opening a door.

I really appreciate everyones help.
I’ll be feeding the characters into the actual decoding or encoding algorithm one-by-one, so I need to be able to access each character individually.

The following seems to work in the way I need it to:
(Somehow the indentations for the Carry out… and repeat… are swallowed up by the webpage, but they are in my running code)

and yields:

By the way, It was mentioned that renaming would work.
Could that be explained a bit more?
It sounds interesting and I’m always open to new ideas.

David;

I think I understand what you were suggesting and appreciate your reply.
This occurred to me, but would only work for decoding.
This is because the author knows the plain-text that results from the cipher-text.

As part of the story, I may also have to encode an arbitrary message.
This could not be done the same way, since the author won’t know the encoded result of what the user has typed.

Why would I want to do that? Well that is a long story…
Suffice to say that I’m writing an IF adventure for geocaching and the group likes to play devious little tricks on each other in some of the puzzles we write.

And, I also wanted to learn a bit more about Inform7 indexed text by trying to write the code.
I actually think I’m starting to see how the language hangs together, but to really understand it will still take some time.

To preserve the tabs in your code, paste them into a “code” block rather than a “quote” block.

Every turn: say "If you pasted this into a code block, you'll be able to see the tabs."; say "If you pasted this into a quote block, you won't."

Thanks for the tip on posting the code. I’ll use the code block in future.

I should also mention another reason for not simply using an assignment to simulate decoding.
Doing so would mean that the plaintext would be stored in the code and decompiling would make it possible to crack the code without solving the puzzle.
By writing a decode routine, there is no way to determine the plaintext except by using the key or cracking the code.

This is true of 98% of all IF puzzles. I wouldn’t get too worked up about it.