Water, water, everywhere, And all the brains did shrink...

Well, I cannot quite wrap my head around this.

I have 10 rooms (about 25%) in the first third of my game that are adjacent to or are a "lake room".

At some point, the player needs to 'get water' in their cup.

I want the player to be able to get any lake water. I plan on adding water as scenery to each of the 10 rooms and swapping out a full cup (in storage) with the empty cup in inventory. No problemo.

Problemo: There is a fisherman in one of my lake rooms who has a bucket of stagnant water. Also, once the player successfully has water, the cup in the inventory fills with water. There will be potentially three 'water' objects in one room and two in most. Once the player successfully "uses" the water, the cup will empty, but can be refilled for later use. And, I considered using some other clever name for the water, but... that just won't work.

If a player types 'x water' or 'drink water' I will get the dreaded "Which water do you mean?" response. Is there any way to avoid this in these situations? Or, do I just need to suck it up in those rooms and force the player to answer the built-in response?


I think the easiest fix would be to do this:

  1. don't use/allow the water Object's actual names to be used by the person playing the game/inputting-for-the-
    Command (keep them hidden and unknown, so they don't get used in the Command, as otherwise, I think it's impossible for quest to know clairovoyantly which 'water' the person meant, thankfully computers aren't able to be clairovoyant, just as humans aren't able to be, lol): aka do NOT use the '#object#' Argument/Parameter VARIABLE for the Command's 'pattern' box
  2. use/allow the water Object's 'alias' to be used by the person playing the game/inputting-for-the-Command: aka using the '#text#' Argument/Parameter VARIABLE for the Command's 'pattern' box
  3. the trick then is in the Command's scripting, as you got to handle the 'alias', determining what water Object they meant by the alias.

here's an example:

<command name="drink_water_command">
  <pattern>drink #text#</pattern>
  <script>
    if (text = "water") { // or: if (not Instr (text, "water") = 0) { // or: if (not InstrRev (text, "water") = 0) {
      terminator_boolean_variable = false
      foreach (object_variable, AllObjects ()) {
        while (not terminator_boolean_variable) {
          if (object_variable.alias = text) {
            // code for what water you're after/needing for your design for your various water objects: if (...object_variable...) { /* scripting */ }
            /*
            // for example:

            if (Got (object_variable)) {
              terminator_boolean_variable = true
              if (object_variable.name = "stagnant_water_object") {
                msg ("You drink the water... but it's stagnant, fully of parsites, and you die a 1-3 week long slow agonizing death.")
                msg ("GAME OVER")
                // this is probably not needed (due to the 'finish' below), but oh well: terminator_boolean_variable = true
                finish
              } else {
                msg ("You drink the fresh cool water. Never has water tasted so good!")
              }
            }
            */
          }
        }
      }
    }
  </script>
</commamnd>

alternatively... you could jsut do:

no '#text/object#' Argument/Parameter VARIABLE in the Command's 'pattern' box: drink water

which, would simplify the scripting for it a bit... for example:

<command name="drink_water_command">
  <pattern>drink water</pattern>
  <script>
    foreach (object_variable, ScopeInventory ()) {
      terminator_boolean_variable = false
      while (not terminator_boolean-variable) {
        if (object_variable.alias = "water") {
          terminator_boolean_variable = true
          if (object_variable.name = "stagnant_water_object") {
            // blah scripting
          } else {
            blah scripting
          }
      }
    }
  </script>
</command>

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

Support

Forums