Give as an option in listed menu

Hi there!
I'm having a small problem (more likely I just don't know how to do it). I need my player to give something to an npc and since I like to have all verbs listed, after you click an object or a character, I need the 'give' verb to be there as well. The thing is I want it to be there only after you have already spoke to the npc, so it's like he gave you a quest to bring it. If I use give - as an added verb - it's always there with the thing I want to give to him, although it works only after we spoke to him (as I made a flag).
Is it possible to have this as a verb in menu listed after the player clicks on the npc? Using the Use/Give ?

I really do hope you got what I mean.
Thanks in advance!


you can add/remove Verbs as you desire:

(see the first/top: the 'display_verbs', link below)

the 'displayverbs' and 'inventoryverbs' built-in String List Attributes controls what Verbs are available

https://docs.textadventures.co.uk/quest/display_verbs.html

https://docs.textadventures.co.uk/quest/using_verbs.html

https://docs.textadventures.co.uk/quest/attributes/displayverbs.html
https://docs.textadventures.co.uk/quest/attributes/inventoryverbs.html


I think you already figured out how to do the conditional for your 'give' Verb, so, you can also apply a conditional for your 'add/remove' Verbs as well, if you desire


there's a 'take' and 'drop' built-in Boolean Attributes that determine whether you got these 'Verbs' toggled on/off (available or not), but I'm not sure if there's the same type of control for the 'use' and 'give' Verbs, as I don't know how they're controlled


if you need help with anything, let me know


Thank you so much for help! I managed to do what I wanted.

Although, I was wondering, is it possible for a verb to appear only after specific action?


(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)


yes, don't have the Verb initially available for whatever desired the Object(s), and within that specific action(s) (and if also using a conditional, 'if' Script, within the action itself, then have it for that desired conditional outcome: true or false), have the scripting that adds that Verb to the desired Object(s)


for a quick/simple example:

// easy way to do a: yes->true / no->false, selection/choice from/by the person playing the game, so used it for this example:

https://docs.textadventures.co.uk/quest/scripts/ask.html

// the 'game' required special Object's 'start' Script Attribute, is the first thing that is run/done/activated/esecuted when you start playing the game (making it good for character creation if doing a RPG and/or as providing an intro displayment, or whatever else, for the game, for some/main examples for it). In the GUI/Editor's left side's "Tree of Stuff (Elements)", this is the 'game' that you see, under the broad 'Objects' category/folder, which you click on, so it is highlighted, and than on the right side, select the desired Tab, and customize it how you want (adding scripts to the 'start' Script, not sure what Tab it's within, I don't know from memory/off-hand and don't have quest open):

https://docs.textadventures.co.uk/quest/elements/game.html
https://docs.textadventures.co.uk/quest/attributes/start.html

just using this 'start' Script on the 'game' required special Object, as it's quick and easy usage for this example

lastly, I added/made/used a Function for the 'action', as it is quick and easy usage for this example


<game name="NAME_OF_YOUR_GAME">

  <attr name="start" type="script">

    example_function

  </attr>

</game>

<object name="room">

  <inherit name="editor_room" />

</object>

<object name="player">

  <inherit name="editor_object" />
  <inherit name="editor_player" />

  <attr name="parent" type="object">room</attr>

</object>

<object name="example_object">

  <attr name="parent" type="object">room</attr>

  <attr name="whatever_verb" type="script">

    msg ("WHATEVER_VERB")

  </attr>

  <attr name="example_verb" type="script">

    msg ("EXAMPLE_VERB")

  </attr>

  <displayverbs type="stringlist">

    <value>whatever_verb</value>

  </displayverbs>

</object>

<function name="example_function">

  ask ("Want to activate/add 'example_verb' Verb to the 'example_object' Object?") {

    if (result) {

      list add (example_object.displayverbs, "example_verb")
      msg ("The 'example_verb' Verb has been added to the 'example_object' Object")

    } else {

      msg ("You chose NOT to add the 'example_verb' Verb to the 'example_object' Object")

    }

  }

</function>

<verb>

  <property>whatever_verb</property>

  <pattern>whatever_verb</pattern>

</verb>

<verb>

  <property>example_verb</property>

  <pattern>example_verb</pattern>

</verb>

the actual GAME OBJECT (aka, your game) is the 'asl' tag block, all code (aka, the game's: source code / game-content) must be within the 'asl' tag block, so don't get confused the 'game' required special Object as the actual GAME OBJECT

but I leave the 'asl' tag block and the included engine libraries out in my example due to being lazy, as In just showing the example content for what you want to do


here's what it would really look like:

(I'm still using an older version, v550, of quest, so yours will be whatever it currently is: 560, 570, 580, 590, 600, 610, etc: the 1's placement is always 0, even though the engine version might be for example: 5.5.72914736285, but you' just have: version="550", as seen in the code below)

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <game name="NAME_OF_YOUR_GAME">

    <gameid>SOME_RANDOMLY_GENERATED_HASH_STRING_FOR_ID_FOR_PUBLISHING_GAME_FOR_QUEST_SERVERS</gameid>

    <author>BLAH BLAH BLAH</author>

    <firstpublished>2019</firstpublished>

    <attr name="start" type="script">

      example_function

    </attr>

  </game>

  <object name="room">

    <inherit name="editor_room" />

  </object>

  <object name="player">

    <inherit name="editor_object" />
    <inherit name="editor_player" />

    <attr name="parent" type="object">room</attr>

  </object>

  <object name="example_object">

    <attr name="parent" type="object">room</attr>

    <attr name="whatever_verb" type="script">

      msg ("WHATEVER_VERB")

    </attr>

    <attr name="example_verb" type="script">

      msg ("EXAMPLE_VERB")

    </attr>

    <displayverbs type="stringlist">

      <value>whatever_verb</value>

    </displayverbs>

  </object>

  <function name="example_function">

    ask ("Want to activate/add 'example_verb' Verb to the 'example_object' Object?") {

      if (result) {

        list add (example_object.displayverbs, "example_verb")

        msg ("The 'example_verb' Verb has been added to the 'example_object' Object")

      } else {

        msg ("You chose NOT to add the 'example_verb' Verb to the 'example_object' Object")

      }

    }

  </function>

  <verb>

    <property>whatever_verb</property>

    <pattern>whatever_verb</pattern>

  </verb>

  <verb>

    <property>example_verb</property>

    <pattern>example_verb</pattern>

  </verb>

</asl>

you can create a new quest (Text Adventure) game, name and save it somewhere you can find it (example: desktop), and in the menu bar at the top, under 'help/about' (I think), chose 'about or quest version' (I think), to see the engine/software/program version of quest that you're using and remember its first two (the 'X') digits (X.X.yyyyy), ALSO highlight, copy, and paste the 'gameid' hash string in a separate location (I'd just use notepad, or a new notepad page, if you used it for your game code), exit out of quest, right click on it (the 'XXX.aslx' game file itself), and select 'open', and then choose a text editor software (notepad, wordpad, Apple: text editor, notepad++, etc) to get into your entire game code, highlight all of it, delete all of it, highlight, copy, and paste my code above into your blank game file, change the, version="XXX", in the top 'asl' tag line, to match your quest engine/software/program version, ALSO paste in your gameid hash string into its gameid spot (replace my 'SOME_RANDOMLY_GENERATED..." part of the code (make sure you don't accidentally remove the other symbols and etc stuff), save it, quit out of it, and then double click to open it up, and you can see/study it in the GUI/Editor, and/or try "playing" it (not much to play, lol), seeing it in action, lol

(if it doesn't work... I got mistakes in my code, lol.... fingers crossed that everything is perfect/correct, laughs)


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

Support

Forums