object choice menus

bergedorfcacher
05 Jul 2016, 11:00

Hi, let me first say I love Quest so far. There are a few things I don't get yet, but si far I could solve all my tiny problems. :-)

I am developing a game for a community that (on average) has probably not much experience with text adventures. For that reason I decided to give them click options wherever possible, so that they don't have to guess the right words and also have hints about what is actually possible. Now it seems I could probably offer everything in clickable ways if I get around this one problem:

For 'give' there is the option to 'Display menu of objects this can be given to'. Is there a way to offer such functionality for other verbs/commands too?

BTW: I am not really clear on commands vs.verbs yet. What I need (so far) is 'throw x at y' (there seems to be a command for this already) and 'bind x to y'. (All this in German in fact, but that probably doesn't make much of a difference.)


Pertex
05 Jul 2016, 13:58

if you add a verb to an object (in the verbs tab) you can choose several actions in the combobox there: "Print a message", "Run a script" and "Require another object". When you use this last option you can define a script when two objects are used together. Then a menu is shown in the game with all reachable objects.


bergedorfcacher
05 Jul 2016, 15:01

Great, many thanks, works perfectly.

Now, do I need to script reactions to all 'target objects' individually or is there a way to define a default? I can't see anything like that atm, but I might be looking at the wrong place.


Pertex
06 Jul 2016, 05:50

yes, you must script all target objects


bergedorfcacher
25 Jul 2016, 20:28

Just in case someone stumbles over this and is looking for a solution: I found out that it is possible to programatically set the scripts (or rather copy them from some location).

foreach (obj, AllObjects()) {
  if (GetBoolean(obj, "something")) {
    foreach (tar, AllObjects()) {
      if (GetBoolean(tar, "somethingelse")) {
        dictionary add (obj.throw, tar.name, game.throwScript)
      }
    }
  }
}

I prepared a script attribute (game.throwScript) that contains the generic throw handling (which is dependent on a few addiitional attributes). This way I can define the entire throwing (and being hit) behaviour by attributes. If I add a new object that can be thrown or thrown at, I only need to set the local attributes and it will work.