Changing eat verb to drink verb

Is it possible to change the eat verb to drink? I have a beer that I have made edible, thinking I would be able to change eat to drink, but I'm not getting anywhere with this.

Is this possible, or does it need to be set up differently to be drinkable?


I can make it drinkable with a verb, but then it would need to disappear from the fridge.

Just make a verb 'drink' on object beer. It need not be edible. You could add a script that when beer is drunk to make object beer invisible. Possibly you might need to make an empty container ( previously placed in your player's inventory , and set to invisible) visible. Then add a script to deal with what effect drinking beer has.

If using the desktop editor, you can edit verb objects. Look down at the bottom left, there is an option to show all library elements. Do that, then look in verbs under the game object for "eat". You can add "drink" to the pattern (it might be called).

Awesome, thank you. I'll try that!

I've found all library elements and I can find eat, but I can't see how to add to the pattern. Would it be possible to have a screenshot of this please?

Looking at it, I see there is already a drink. A better way might be to edit the drink element, and to change the attribute to "eat".

I've got a funny feeling I may still be looking in the wrong place. I've searched for drink and I'm seeing this:

Is this where I should be looking?

Thank you :)

That is the one. You will need to click the Copy button top right to put it in your game file before you can edit it.

Thank you @ The Pixie. The player can now drink beer.

I've noticed I'm now getting the below error when running the game. I'm pretty sure this is from adding eat to the drink attribute.

Error running script: Error adding key 'eat' to dictionary: An item with the same key has already been added.

Everything (eat and drink) still seem to work. Is there a way to make the error go away?

Dictionary Attributes are (in application of them) input-output Functions:

a (String/Object/Script) Dictionary Attirbute's item:

String Dictionary: string input -> string output
Object Dictionary: string input -> object output
Script Dictionary: string input -> script/scripting output

(using a String Dictionary for example)





<attr name="NAME_OF_DICTONARY_ATTRIBUTE" type="stringdictionary">
    <key>INPUT_STRING_KEY_3 </key>

for example:

<object name="global_data_object">

  <attr name="month_stringlist_attribute" type="simplestringlist">january; february; march; april; may; june; july; august; september; october; november; december</attr>

  <attr name="month_to_season_stringdictionary_attribute" type="simplestringdictionary">january = winter; february = winter; march = spring; april = spring; may = spring; june = summer; july = summer; august = summer; september = autumn; october = autumn; november = autumn; december = winter</att>


<game name="example_game">
  <attr name="start" type="script">
    show menu ("Birth Month?", global_data_object.month_stringlist_attribute, false) {
      // let's say you selected 'october'
      player.birth_month_string_attribute = result
      // player.birth_month_string_attribute = "october"
      player.birth_season_string _attribute = StringDictionaryItem (global_data_object.month_to_season_stringdictionary_attribute, result)
      // player.birth_season_string_attribute = "autumn"


hopefully you can see why you can't have two of the same input string's ('keys'):

january (key/input) = winter (value/output)
january (key/input) = 1 (value/output)

which does it return/output? "winter" or "1" ??? -----> ERROR!

see Pixie's guide on using the built-in 'displayverbs/inventoryverbs' Stringlist Attributes (you're adding the same 'eat' input into it that is already added into it: can't have two of the same inputs):

(the 'displayverbs/inventoryverbs' is how Verb visibility/access/use/availability works during game play: add/remove the verb string inputs, from these built-in stringlist attributes)

and here's my guide on using List/Dictionary Attributes (do note that this List/Dictionary stuff is more advanced stuff than normal Attribute usage, Pixie's 'displayverbs/inventoryverbs' are Lists/Dictionaries too, but he explains it well, so it's not that bad, but this stuff is still more advanced/hard than normal attribute usage): (moving without using Exits, be warned: this is old and very poor code and with some errors in it and/or is ineffcient, as this was done when I was learning this stuff for my first time, hehe)

Sorry, winusoft, looks like that does not work. I must admit, I had no tried it, I was just guessing you could do it that way. You will need to delete the drink verb from your game.

So back to plan A. Copy the eat verb to your game (like you did with drink), and set the pattern to this:

eat #object#;drink #object#

I have tried it this time and it does work!

Awesome, thank you guys!

Surely it would be just as easy to add the 'drink' verb to the beer object, then manipulate the beer object via script. As father suggested in the first post.
Create two objects - beer; empty beer.
set beer to visible and empty beer to invisible
add 'drink' verb to beer
set the verb to run a script
in script have a message, and manipulate the two objects accordingly.

If you want the beer to affect the players health, you can do that via the script too need to make the beer edible.

I think the advantage with putting eat and drink together is that I'm likely to want them to both work in the same way throughout the game.

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