Converting Text to Numbers

I have an extension that can accept and generate seeds, which are strings of characters.
I’m parsing the text character by character, and need to convert these characters to numbers (0-9).
Failing to find an effective phrase in the rulebook, I resorted to using this:

To decide what number is (input - text) understood as a number:
	if the input exactly matches the text "0":
		decide on 0;
	if the input exactly matches the text "1":
		decide on 1;
	if the input exactly matches the text "2":
		decide on 2;
	if the input exactly matches the text "3":
		decide on 3;
	if the input exactly matches the text "4":
		decide on 4;
	if the input exactly matches the text "5":
		decide on 5;
	if the input exactly matches the text "6":
		decide on 6;
	if the input exactly matches the text "7":
		decide on 7;
	if the input exactly matches the text "8":
		decide on 8;
	if the input exactly matches the text "9":
		decide on 9;

let N be "202" understood as a number.

Does this functionality already exist? I scanned through the documentation, checked Google, and skimmed a few pages deep on here, but couldn’t find an answer.

I think what I’d do would be to save the player’s command, then “change the text of the player’s command” to your number, then use the standard number-parsing, then put the original command back.

Thank you for the suggestion. I might end up doing something like that.

I tried doing that for fun, but discovered I have absolutely no idea how to invoke parsing on an extant command.

This is what I’ve got, though I don’t know if it’s what Draconis had in mind.

[code]Lab is a room.

To decide what number is (input - text) understood as a number:
let reserve text be the substituted form of “[the player’s command]”;
change the text of the player’s command to input;
if the player’s command matches “[number]”:
change the text of the player’s command to reserve text;
decide on the number understood;
change the text of the player’s command to reserve text;
decide on -99.

When play begins:
say “29” understood as a number;
say line break;
say “bibbity bo” understood as a number;
say line break;
say “twelve” understood as a number;
say line break;
say “3” understood as a number;
say line break;
say “12 monkeys” understood as a number.[/code]

Basically that, yes! Note that this will clobber the “value understood” variable, so be careful if you were using that for anything.

I was going to suggest something with the I6 TryNumber routine, but a peek at Parser.i6t revealed that the [number] parser is actually better than TryNumber is, so your solution will have better results.

Simple and elegant.