age limit!

it’s me again.

After reading a command when collecting age: if the player's command includes "[number]": now the age of the player is the number understood; if the age of the player is greater than 18: now the player has a blaster; clear the screen; ...

I’m trying to give the player a gun but only if they’re a certain age or above.

But it’s giving me a bad time. :frowning:

i’ve tried variations of the and a blaster, and carries, is carrying, has, picks up, … :frowning: none do what i expect.

Is there more than one blaster? If so, you may need to say something like “Now the player carries a random blaster.” (if it doesn’t matter to you which one in the game world the player gets. If it does, you’ll have to be more specific.)

Edited (again) to remove the bit about has/carries/wears. It looks as though if you say “has”, Inform will assume you mean “carries.”

…and if there is more than one blaster, try “a random blaster” or “a random off-stage blaster.” (I think that “a blaster” works if there’s only one.)

Oops, edited before I saw matt w’s post. What he said.

it compiles, but it errors out with this:

:c


clarification:

there can be more than one blaster but i don’t see a need for more than one.

If you use “offstage” you’ll need to ensure that there’s actually a blaster offstage when this runs.

… what is “offstage”? o.o and am I using it?

In the part of the code where you create the blaster, where do you say it is? If you don’t specify (if you just say “There is a blaster”) or if you say “The blaster is nowhere,” that should put it offstage.

Although if there is only one blaster, I don’t know why the “random” or “offstage” part should be necessary. In that case I’d think “The player carries the blaster” should work. So I’m a bit confused.

If you’re still having trouble, I’d suggest posting the code where you create the blaster.

i got it to work… I don’t know how or why. O.O

OK, so “off-stage” (or “offstage,” I never can remember) is what applies to anything that’s out of play–not in any room.

The error you got is what you get if you say “a random foo” and there is no foo. So if you just wrote “A blaster is a kind of thing” and then “a random blaster” you’d get that error, because you didn’t make any blasters. Or if you wrote “A blaster is a kind of thing” and then “There is a blaster in the Lab” and “There is a blaster in the Armory” then “a random off-stage blaster” would probably give you that error, since you didn’t create any off-stage blasters. As bg said, if you say “There is a blaster” or “There are five blasters” then all the blasters will be created off-stage (they’ll exist but they won’t be any room).

If there’s only going to be one blaster in the game, though, you don’t need to say “a blaster is a kind of thing”–just say “There is a blaster” and it’ll create one blaster (off-stage, since you didn’t say what room it’s in).

Hey Wes, I’ve found a problem with your script that could be dicy. Once you specify that the game is collecting a number like that, the game is always waiting for you to say a number. Any number. For example:

[code]collecting ages is an action applying to one number.

To decide whether collecting ages:
if the command prompt is "Age > ", yes;
no.

Understand “[number]” as collecting ages.

Check collecting ages:
if the number understood is greater than 99:
say “[paragraph break]The maximum age is 99.”;
reject the player’s command;
otherwise if the number understood is less than 18:
say “[paragraph break]The minimum age is 18.”;
reject the player’s command;

Carry out collecting ages:
Now the Age of the player is the number understood;
now the command prompt is “>”;
start a conversation with Start_Choose;
reject the player’s command;

Instead of looking when collecting ages: do nothing.
Rule for printing the banner text when collecting ages: do nothing.
Rule for constructing the status line when collecting ages: do nothing.
[/code]

I tried to implement this script in one of my games, and I ended up making it so that the character generation script resumed any time you typed a number, and if you type nonsence text like ‘fssghff’ it says “I didn’t understand that number.”.

That’s because this understand line:

Understand "number" as collecting ages.

is still in there, so when the player types a number it runs the collecting ages action, and when the player types something that isn’t a verb Inform tries to match it to the [number] token and issues an error as if it were a number.

You can take care of it like this:

Understand "[number]" as collecting ages when collecting ages.

(This is a bit confusing because the phrase “collecting ages” is getting used twice in different ways, but “when collecting ages” refers to the “to decide whether collecting ages” phrase. It might be a good idea to change that so they don’t have the same name.)

Anyway, this cuts off the possibility of understanding a plain number as an age unless the game is actually prompting you for an age.

Another possibility would be to write a check rule for collecting ages that cuts off the action unless it’s time to collect ages, and to change the error message that gets printed so it doesn’t say “number.”

Oh cool, I didn’t know you could do that! Thanks!

it worked before, now it’s not, using your code D:

[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.

Understand “[number]” as collecting age when collecting age.

Selecting is an action applying to one number.

Carry out selecting:
say “No such option is available.”

There is a blaster.

After reading a command when collecting age:
if the player’s command includes “[number]”:
now the age of the player is the number understood;
if the age of the player is greater than 17:
now the player carries a random blaster;
clear the screen;
say line break;
say line break;[/code]

Help! D:

also, i’m not sure what the original problem would have been?

also,

download (34).jpg

wait a freaking moment that’s not my code! here’s my code!

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

Understand “[number]” as selecting.

Selecting is an action applying to one number.

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

There. mine works. no issues there. not always looking for numbers.

Wes: You wrote “collecting age” when the name of the action is “collecting ages.” So it should be:

Understand "[number]" as collecting ages when collecting age.

if you’re using Skylark’s code.

The Xzibit effect comes from naming the action and the decide whether phrase such similar things. You could name the decide whether phrase something like “it’s time to collect ages” and it’d be a little less confusing.

too much work xD and i’m using different code, as shown.
i don’t see where the issue is or could be so … yeah.

haven’t run into any problems yet :slight_smile: concerning that, anyway.

I know that’s not your script, :~P I had to rebuild it like Inforn’s player name example to make it work in my script.

Then what the (expletive deleted) was

all about? D:

oh well. gonna go on the search for spock now. haven’t seen that movie in … a year or something.