Taking one item out of an unspecified number

I KNOW there must be a more elegant way of doing this than the way I’m doing it. Anyway, I’ve got a room lit by several torches, and I’d like the player to be able to take one, leaving the others. (The number is unspecified, but could be specified in the code; I don’t want to specify it in the readout.)

Before I tried to implement the taking thing, this was working fine -

[code]The description is “A low-roofed cave lit by [torches].”

Some torches are in the Cave.[/code]
and it’d be nice if I were able to use the text substitution in the final result here because it prevents it from printing the torches in the list of items in the space.

I’ve tried a couple of things, including:

A torch is a kind of thing. The plural of torch is torches. Ten torches are in the Cave.

This is probably the simplest, but doesn’t let me use the text substitution. I’d also have to prevent the player taking more torches (or using “get torches”), but that’s easy enough to write.

Creating a torch out in space and moving it to the player “instead of” taking the torches in the Cave creates other dumb problems.

So am I on the right track with “a kind of thing” and I just need to figure out how to use the substitution or otherwise avoid printing these as (non-scenery) items?

Here’s one possible solution.

[spoiler][code]“Cave”

a torch is a kind of thing. a torch is usually lit. Understand “torch/torches” as a torch. Understand “lit/burning torch” as a lit torch. Understand “unlit/extinguished torch” as an unlit torch. The description of a torch is usually “[if the noun is lit]The torch burns brightly, lighting your way.[otherwise]The torch is extinguished and a bit damp from the waterfall.”

For printing a locale paragraph about a torch (called the item)
(this is the don’t mention torches in room descriptions rule):
set the locale priority of the item to 0;
continue the activity.

Check taking a torch:
if the player carries a lit torch:
say “You really don’t need to carry more than one at once.” instead.

Cave is a dark room. “A low-roofed cave lit by [number of lit torches in the location in words] burning torch[if the number of lit torches in the location is greater than one]es[end if] stuck in the ground here. An icy waterfall cascades over an opening to the north.”

Two lit torches are in cave.

Carry out going north from cave:
if the player carries a lit torch:
now a random lit torch carried by the player is unlit;
say “Your torch sputters out in the icy downpour.”

Grotto is north of Cave. “You’ve made it to the grotto. Luckily, sunlight streams in from above.”
[/code][/spoiler]

One possibility would be to make one plural-named scenery thing to represent all the torches that can’t be taken, and another thing for the torch that can be taken, for instance,

[code]Cave is a room. The description is “A low-roofed cave lit by torches along the wall.”

Several torches are a plural-named scenery thing in the Cave. Understand “torch” as the several torches when the brightly-burning torch is not visible.

A brightly-burning torch is in Cave. “One brightly-burning torch is within reach.”

Instead of taking the several torches:
say “You only need one.”[/code]

(No doubt this could be improved upon–it’s more of a starting point than a complete solution.)

Thanks both of you! I just went with the simplest possible solution and set the locale priority to 0, which I didn’t know was a thing. I wrote out a quick rule to prevent the player taking a second torch, but is there a way to stop “get torches” from trying (even unsuccessfully) to collect all of them, bar creating them as a plural object as in bg’s example? (edit: and assuming it’s necessary to stop the player from doing something which on reflection is non-intuitive anyway.)

(Also, am I correct in thinking that creating more of these objects creates more work for the processor? I’d like to create a couple of extras in case for some reason the player drops theirs somewhere and wants to come get another, but within reason, you know.)

To stop “get torches” from trying to bag the lot:

After taking a torch when the multiple object list is not empty:
	let M be the multiple object list;
	remove the list of torches from M;
	alter the multiple object list to M;
	continue the action.

I had to look it up as well - it’s a bit obscure if you don’t know of its existence and it took me several tries.

It depends on the effect you want. My impulse would be to have an untakeable scenery item “burning torches” - “Instead of taking the burning torches: try taking the torch”. JRB’s solution might work better.

Kinds are a normal thing as long as you don’t go crazy with hundreds of something which will just drive you and the player crazy managing individuals of a kind. I have written a game with 50 coins and recycled them as necessary (when carrying a certain number, the game forced the player to put them in a bag where they incremented a money variable and shuffled them back into an offstage coin-box).

In the same game (Baker of Shireton) I had bread and dough you could rise and bake to different levels based on time in and out of the oven. It was sort of a nightmare as I had 20 balls of dough and 20 loaves of bread offstage that swapped in and out taking adjectives unrisen, risen, sourdough (yeah, I know that’s not how it works in real life!) and baked loaves which could be multiply hot, delicious, burnt, stale, sourdough, barley…it pretty much worked so the player could type PUT ALL RISEN DOUGH IN THE OVEN, SELL HOT DELICIOUS BREAD TO CITIZEN, but it took a lot of experimentation and testing. The game had to continuously count how many loaves were in existence and stop the player from baking saying “You’ve made enough bread to sell for now.”

Hm, this does still print out the whole list if I’ve already taken one…

so is that just going to be a “don’t worry about the player trying to do non-intuitive things” situation?

My impression is that it’s common for experienced players to try to take everything they can, because if something is available to take, that’s usually a sign that it will be necessary or at least useful. Even if they don’t try “take torches,” they may try “take all.” (That doesn’t necessarily mean you have to alter the refusal messages from what you have above. I just wouldn’t count on people not trying to take the torches, is all.)

Right, I get that, which is why I want to stop them taking more than one in the first place - I just mean that “get torches” or “get all” nets you one torch if you don’t already have one, but if you do already have one, it prints the error message ten times.

Sorry HanonO to have missed your comment earlier. I think the plural object suggestion is going to work after all. (I’m even able to skip the locale priority thing by writing that the cave is lit by [torch]es, although if I do end up needing to create more than one in case the player should need another one, I’ll come back to all that.)

Yep, I should have thought of that. How about this?

To clear torches:
   let M be the multiple object list;
   remove the list of torches from M;
   alter the multiple object list to M.
Instead of taking a torch when the player carries a torch:
   say "You already have a torch.";
   if the multiple object list is not empty: 
        clear torches.
After taking a torch when the multiple object list is not empty:
   clear torches;
   continue the action.

I’m assuming that you’ve made the decision to have several torch objects around. Like Hanon, my preference would be to have one actual torch, and one scenery pile of torches. (And I’d make sure that the one torch object automatically got returned to the pile if the player left it lying around somewhere, so that they’d always be able to get a “new” one.)

Yeah, my current front-runner option is to have just the one takeable one, and an unspecified quantity of scenery ones. (As far as I’ve planned ahead, there isn’t actually any reason to take them as there are no dark rooms and the other object that needs to be burned can be brought here, but I know the player’s going to want to grab one.) I suppose that returning the takeable torch to this room when it’s dropped could work! (The other thing is that there are two PCs that the player can switch between, so I was thinking, what if the player wants to make sure each PC has one - but this room is currently fairly out of the way from the other PC, so by the time they’d get here they’d probably figure they don’t need a torch.)

If you have a pile of torches in the game, the player will most definitely figure that they do need a torch.

Right! It’s actually just because this was the smoothest (ie. without creating matches/flint/etc.) way to burn something else, which can be done with the torches fixed in place, but I don’t want to discourage people taking anything they see - I’m sure the player’s going to want to grab one when they’re here with the first PC, but getting the second PC here is both non-essential and requires crossing most of the map, so it should be clear that there aren’t any darkened rooms. If it ends up bugging the playtesters, I can make another one for PC #2.

Another simple approach using only one torch.[code]A torch is nowhere. The torch is lit. The description of the torch is “Fire on a stick.”

The Cavern is a room. The description of the Cavern is “A brightly lit cavern with torches all around.”
A Deep Hole is east of the Cavern. A Deep Hole is dark. The description of A Deep Hole is “I see you found the torch.”

Some torches are scenery in the Cavern. The description of the torches is “There are so many. Nobody will miss it if you take one.” Understand “torch” as the torches when the location is the Cavern.

Instead of taking the torches when the location is the Cavern and the torch is off-stage:
now the player has the torch;
say “You take a torch.”
Instead of taking the torches when the location is the Cavern and the torch is not off-stage:
say “You have left one lying around somewhere. Go find it.”
[/code]