<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Verb_Coin_Interface_Tutorial_Part_2</id>
		<title>Verb Coin Interface Tutorial Part 2 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Verb_Coin_Interface_Tutorial_Part_2"/>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Verb_Coin_Interface_Tutorial_Part_2&amp;action=history"/>
		<updated>2026-05-11T05:19:53Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.visionaire-tracker.net/index.php?title=Verb_Coin_Interface_Tutorial_Part_2&amp;diff=11716&amp;oldid=prev</id>
		<title>EK: Created page with &quot;{| class=&quot;ts&quot; style=&quot;width:100%&quot; |- ! style=&quot;text-align:left&quot; | Name !! Part !! style=&quot;text-align:left;width:10%&quot; | By |- | Set up a verb coin interface with screen-centered i...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Verb_Coin_Interface_Tutorial_Part_2&amp;diff=11716&amp;oldid=prev"/>
				<updated>2023-03-17T19:32:42Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| class=&amp;quot;ts&amp;quot; style=&amp;quot;width:100%&amp;quot; |- ! style=&amp;quot;text-align:left&amp;quot; | Name !! Part !! style=&amp;quot;text-align:left;width:10%&amp;quot; | By |- | Set up a verb coin interface with screen-centered i...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| class=&amp;quot;ts&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align:left&amp;quot; | Name !! Part !! style=&amp;quot;text-align:left;width:10%&amp;quot; | By&lt;br /&gt;
|-&lt;br /&gt;
| Set up a verb coin interface with screen-centered inventory (MI3 style) || Part 2 of 2 || Einzelkämpfer&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This tutorial describes how to set up a verb coin interface together with an inventory that appears in the center of the screen – very much like what you find in the 1997 adventure game, ''The Curse of Monkey Island (MI3)''. We're not going to recreate the MI3 controls in all their details, but the basic mechanism will be the same.&lt;br /&gt;
&lt;br /&gt;
This is a 2 part tutorial:&lt;br /&gt;
* '''Part 1''' covers the basics: setting up the coin interface and the inventory. There is no scripting involved in this part. Everything is done with Visionaire's settings and action system only.&lt;br /&gt;
* '''Part 2 (this page)''' completes the action text part of the MI3 example, because at the end of part 1 we'll see that it is not fully working as desired yet. It also adds more command variety, because in MI3 the commands vary depending on the object they are used on. The parrot depicted on the verb coin can mean &amp;quot;Talk&amp;quot; or &amp;quot;Eat&amp;quot; or &amp;quot;Blow&amp;quot;, for example. We have to use some Lua script here – and a bit of fiddling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download the project files at the bottom of both tutorial pages. Most of the graphics were created by Esmeralda for her [[Building a Save/Load Menu|menu tutorial]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot; style=&amp;quot;font-size:20px;font-weight:bold&amp;quot;&amp;gt;Verb Coin Interface Tutorial&amp;lt;br&amp;gt;[[Verb Coin Interface Tutorial Part 1|Part 1]] &amp;amp;nbsp;&amp;amp;nbsp;//&amp;amp;nbsp;&amp;amp;nbsp; Part 2&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What to do (1) ==&lt;br /&gt;
&lt;br /&gt;
We start where we left off in part 1. The action text doesn't work well for our dragging command. And that's no surprise, because our standard &amp;quot;walk&amp;quot; command which is used for dragging items neither has a name nor a conjuction word (&amp;quot;...with...&amp;quot;) defined in the command properties. And that's perfectly fine in most cases. But we want to show sentence-like action text in our game, so we need to change our setup slightly.&lt;br /&gt;
&lt;br /&gt;
We can't just name our standard command &amp;quot;Use&amp;quot;, because that would be displayed all the time when walking through the scene. And we also can't utilize our regular &amp;quot;Use&amp;quot; command for dragging items from the inventory, because we still need the option to apply this regular &amp;quot;Use&amp;quot; command to an item. These requirements would interfere with each other (believe me, I tried it, it doesn't work). Besides, we will modify our three commands later anyway.&lt;br /&gt;
&lt;br /&gt;
The solution is a fifth command, solely used for dragging items.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add a new dragging command ==&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Set up drag command.png|thumb|400px]]&lt;br /&gt;
* In the &amp;quot;Coin&amp;quot; interface add a new button and name it &amp;quot;use_drag&amp;quot;.&lt;br /&gt;
* In the &amp;quot;Button properties&amp;quot; choose &amp;quot;Command button&amp;quot; as &amp;quot;Button type&amp;quot;.&lt;br /&gt;
* In the &amp;quot;Command properties&amp;quot; enter &amp;quot;Use&amp;quot; as the name, set the &amp;quot;arrow&amp;quot; cursor and check the option &amp;quot;Items can be dragged with this command&amp;quot;.&lt;br /&gt;
* Change the &amp;quot;Command type&amp;quot; to &amp;quot;Combined command&amp;quot; and enter &amp;quot;with&amp;quot; as the &amp;quot;Conjunction word&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Keep the dragging option checked for the &amp;quot;walk&amp;quot; command, too. I will explain later.&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
== Activate/Deactivate the dragging command ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;use_drag&amp;quot; command has only one purpose: drag the items from the inventory. So it needs to be active inside the inventory, and be deactivated outside of it – unless it drags an item out. Let's see where we need to set the drag command and the standard command, respectively, to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Show and hide the inventory ===&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Modify right click action.png|thumb|400px]]&lt;br /&gt;
* In the global right click action, add the following action parts:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Right underneath &amp;quot;Show Secondary interface&amp;quot; add &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command&amp;lt;/span&amp;gt; and select the &amp;quot;use_drag&amp;quot; command.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;10&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Right above &amp;quot;Hide Inventory&amp;quot; add &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command&amp;lt;/span&amp;gt; and select &amp;quot;Standard command&amp;quot;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[[File:Verb coin tutorial - Modify inventory action on leaving.png|thumb|400px]]&lt;br /&gt;
Another way to hide the interface is by leaving it with the cursor. We have to differentiate between just leaving and dragging an item out of the inventory. In the latter case we must not set the standard command.&lt;br /&gt;
&lt;br /&gt;
* In the interface settings of the &amp;quot;Inventory&amp;quot; open the &amp;quot;Action on leaving&amp;quot; and append the following action parts:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;4&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If lua result:&amp;lt;/span&amp;gt; enter &amp;lt;code&amp;gt;return game.UsedItem:isEmpty()&amp;lt;/code&amp;gt;. The following action parts will only be executed, if no item is currently dragged.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command: &amp;lt;/span&amp;gt; select &amp;quot;Standard command&amp;quot;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
=== Coin operations ===&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Modify coin interface action on leaving.png|thumb|400px]]&lt;br /&gt;
* In the settings of the &amp;quot;Coin&amp;quot; interface open the &amp;quot;Action on leaving&amp;quot; and append the following action parts:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;4&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If condition:&amp;lt;/span&amp;gt; select the &amp;quot;inventory_visible&amp;quot; condition and &amp;quot;true&amp;quot;. The following action parts will only be executed, if the inventory is visible.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command: &amp;lt;/span&amp;gt; select &amp;quot;use_drag&amp;quot;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[[File:Verb coin tutorial - Modify button hold (released) action.png|thumb|400px]]&lt;br /&gt;
* Open the action for &amp;quot;Left mouse button hold (button released)&amp;quot; and add the following action parts right underneath &amp;quot;Hide Main interface&amp;quot;:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;6&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If condition:&amp;lt;/span&amp;gt; select the &amp;quot;inventory_visible&amp;quot; condition and &amp;quot;true&amp;quot;. The following action parts will only be executed, if the inventory is visible.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command: &amp;lt;/span&amp;gt; select &amp;quot;use_drag&amp;quot;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[[File:Verb coin tutorial - Modify button hold (pressed) action 1.png|thumb|400px]]&lt;br /&gt;
* Open the action for &amp;quot;Left mouse button hold (button pressed)&amp;quot; and add the following action parts:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If lua result:&amp;lt;/span&amp;gt; enter &amp;lt;code&amp;gt;return game.UsedItem:isEmpty()&amp;lt;/code&amp;gt;. The coin will only show, if we don't have an item dragged. That seems like a good idea anyway and solves the problem of setting the right command easily.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
=== Drop item on item ===&lt;br /&gt;
&lt;br /&gt;
After successful execution of an action, the standard command is automatically set. If we drop an item on another item in the inventory however, we need to keep the &amp;quot;use_drag&amp;quot; command set, because the inventory will stay visible. Unfortunately, there is no way to globally detect a successful execution. But it turned out that it is enough to just handle left clicks in general: whenever the user clicks with the left mouse button inside the inventory, the drag command is set – unless the coin is visible.&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Set up left click action.png|thumb|400px]]&lt;br /&gt;
* Open the action for &amp;quot;Left mouse button&amp;quot; and add the following action parts:&lt;br /&gt;
# &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If condition:&amp;lt;/span&amp;gt; select the &amp;quot;inventory_visible&amp;quot; condition and &amp;quot;true&amp;quot;.&lt;br /&gt;
# &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;If condition:&amp;lt;/span&amp;gt; select the &amp;quot;interface_visible&amp;quot; condition and &amp;quot;false&amp;quot;.&lt;br /&gt;
# &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Set command: &amp;lt;/span&amp;gt; select &amp;quot;use_drag&amp;quot;.&lt;br /&gt;
# &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;End if&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding:7px&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* Add the exact same action parts to the global &amp;quot;Double click&amp;quot; action as well. This is necessary because the action of the item on item operation gets executed by double click, too. Evil trap.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Release the dragged item on right click ===&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Mouse events script.png|thumb|400px]]&lt;br /&gt;
Now for one of those nasty issues that are easily overlooked.&lt;br /&gt;
&lt;br /&gt;
A click with the right mouse button releases a dragged item from the cursor and aborts that operation without executing an action. This behaviour is built into Visionaire and can't be changed (well, maybe it can be changed, but I have no idea how; and we actually don't want to change it at all). If our cursor hasn't left the inventory yet, this doesn't cause any problems. However, if we right-click after dragging the item out of the inventory, the item disappears (as expected), but the &amp;quot;use_drag&amp;quot; command stays active, because no action has been executed. That command is of no use outside of the inventory and we need to activate the standard command instead.&lt;br /&gt;
&lt;br /&gt;
Again, there is no way to directly detect when a dragged item has been released from the cursor. We also can't utilize the global right click action, because it doesn't get executed in that case. So let's fiddle with Lua code.&lt;br /&gt;
&lt;br /&gt;
* Add a new Lua script and name it &amp;quot;mouse_events&amp;quot;.&lt;br /&gt;
* Make sure that the &amp;quot;definition script&amp;quot; option is checked, and add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onMouseEvent(eventType, mousePosition)&lt;br /&gt;
  if eventType == eEvtMouseRightButtonUp then &lt;br /&gt;
    if not game.UsedItem:isEmpty() then&lt;br /&gt;
      if Conditions[&amp;quot;inventory_visible&amp;quot;].Value == false then&lt;br /&gt;
        game.ActiveCommand = Buttons[&amp;quot;walk&amp;quot;]&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end  &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
registerEventHandler(&amp;quot;mouseEvent&amp;quot;, &amp;quot;onMouseEvent&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last line tells the engine that we want to register an event handler for the mouse events. That means that whenever the user moves the mouse or clicks or scrolls, the function &amp;quot;onMouseEvent&amp;quot; is called. This is a custom function and we are free to do whatever we want inside it. It's worth mentioning that this mouse event is triggered before Visionaire does anything else, so in our case our function is executed before the Visionaire player releases the dragged item.&lt;br /&gt;
&lt;br /&gt;
* The line starting &amp;lt;code&amp;gt;if eventType...&amp;lt;/code&amp;gt; checks for the mouse action. We only want do do something for right click.&lt;br /&gt;
* The line starting &amp;lt;code&amp;gt;if not game...&amp;lt;/code&amp;gt; checks if an item is currently dragged.&lt;br /&gt;
* The line starting &amp;lt;code&amp;gt;if Conditions...&amp;lt;/code&amp;gt; checks if the inventory is currently hidden.&lt;br /&gt;
* The line starting &amp;lt;code&amp;gt;game.ActiveCommand...&amp;lt;/code&amp;gt; sets the standard command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Not important but interesting: If you are curious why we kept the ability to drag items with the standard &amp;quot;walk&amp;quot; command... The moment we set the standard command on right click in our script above, we would already release the dragged item, if the standard command wasn't able to hold it. The release of the item was about to happen anyway, so that doesn't seem to make much of a difference. But when the Visionaire player continues and there is no item to release anymore, it will execute the global right click action, showing the inventory. That's not what we want in this case. Wasn't interesting? – Sorry, now it's too late to not read it.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What to do (2) ==&lt;br /&gt;
&lt;br /&gt;
Now for the final step of this tutorial. As said before, the command buttons in MI3 are context-sensitive. The '''hand''' icon, for example, stands for &amp;quot;Take&amp;quot;, &amp;quot;Push&amp;quot;, or &amp;quot;Use&amp;quot;, depending on the object it is applied to.&lt;br /&gt;
&lt;br /&gt;
To recreate this, we will add command buttons for all possible commands and enable only the ones that apply to the current object. The &amp;quot;Look&amp;quot; command will stay the only command for the eye icon, but we will add several new commands for the hand and mouth icons.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Add more commands ==&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Set up more game commands.png|thumb|400px]]&lt;br /&gt;
* Add two values to the coin interface and name them &amp;quot;which_hand_command&amp;quot; and &amp;quot;which_mouth_command&amp;quot;, respectively. Set their value to 1. Those values will control which of the hand commands and which of the mouth commands are currently enabled.&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding:7px&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* Rename the &amp;quot;use&amp;quot; command to &amp;quot;hand_1_use&amp;quot;. It will become our first hand command, thus being enabled by default.&lt;br /&gt;
* In the &amp;quot;Button properties&amp;quot; link the &amp;quot;which_hand_command&amp;quot; value and make it validate for &amp;quot;= 1&amp;quot;.&lt;br /&gt;
* Duplicate the &amp;quot;hand_1_use&amp;quot; button twice and rename the new buttons &amp;quot;hand_2_take&amp;quot; and &amp;quot;hand_3_push&amp;quot;. By duplicating the buttons you also duplicate all the settings including the image and object area. That saves you a lot of hassle.&lt;br /&gt;
* In the &amp;quot;Button properties&amp;quot; of the new buttons make the value validate for &amp;quot;= 2&amp;quot; and &amp;quot;= 3&amp;quot;, respectively.&lt;br /&gt;
* In the &amp;quot;Command properties&amp;quot; name the new buttons &amp;quot;Take&amp;quot; and &amp;quot;Push&amp;quot;, respectively.&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding:7px&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* Repeat all this for the mouth buttons, bind them to the &amp;quot;which_mouth_command&amp;quot; value. The &amp;quot;talk&amp;quot; command will become &amp;quot;mouth_1_talk&amp;quot;, the other buttons are &amp;quot;mouth_2_eat&amp;quot;, &amp;quot;mouth_3_drink&amp;quot;, &amp;quot;mouth_4_blow&amp;quot;, and &amp;quot;mouth_5_bite&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Enable/Disable commands ==&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Set coin script.png|thumb|400px]]&lt;br /&gt;
Now how do we enable/disable certain commands depending on the object we click on? – The idea is to add a value called &amp;quot;set_hand&amp;quot; and/or &amp;quot;set_mouth&amp;quot; to the object and set the value of the command we wish to have available. So for the mushroom in our project file, we would add a &amp;quot;set_hand&amp;quot; value with a value of 2, and when we now open the verb coin on the mushroom, the hand command is &amp;quot;Take&amp;quot; instead of &amp;quot;Use&amp;quot;. We don't have to add values to all of our objects though. If no value is found, the default command is enabled: &amp;quot;Use&amp;quot; and &amp;quot;Talk&amp;quot;, respectively.&lt;br /&gt;
&lt;br /&gt;
To make the whole thing work we need another script:&lt;br /&gt;
&lt;br /&gt;
* Add a new Lua script and name it &amp;quot;set_coin&amp;quot;.&lt;br /&gt;
* Uncheck the &amp;quot;definition script&amp;quot; option, and add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
if game.SavedObject ~= nil then&lt;br /&gt;
  if game.SavedObject.Values[&amp;quot;set_hand&amp;quot;] ~= nil then&lt;br /&gt;
    Values[&amp;quot;which_hand_command&amp;quot;].Int = game.SavedObject.Values[&amp;quot;set_hand&amp;quot;].Int&lt;br /&gt;
  else&lt;br /&gt;
    Values[&amp;quot;which_hand_command&amp;quot;].Int = 1&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if game.SavedObject.Values[&amp;quot;set_mouth&amp;quot;] ~= nil then&lt;br /&gt;
    Values[&amp;quot;which_mouth_command&amp;quot;].Int = game.SavedObject.Values[&amp;quot;set_mouth&amp;quot;].Int&lt;br /&gt;
  else&lt;br /&gt;
    Values[&amp;quot;which_mouth_command&amp;quot;].Int = 1&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The line starting &amp;lt;code&amp;gt;if game.SavedObject ~=...&amp;lt;/code&amp;gt; checks if an object has been saved for execution at all.&lt;br /&gt;
* The following if query block looks for a value named &amp;quot;set_hand&amp;quot; attached to the object and sets &amp;quot;which_hand_command&amp;quot; to that value if found. If &amp;quot;set_hand&amp;quot; is not found, the default value of 1 (&amp;quot;Use&amp;quot; command) is set.&lt;br /&gt;
* The lower block of code lines does the same for the mouth commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have to call that script right before showing the verb coin:&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Modify button hold (pressed) action 2.png|thumb|400px]]&lt;br /&gt;
* Open the action for &amp;quot;Left mouse button hold (button pressed)&amp;quot; and add the following action part right underneath &amp;quot;Save object&amp;quot;:&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;span class=&amp;quot;inlinecode&amp;quot;&amp;gt;Call script:&amp;lt;/span&amp;gt; select the &amp;quot;set_coin&amp;quot; script.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
== How to work with the commands ==&lt;br /&gt;
&lt;br /&gt;
[[File:Verb coin tutorial - Demo game 2.png|thumb|400px]]&lt;br /&gt;
It's as simple as it can be. If you want to use the &amp;quot;Take&amp;quot; command instead of the default &amp;quot;Use&amp;quot; command on the mushroom, add a value named &amp;quot;set_hand&amp;quot; to the mushroom object and set it to 2. Then add an action with execution type &amp;quot;Executed command on object&amp;quot; and select the &amp;quot;hand_2_take&amp;quot; command. It is even possible to change the &amp;quot;set_hand&amp;quot; value on runtime, if you want to treat an object in different ways as the game progresses.&lt;br /&gt;
&lt;br /&gt;
In the project file I added the following example actions:&lt;br /&gt;
* You can &amp;quot;take&amp;quot; the mushroom using the hand command.&lt;br /&gt;
* You can try to &amp;quot;eat&amp;quot; the picked-up mushroom in your inventory using the mouth command.&lt;br /&gt;
* You can try to &amp;quot;take&amp;quot; the gnome. Once you did that und use the hand command again, you try to &amp;quot;push&amp;quot; him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Are we done now? ==&lt;br /&gt;
&lt;br /&gt;
I think so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot; style=&amp;quot;font-size:20px;font-weight:bold&amp;quot;&amp;gt;Verb Coin Interface Tutorial&amp;lt;br&amp;gt;[[Verb Coin Interface Tutorial Part 1|Part 1]] &amp;amp;nbsp;&amp;amp;nbsp;//&amp;amp;nbsp;&amp;amp;nbsp; Part 2&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
{| class=&amp;quot;ts&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align:left&amp;quot; | Name !! style=&amp;quot;text-align:left&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [[media:vistut_verb_coin_interface_and_inventory.zip|vistut_verb_coin_interface_and_inventory.zip]] || Project files for this tutorial (created with Visionaire Studio 5.1.9.2)&lt;br /&gt;
|}{{toc}}&lt;/div&gt;</summary>
		<author><name>EK</name></author>	</entry>

	</feed>