Is it possible to tell if the player has just taken (or is taking) a thing directly, vs. “take all” or implicit taking?
Example: If the player types “take confetti,” I’m counting that as direct taking, and I’m thinking about using that information to set a flag. If the player types “take all” (which takes multiple things, including the confetti) or if the player types “throw confetti” (which results in automatically taking the confetti first), those don’t count.
I guess the player could also type something like “take confetti and party hat,” but for my purposes, I’m not counting that as what I’m looking for–I’m looking for whether the player is directly taking just one thing.
The multiple-object case is harder to detect, but implicit takes are handled by the “implicitly taking” activity, so any rules can check if that activity is happening.
Ok, thanks. If I have a number variable and increment for every attempt to take an item over the course of the turn (though I’m not exactly sure how to do that), and then check that variable, maybe that could take care of the multiple-object situation?
Although I guess the player could type “take all” even if there’s only one thing to take…but maybe counting take attempts is close enough. Or I could check to see if the player’s command includes “all.”
The number of objects considered is a number that varies.
The track multiple actions rule is listed before the generate action rule in the turn sequence rulebook.
This is the track multiple actions rule:
let L be the multiple object list;
now the number of objects considered is the number of objects in L.
To decide whether executing a multiple action:
decide on whether or not the number of objects considered is greater than one.
To decide whether executing a single action:
decide on whether or not the number of objects considered is at most one.
Unfortunately I don’t have a working I7 here to test with, and from the source of the parser, I can’t figure out if this will be set to 1 or 0 for a single action. So I hedged my bets and tested for >1 or ≤1.
Is “all” the only way to indicate everything? Does “take everything” work? Are there other synonyms?
Checking the player’s command seems like a semi-reasonable approach, though it does have the problem that the command could be multiple linked commands (so you could get a false positive for “get up then take ticket” for example).
Put confetti on table (which would typically generate an implicit take)
This is a problem I have also run into in the past. The behaviour for taking is simply spread so wildly throughout the standard rules that it can be a little hard to make sweeping changes or fully understand what the system is doing at any given time. I’m actually in the middle of going over my old solution right now to see if I can’t make it more… elegant.
In the event that I have any advice to share with you, I also want to ask: how do you feel about the player typing multiple commands at once, such as “take confetti. wait. take party hat.”? Is that first take confetti okay with you, or would you prefer it be treated like “Take confetti and party hat” when it comes to your output here? Every-turn rules would run throughout those, but what results might end up messy if you’re trying to… say… print a descriptive scene there.
Edit: Also, it might help to know what you are attempting to use this information for. My immediate guess is for having a scene play out, since that’s why I ran into this issue. Maybe you’re aiming for something else, though.
If someone does a TAKE ALL or TAKE X AND Y AND Z, then when X is taken, it’ll be the first take of the turn—but there are still two other takes pending on the same turn.
Oh–I was assuming the counter would keep going between takes and not be reset until the turn was over.
Thanks!
The compiler didn’t like “number of objects in L” but I changed it to “number of entries in L” and that worked.
Then I also tried to detect implicit taking, and to use that to figure out if the player was directly taking one thing. Which seemed to work.
But I also noticed that when I test conditions like “if we are taking something” (or, for a particular object, “if we are taking the confetti”), those results also seem to line up with taking a thing directly. “If we are taking something” seems to come out as true if we are directly taking one thing, and as false for “take all” or implicitly taking or “take X and Y.”
So I’m wondering if I can just use those conditions instead, or if it’s frowned on to use conditions like that in an every turn rule.
Lab is a room.
A table is a supporter in Lab.
Some confetti is here.
A pink party hat is here.
A yellow party hat is here.
Took-implicitly is a truth state that varies. Took-implicitly is false.
Rule for implicitly taking something in Lab:
now took-implicitly is true;
continue the activity.
The number of objects considered is a number that varies.
The track multiple actions rule is listed before the generate action rule in the turn sequence rulebook.
This is the track multiple actions rule:
let L be the multiple object list;
now the number of objects considered is the number of entries in L.
To decide whether executing a multiple action:
decide on whether or not the number of objects considered is greater than one.
To decide whether executing a single action:
decide on whether or not the number of objects considered is at most one.
Every turn when the location is Lab:
if took-implicitly is true:
say "We are taking something implicitly.";
if executing a multiple action:
say "We are executing a multiple action.";
if executing a single action:
say "We are executing a single action.";
if we are taking:
say "We are taking.";
otherwise:
say "We are NOT taking.";
if we are taking something:
say "We are taking something.";
otherwise:
say "We are NOT taking something.";
if we are taking the confetti:
say "We are taking the confetti.";
otherwise:
say "We are NOT taking the confetti.";
if we are taking the pink party hat:
say "We are taking the pink party hat.";
otherwise:
say "We are NOT taking the pink party hat.";
if (we are taking the confetti) and (took-implicitly is false) and (executing a single action):
say "We directly tried to take the confetti.";
otherwise:
say "We did not directly try to take the confetti.";
if (we are taking the pink party hat) and (took-implicitly is false) and (executing a single action):
say "We directly tried to take the pink party hat.";
otherwise:
say "We did not directly try to take the pink party hat.";
now took-implicitly is false;
say "END OF TURN.[paragraph break]";
Test me with "take all / drop confetti and pink and yellow / take pink / put confetti on table / take confetti and pink. Take yellow.".
Results:
Lab
You can see a table, some confetti, a pink party hat and a yellow party hat here.
>test me
(Testing.)
>[1] take all
confetti: Taken.
pink party hat: Taken.
yellow party hat: Taken.
We are executing a multiple action.
We are taking.
We are NOT taking something.
We are NOT taking the confetti.
We are NOT taking the pink party hat.
We did not directly try to take the confetti.
We did not directly try to take the pink party hat.
END OF TURN.
>[2] drop confetti and pink and yellow
confetti: Dropped.
pink party hat: Dropped.
yellow party hat: Dropped.
We are executing a multiple action.
We are NOT taking.
We are NOT taking something.
We are NOT taking the confetti.
We are NOT taking the pink party hat.
We did not directly try to take the confetti.
We did not directly try to take the pink party hat.
END OF TURN.
>[3] take pink
Taken.
We are executing a single action.
We are taking.
We are taking something.
We are NOT taking the confetti.
We are taking the pink party hat.
We did not directly try to take the confetti.
We directly tried to take the pink party hat.
END OF TURN.
>[4] put confetti on table
(first taking the confetti)
You put the confetti on the table.
We are taking something implicit;y.
We are executing a single action.
We are NOT taking.
We are NOT taking something.
We are NOT taking the confetti.
We are NOT taking the pink party hat.
We did not directly try to take the confetti.
We did not directly try to take the pink party hat.
END OF TURN.
>[5] take confetti and pink. take yellow.
confetti: Taken.
pink party hat: You already have that.
We are executing a multiple action.
We are taking.
We are NOT taking something.
We are NOT taking the confetti.
We are NOT taking the pink party hat.
We did not directly try to take the confetti.
We did not directly try to take the pink party hat.
END OF TURN.
Taken.
We are executing a single action.
We are taking.
We are taking something.
We are NOT taking the confetti.
We are NOT taking the pink party hat.
We did not directly try to take the confetti.
We did not directly try to take the pink party hat.
END OF TURN.
I want to print some text in an Every Turn rule, and that text should be different depending on whether or not the player directly tried to take one of a few special objects. (If the player directly tried to take it, the text can give a more subtle clue, but if the player took a thing indirectly or among other things, then I might need to give a more overt clue, because the multiple actions going on could confuse matters for the player.)
It seems like multiple commands entered on the same line get separated into separate turns, at least as far as Every Turn rules are concerned. Every Turn rules look like they are running after each command, not just after the entire list of commands, so at the moment, I’m not worried about multiple commands. I’m just thinking about one command at a time.
However, if you’re using anything that looks directly at the text of the player’s command, you need to account for multiple commands even if you don’t directly want to handle them.
Suppose the player types in “take fish then go east then put fish in pot”.
When the “taking fish” action is being executed, the content of the player’s command is “take fish then go east then put fish in pot”.
When the “going east” action is being executed, the content of the player’s command is now “go east then put fish in pot”.
And finally, when the “putting fish” action is being executed, the content of the player’s commend is now “put fish in pot”.
So what that means is that a condition like if the player's command matches "fish" will be true if any of the pending commands match “fish”. If the command were something like “drop marble. take fish.” then that condition is true while dropping the marble, even though you actually only want it to be true while taking the fish.
If there’s a way to check this that doesn’t involve looking at the player’s command, then you probably don’t need to worry about this, but you should at least keep it in mind in case you do end up looking at the player’s command.
“Every turn: if we are taking something” should work! Checking an action in an “every turn” rule looks at the leftover registers from the action processing, so it should only consider the main action for the turn. As long as nothing else messes up those registers, it will do what you want.
That won’t work in the action processing rules, but if all you need is every turn, you should be good with that.
I wouldn’t call them completely equivalent. The first runs the rule every turn and does nothing if not taking; the second only runs the rule when taking. I’m not sure how much this matters outside of debugging though (my version keeps it out of the RULES output when it’s not relevant).
Is this the correct type of detection for the >TEST ME cases?
sample TEST ME transcript
Lab
You can see a table, some confetti, a pink party hat and a yellow party hat here.
>test me
(Testing.)
>[1] take all
confetti: Taken.
pink party hat: Taken.
yellow party hat: Taken.
>[2] drop confetti and pink and yellow
confetti: Dropped.
pink party hat: Dropped.
yellow party hat: Dropped.
>[3] take pink
Taken.
A simple take occurred on turn 3 with command "take pink".
>[4] put confetti on table
(first taking the confetti)
You put the confetti on the table.
>[5] take confetti and pink. take yellow.
confetti: Taken.
pink party hat: You already have that.
Taken.
A simple take occurred on turn 6 with command "take yellow.".
>