Hiding and Showing "Verbs"

Anonynn
20 Jul 2016, 00:22I was also wondering, how you "hide" and "show" verbs once certain parameters are met....either in conversation or whatever other variables you can think of. Is that even possible?
hegemonkhan
20 Jul 2016, 01:48I'm not sure of how the built-in system works with the hyperlinks (there's more toggle options and etc stufff involved I think), but for at least th button aspect of Verbs:
they're displayed in the 'object and places' pane via that Object's 'displayverbs' (when the Object is not in your inventory) and 'inventoryverbs' (when the Object is in your inventory) String List Attributes.
for example (using a Command to demonstrate it):
<command name="add_remove_fight_verb_command">
<pattern>togglefight</pattern>
<script>
if (not ListContains (player.displayverbs, "fight")) {
list add (player.displayverbs, "fight")
} else if (ListContains (player.displayverbs, "fight")) {
list remove (player.displayverbs, "fight")
}
</script>
</command>
<command name="add_remove_talk_verb_command">
<pattern>toggletalk</pattern>
<script>
if (ListContains (player.displayverbs, "talk")) {
list remove (player.displayverbs, "talk")
} else if (not ListContains (player.displayverbs, "talk")) {
list add (player.displayverbs, "talk")
}
</script>
</command>
<command name="add_remove_look_verb_command">
<pattern>togglelook</pattern>
<script>
if (ListContains (player.displayverbs, "look")) {
list remove (player.displayverbs, "look")
} else if (not ListContains (player.displayverbs, "look")) {
list add (player.displayverbs, "look")
}
</script>
</command>
<object name="orc">
<attr name="talk" type="script">
msg ("You talk to the orc.")
</attr>
<attr name="look" type="script">
msg ("You look at the orc.")
</attr>
<attr name="fight" type="script">
msg ("You fight the orc.")
</attr>
<attr name="displayverbs" type="simplestringlist">talk;look</attr>
</object>
<verb>
<property>talk</property>
<pattern>talk</pattern>
<defaultexpression>You can't talk to that!</defaultexpression>
</verb>
<verb>
<property>look</property>
<pattern>look</pattern>
<defaultexpression>You can't look at that!</defaultexpression>
</verb>
<verb>
<property>fight</property>
<pattern>fight</pattern>
<defaultexpression>You can't fight that!</defaultexpression>
</verb>
if you create a new List Attribute (with same name for same object of course), it over-rides (effectively erases) the old one, which can be sometimes better than just adding/removing items from the List Attribute, and other times, the adding/removing items is better than creating a new List Attribute (again, with same name for same object, of course) that overrides the old one.
one way to over-ride an existing list:
// old list: orc.displayverbs = split ("talk;look;fight", ";")
orc.displayverbs = split ("loot;eat;burn", ";")
// new (over-ridden) list in code would conceptually look like this: orc.displayverbs = split ("loot;eat;burn", ";")
// old list: orc.displayverbs = split ("talk;look;fight", ";")
orc.displayverbs = split ("loot;eat;burn;talk;look;fight", ";")
// new (over-ridden) list in code would conceptually look like this: orc.displayverbs = split ("loot;eat;burn;talk;look;fight", ";")
// old list: orc.displayverbs = split ("talk;look;fight", ";")
orc.displayverbs = split ("talk;look;fight;loot;eat;burn", ";")
// new (over-ridden) list in code would conceptually look like this: orc.displayverbs = split ("talk;look;fight;loot;eat;burn", ";")
and the other way to over-ride an existing List (whatever items it had, will be wiped out/removed/erased, it's wiped clean):
// old List example: orc.displayverbs = split ("talk;look;fight", ";")
orc.displayverbs = NewStringList ()
// new (over-ridden) List conceptually: orc.displayverbs = split ("{blank/empty};{blank/empty};{etc etc etc blank/empty}, ";")
to then add your items to the blank item'ed new (over-ridden) List:
list add (orc.displayverbs, "loot")
list add (orc.displayverbs, "eat")
list add (orc.displayverbs, "burn")
// now the List, in code would look like this, conceptually: orc.displayverbs = split ("loot; eat; burn", ";")
// notice how there's no 'talk', 'chat', and nor 'fight' items
if we want to add those back into the new list:
// (now as) old list: orc.displayverbs = split ("loot; eat; burn", ";")
list add (orc.displayverbs, "talk")
list add (orc.displayverbs, "look")
list add (orc.displayverbs, "fight")
// new list, in code would look like this conceptually: orc.displayverbs = split ("loot;eat;burn;talk;look;fight", ";")
if we wanted to include those old items with the new items in one go through creating a new (over-riding) list, we'd have done this:
// old List example: orc.displayverbs = split ("talk;look;fight", ";")
orc.displayverbs = NewStringList ()
list add (orc.displayverbs, "talk")
list add (orc.displayverbs, "look")
list add (orc.displayverbs, "fight")
list add (orc.displayverbs, "loot")
list add (orc.displayverbs, "eat")
list add (orc.displayverbs, "burn")
// new list, in code it would look like this conceptually: orc.displayverbs = split ("talk;look;fight;loot;eat;burn", ";")

Anonynn
20 Jul 2016, 02:05Oh, so you can use commands then. Thanks HK! :D :D
hegemonkhan
20 Jul 2016, 02:12You can use any Element (Function, Object's Verb / Object's Script Attribute, Command, Turnscript, Timer, Object Type, etc etc) that can have scripting, as you can use the List usage scripting to add/remove items, and/or create a new list and/or over-ride an existing one.
the display of your Object's Verbs (Script Attributes that also have the 'Verb' creation tags with them in the game code --- or just use the GUI~Editor to create/add your Verbs and then use this scripting to manipulate them) in your pane, is controlled via what's inside of these built-in List Attributes:
OBJECT_NAME.displayverbs
OBJECT_NAME.inventoryverbs
hegemonkhan
20 Jul 2016, 02:14P.S.
Pixie has a guide on all of this stuff (using/manipulating its items/adding items/removing items/creating/over-riding of the built-in 'displayverbs' and 'inventoryverbs' (as well as for any other built-in List Attributes and also your own custom List Attributes you create too) String List Attributes) here:
http://textadventures.co.uk/forum/samples/topic/5023/how-to-use-display-verbs-and-inventory-verbs-effectively