Adding a command - "AGAIN;G"

Hello, everyone!

How might one go about creating a command to repeat the last command entered by the player? I'd very much like 'AGAIN' or 'G' to do the same thing as pressing the UP arrow, then pressing ENTER.

Thanks!


this is really complex stuff...

you'd need to store but check (as you don't want to be storing everything the person playing might input, only relevant inputs) every input/command into a Stringlist Attribute, which you can then pretty easily (if you know coding/programing: 'push/pop' off of a stack... err... list, lol. Getting the List index of the last item, and then handling it, or not, when you're done: after doing your Command) use to get/do its last item (input/command), for your Command.


the 'walkthrough' feature of quest does this for you already... so it might be easier trying to figure out how to use it for with your Command.


this stuff is beyond my ability, but maybe someone else can help with this stuff.


Yeah...

I got it to work the first time you entered G/AGAIN, but if you entered G/AGAIN a second time, it caused a stack error. (Es no bueno.)

Maybe The Pixie will add it to 5.8. It's a common command in all the Infocom games, after all.

Little things that threw me off while first playing Quest games (Constructive 'criticism' from a 40 year old text adventurer)
  • Can't enter AGAIN/G to repeat the last command (obviously)

  • This one really can't be helped. I'm just throwing it out there because it was my main hurdle. Many instances where one must use the command USE (in the old Infocom games, this usually returned a derogatory response; i.e., BE MORE SPECIFIC)

  • When in a room you entered by using the IN command, EXIT is not an alias for OUT

  • Can't enter multiple commands, separated by THEN or "." by default (I've discovered that there is an option to allow "." to do this, but it wasn't turned on in any of the first Quest games I played. And THEN still isn't included in that option, that I'm aware of. I plan on trying to add the THEN to that script sometime soon.)

Many of the 'standard commands' are included in Quest, and I promise: I'm not downing anything. I've simply fallen in love with Quest, and I'd like to help by providing feedback which may lead to improvements that would make Quest more comfortable for us old-timers to transition to.

(Ended that sentence in a preposition. All apologies.)


aside from going into the scripting for the 'get input' Function and/or Commands and/or whatever/where-ever handles it (maybe the 'handlecommand' is what you go into), here's quick look of something of what it'd be like (minus all the handling required):

// scripting for every time this Function is done:

get input { // or Command, but not sure how to handle it
  // if result = valid Command Pattern input:
  list add (game.user_input_commands_stringlist_attribute, result)
}

// ----------------------

<command name="repeat_action_command">
  <pattern>AGAIN;Again;again;G;g</attr> // you can probably use the 'regex' for getting/using the 'up' arrow key too (whatever it's ASCII/whatever Value is)
  <script>
    last_index_integer_variable = ListCount (game.user_input_commands_stringlist_attribute) - 1
    command_pattern_input_string_variable = StringListItem (game.user_input_commands_stringlist_attribute, last_index_integer_variable)
    do (command, command_pattern_input_string_variable) // I'm not sure how to do Commands... but I'm sure it can be done.
    list remove (game.user_input_commands_stringlist_attribute, command_pattern_input_string_variable)
  </script>
</command>

I'll post it here when I figure it out (or when someone reveals the answer, whichever comes first).

Thanks, HK!


Pixie can probably be of help, as this is similar to saving a game's contents for being able to load the game, and he's familiar with the built-in stuff of quest. There's other's too, but Pixie is the main forum post'er.

(maybe some of the old quest people have moved on too along with Alex, and/or are too busy in real life, not sure if Pertex is still around and/or Jay and/or Sgreig/Greg, not sure who has stayed with quest and just don't post much in the forums or if they've moved on from quest and/or real life is just too busy for them for engaging with quest)


SUCCESS!


How I set up a command to repeat the last turn with AGAIN;G;REDO;REPEAT


Turn script - 'capture_again_command':


if (not player.currentcommand = "g") {
  if (not player.currentcommand = "again") {
    player.cc = player.currentcommand
  }
}

The 'Again' command:
Command pattern
again;g;repeat;redo

if (player.cc = null) {
  msg ("There is nothing to repeat.")
}
else {
  msg ("("+player.cc+")")
  HandleSingleCommand (player.cc)
}

Players can scroll through their previous input using the up and down arrows, which is better than an AGAIN command in my opinion, and I guess why the command has not been implemented.


Players can scroll through their previous input using the up and down arrows, which is better than an AGAIN command in my opinion, and I guess why the command has not been implemented.

Very true, and I'm with you on using the arrows. Honestly, I didn't even care about it until I began porting my Inform 7 game to Quest. I'm tweaking everything I can find so the player can play with or without a keyboard, which led to this realization: phones and tablets don't have arrow keys. (Well, Android devices don't, at any rate.)

I'll be posting the port within the week (I hope), and I hope EVERYONE tries their best to poke holes in it so I can patch them all up.

The story might not be award-winning material, but it will have all sorts of ways to interact which will (hopefully) come smoothly to those who play parser AND those who prefer to point and click, with no learning curve for anyone. They can get right on down to the map and the puzzles, without learning the mechanics and proper terminology first.

(It's a small dream, but it's a dream!)


Thank again for all the help! (I definitely need it!)


however quest 'hooks' to the arrow keys, can be done to 'hook' to other keys (for devices that don't have whatever keys), just need someone who knows how quest does this and understands it, lol. (that's not me! lol)

Alex and co really made a powerful engine/software with quest, it has a lot of really useful stuff built into it already (beyond the power of the engine itself), though we do have to learn all of that stuff, and how quest works with it, so it's better to use what's already there for us to use and modify/tweak/build-upon it as needed.

That said, even if you do whatever stuff, regardless, it's still practice and learning for you, so still always have value, even if there might be easier/better methods/ways/designs out there and/or if it's not needed for its purpose.

"re-learning the wheel is useful when you don't understand the wheel in the first place, lol, and if you don't understand the wheel, you can't make/understand more advanced stuff like a wagon/car/etc, lol (HegemonKhan)"


Here I am, having often wanted to repeat a command, totally oblivious to using the arrows to reuse previous commands. I've longed for "g" (or at least "again") in Quest, as I frequently used them in a text adventure app on my old iPad.

I suspected that a command could be created easily by using some of the stored attributes, but I didn't know exactly which one(s) I needed -- or how to re-execute them. This thread provides the answer!

So "thank you" to both Richard Headkid and Pixie for your contribution to this thread.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums