Collecting age

I’m uh… a bit stuck.

What I want to do is have character creation at the start of the game, right?

Well, how do I collect age?

it’s a number.

it can’t contain text.

it’s gotta freak out if it’s too young or too old (i’m not having a ten-year-old run loose in my story! they’ll get hurt! by me! in the face!).

And I don’t know how to get it to work. :frowning:

[code] now the command prompt is "How old are you? > ";
reject the player’s command;
otherwise:
reject the player’s command.

To decide whether collecting age:
if the command prompt is "How old are you? > ", yes;
no.

After reading a command when collecting age:
if the player’s command is a number:
now the age of the player is the player’s command;
if the age of the player is not a number:
say “Very funny. Now then… [run paragraph on]”;
reject the player’s command;
clear the screen;
say line break;[/code]

Any help on how to do that?

It won’t let me use “is a number” or “contains a number” or “number value” or any combination (unless i’ve magically skipped any of those in my many attempts) and it freaks out on these points:

aaaaaaaaaaand i just realized i could input numbers as name and gender but only gender freaks out because that’s gotta be one of the listed options.
so i’ll need a solution to this PLEASE SOMEONE HELP :c how do i check for text or numbers?!

You’re mostly heading in the right direction. Example #282 “Sweeney” might be useful to you, especially this part:

Understand "[number]" as selecting. 

Selecting is an action applying to one number. 

Carry out selecting: 
    say "No such option is available." 

Instead of selecting...

To get a little fancier, you might also check out section 17.17 ‘Understanding when’ to properly confine this to the age-asking.

Cheers,
Roger

thanks for replying. I’ll check those out.

also, it occured to me that i’m saying

Age is a number that varies.

but shouldn’t i have a sort of “every person has an age.” but the system refuses that sentence…

ooh something’s moving!

a person has a number called age.

it’s compiling now…

…but it’s not letting me input an age and put it in ‘age’.

sheeeeeet.

i also have no idea how that’s supposed to help, or what [code]Understand “[number]” as selecting.

Selecting is an action applying to one number.

Carry out selecting:
say “No such option is available.” [/code] is supposed to do.

figured it out and it seems to be working so far! thanks!

I’ve been trying to do something similar with a combination lock where the player enters a number to continue using the same Inform example to do it, but no luck. If you could just get it to accept “a number between X and Y” as an input you would be done, I think.

Off the top of my head:

Age is a kind of number that varies.

Every person has an age.

Check out Recipe Book 9.2 example 298.

[code]Spinning it to is an action applying to one thing and one number. Check spinning it to: if the noun is not the Safe, say “[The noun] does not spin.” instead. Report spinning it to: say “Click! and nothing else happens.”
Understand “spin [something] to [a number]” as spinning it to.

Check spinning it to:
if the number understood is greater than 300…[/code]

that wouldn’t take with me for some reason, i had to use A person has a number called age. or else it’d tell me to do unspeakable things to close relatives.
[rant]like taking them to the park. I hate going to the park. ****ing ducks always quacking for bread. all those ducks should get a job. pay for their own bread. /joke[/rant]

Thanks.

Hey WesLesley, just out of curiosity, how did you solve it?

send me a PM and ask me for the code - i’m forgetful so… yeah.

i’ll PM you all the code. i can’t PM you my understanding of it because it has holes in it. i don’t know why some parts of my code work, i just know that the result does what i wanted it to do.

Thanks. :~)

did you get it?

was it salvagable?

useful at all?

Yes, thanks. :~) It works great now that the ‘understand’ command has been fixed.