I’ve gotten back into the swing of things with my EAMON-like, but I’ve hit a roadblock.
In this version of the game, the player can attack an enemy using a maneuver (a kind of value like “hack”,“slash”, or “bash”, for example). Creating this is simple enough: “Attacking it with is an action applying to one thing and one maneuver.”
I’m throwing a monkey wrench in the works by allowing the player to allocate points from a (dice) pool towards his attack, and need to know this information in order to properly carry out the rest of the attack/defense sequence and combat round.
However, “Attacking it with using is an action applying to one thing one maneuver and one number” just doesn’t seem to work. I’ve tried using the Questions by Michael Callaghan extension to ask the player how many dice he wants to use, but placing this in the “Carry out attacking it with” code block just prints the question and continues the action. I guess I can’t get the input of one command while carrying out another, even putting the Questions code in an activity and running it during “carry out attacking it with” fails.
I’ve also tried:
dice_to_use is a number that varies.
Carry out attacking it with:
if the player's command contains a number:
now dice_to_use is the number understood;
say "You [the maneuver understood] [the monster understood], using [dice_to_use] dice!";
But that doesn’t seem to want to work, either.
Is there any way to receive three or more parameters, or am I going to have to restructure my whole system around asking the player for one piece of information at a time? this would be tedious for the player, as combat plays a central role in this game; “hack goblin 4” would be much easier to play with than
now the question is "Which monster do you want to attack?";
now the question is "How do you want to attack the monster?";
now the question is "How many dice do you want to use?";
My instinct would be to use ‘hack’, ‘slash’, etc. as separate actions, have them set a value that remembers their attack type, and then redirect them all to the same attacking rulebook (that checks that value).
Here’s my attempt at implementing Maga’s suggestion, which is probably the best way to do it.
Attack type is a kind of value. The attack types are hack, slash, and stab. [Change this as appropriate, I don't know how combat in your game works.]
The current attack type is an attack type that varies.
After reading a command:
if the player's command matches "[attack type]":
now the current attack type is the attack type understood;
replace the matched text with "attack".
Attacking it with is an action applying to one thing and one number. Understand "attack [something] using/with [number] dice/--" as attacking it with.
Within a rule about “attacking it with” you can get the type of the attack with the “current attack type” variable and the number of dice allocated with the “number understood”. If the player uses the verb “attack” rather than an attack type it defaults to the attack type most recently used (which is still held in the current attack type variable).
It’s somewhat fiddly to match and replace the snippet of the player’s command. I’d go with what maga said: define separate actions for hacking, slashing, etc.
Understand "hack [something] with [number] dice" as hacking it with.
Then have carry-out rules for these actions which invoke a rulebook or a function or whatever.
I’m amazed that zarf isn’t pointing you to his implementation of all the assorted sailing actions in Hoist Sail for the Heliopause; this is exactly what he does in that game. He has a lot of actions that do nothing but try some other, internal action (possibly after setting a couple of variables). In this case, make actions for hacking, slashing, cutting, bashing, whatever; all of which just set some action variables and then “try maneuver-attacking the noun with the second noun”, which restarts the action process from the top. The individual actions should then have some Understand lines to let to player do them; maneuver-attacking shouldn’t be Understood, but it should have all the logic for actually hurting someone.
If you want to have this kind of detail, you might also want to manipulate the built-in “attacking” action to make sure it doesn’t work but does give useful advice on how to actually hurt the player’s enemies.