Commands Vs Object Functions

OurJud
08 Dec 2014, 05:13Maybe I'm missing out on lots of features and simple/correct ways of doing things with objects, but I no longer see the point in giving objects their own functionality such as 'edible', 'enterable', 'open/closable', etc, when I can control all that with command patterns that run a script. There are exceptions, such as setting something to a container, for instance (as in the case of my knapsack), so that things can be put inside, or a torch to 'switchable'.
So let's take food as an example.
My first job when creating an object is to imagine all the things a player might want to do with it. So, instead of bothering with the objects 'can be eaten' tab', I'd just set a series of commands on that object. If it were an apple, for instance, I would set a command pattern for 'throw apple; toss apple; lob apple;' and then run a script which checks the player is carrying the apple before throwing out a response to the command. I would then set a pattern for 'eat apple; consume apple...' and so on until I'd exhausted everything a player might want to logically do with it.
Maybe that wasn't the best example, but my point is that so far, I've been able to control the use of objects by setting commands on the object and/or room it is likely to used in, rather than religiously giving each its own set of functionality tabs by setting its 'type'.
Marzipan
08 Dec 2014, 05:24Are verbs basically just 'easy mode' for someone who doesn't want to mess with custom commands?

OurJud
08 Dec 2014, 05:40If you were prepared to put in enough work and time, you could have a logical and unique response to practically anything a player typed.
HegemonKhan
08 Dec 2014, 05:41-> Commands (fully customizable COMMAND)
-> Verbs (limited customization COMMAND)
Verbs are just a sub-Command, they're local, aka they only work upon~for that specific Object; their customization is limited to only acting upon that specific object, yes in essence it's a simplified (less customiz'able) Command.
Object: knapsack
Verb: take (it applies 'take' specifically~only for the 'knapsack' Object)
Object: sword
Verb: take (it applies 'take' specifically~only for the 'sword' Object)
Commands are fully customizable; they're global, they can act upon any object:
pattern: take #object#
Script: MoveObject (object, player)
Script: msg ("You take the " + object.name + ".")
------------
all built-in scripting (take, takeall, take xxx, drop, dropall, drop xxx, etc etc etc) are Commands, though as you've realized, they're very broad~generalized, whereas in making your own Commands, you can make them more specifically (though this is a bit of 're-inventing the wheel', as this is the purpose of Verbs. In a way, OurJud, you're basically creating your own Verbs, but via as Commands. Though, if you want to use the user's inputs, then you need to use Commands, as Verbs use the buttons and hyperlinks, so you're doing it perfectly OurJud for your game making design of using inputs only, hehe).

OurJud
08 Dec 2014, 05:44HegemonKhan wrote:... so you're doing it perfectly OurJud for your game making design of using inputs only, hehe).
Cool! Thanks

Marzipan
08 Dec 2014, 05:53OurJud wrote:The thing with setting verbs is you're limited to one word.
This is the deal-breaker for me. If there was just a way to set aliases I'd probably use them a lot more.
HegemonKhan
08 Dec 2014, 05:57Verbs are for specific Objects:
Object: sword
Verb: take
Script: msg ("You take the sword in your hand, vowing revenge upon the death of your family.")
Script: MoveObject (sword, player)
Object: cuirass
Verb: take
// obviously, we don't want the 'sword' Object's response~msg Script to be used, as it is just for the sword, we don't want it to be global, as it is specific~local (for the sword ONLY), hence the purpose of Verbs
Script: msg ("You put on the cuirass, to protect you as you seek vengence upon the murderers of your family.")
Script: MoveObject (cuirass, player)
VS
Commands are for global~generalized~broad usages:
Command: take_command
Pattern: take #object#
Script: msg ("You equip the " + object.name + ", vowing revenge upon the murderers of your family.")
Script: MoveObject (object, player)
Commands also can be scripted for specific Object usages too:
~ OurJud's specific usage (simplified coding):
Command: take_sword
Pattern: take sword
Script: msg ("You take the sword in your hand, vowing revenge upon the death of your family.")
Script: MoveObject (sword, player)
Command: take_cuirass
Pattern: take cuirass
Script: msg ("You put on the cuirass, to protect you as you seek vengence upon the murderers of your family.")
Script: MoveObject (cuirass, player)
Complex Logic Coding (specific usage):
Command: take_command
Pattern: take #object#
Script: if (object.name = "sword") {
-> Script: msg ("You take the sword in your hand, vowing revenge upon the death of your family.")
Script: if (object.name = "cuirass") {
-> Script: msg ("You take the cuirass, to protect you as you seek vengence upon the murderers of your family.")
Script: } else {
-> Script: msg ("You take the " + object.name + ", vowing revenge upon the murderers of your family.")
Script: }
Script: MoveObject (object, player)
or, even more complex logic coding:
(not the best code, but it should get the idea across)
Command: take_command
Pattern: take #object#
Script: if (object.equipment_type = "sword") {
-> Script: if (object.name = "fire_sword") {
->-> Script: msg ("You take the fire sword in your hand, vowing revenge upon the death of your family.")
-> Script: } else if (object.name = "water_sword") {
->-> Script: msg ("You take the water sword in your hand, vowing revenge upon the death of your family.")
-> Script: }
Script: } else if (object.equipment_type = "mail") {
-> Script: if (object.name = "dragon_mail") {
->-> Script: msg ("You take the dragon mail, to protect you as you seek vengence upon the murderers of your family.")
-> Script: } ekse if (object.name = "mithril_mail") {
->-> Script: msg ("You take the mithril mail, to protect you as you seek vengence upon the murderers of your family.")
-> Script: }
Script: } else {
-> Script: msg ("You take the " + object.name + ", vowing revenge upon the murderers of your family.")
Script: }
Script: MoveObject (object, player)

OurJud
08 Dec 2014, 05:57Marzipan wrote:"OurJud"
The thing with setting verbs is you're limited to one word.
If there was just a way to set aliases I'd probably use them a lot more.
There is. Every object and room has a 'name' field and an 'alias' field.
Which is something I've been meaning to ask, which of these does the game recognise in commands?
If I created a gun as an object, gave it the name 'gun' and the alias 'pistol', does this simply mean the game would understand both 'get gun' and 'get pistol' ? Or does the alias have another function?
Marzipan
08 Dec 2014, 06:32As far as object aliases, the most use I've gotten out of them is when Quest won't let me name a room properly, I can still have it show up to the player the way I want with an alias.

OurJud
08 Dec 2014, 06:39Marzipan wrote:No, I meant aliases for the verbs. Say I've got a pinata object, with a command I can let the player break, smash, or hit it, but with verbs I'm limited to just one.
As far as object aliases, the most use I've gotten out of them is when Quest won't let me name a room properly, I can still have it show up to the player the way I want with an alias.
Oh, is that what they're for? I disabled the option to display the room name in descriptions, right from the word go.
HegemonKhan
08 Dec 2014, 06:52#object# only searches for what is in your inventory, however
// Object ('Name' String Attribute): player
// Object 'Alias' String Attribute: HK
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
msg ("hi, " + text.name + ".")
// outputs: hi, player.
</script>
</command>
<command name="hi_command">
<pattern>hi #object#</pattern>
<script>
msg ("hi, " + object.alias + ".")
// outputs: hi, player.
</script>
</command>
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
msg ("hi, " + text.alias + ".")
// outputs: hi, HK.
</script>
</command>
<command name="hi_command">
<pattern>hi #object#</pattern>
<script>
msg ("hi, " + object.name + ".")
// outputs: hi, HK.
</script>
</command>
// -----------------------
// Object ('Name' String Attribute): player
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
msg ("hi, " + text.name + ".")
// outputs: hi, player.
</script>
</command>
<command name="hi_command">
<pattern>hi #object#</pattern>
<script>
msg ("hi, " + object.alias + ".")
// outputs: ERROR!
</script>
</command>
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
msg ("hi, " + text.alias + ".")
// outputs: ERROR!
</script>
</command>
<command name="hi_command">
<pattern>hi #object#</pattern>
<script>
msg ("hi, " + object.name + ".")
// outputs: hi, HK.
</script>
</command>
// -------------------
// Object ('Name' String Attribute): player
// Object 'Alias' String Attribute: HK
// but the person playing the game, doesn't know that the Object's 'name' is 'player', they're only able to thus type in: 'HK'
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
// user types in: HK
object_x = GetObject (text)
msg ("hi, " + object_x.name + ".")
// outputs: ERROR, as there is no Object (NAMED) 'HK'
</script>
</command>
<command name="hi_command">
<pattern>hi #text#</pattern>
<script>
// user types in: HK
object_x = GetObject (text)
if (object_x = null) {
foreach (object_xx, AllObjects () ) {
if (object_xx.alias = text) {
object_x = object_xx
}
}
}
if (not object_x = null) {
msg ("hi, " + object_x.name + ".")
// outputs: hi, player.
}
</script>
</command>
Marzipan
08 Dec 2014, 06:57I'm sure it has plenty of other uses too. Have the actual name be something short and easy to refer to in the code, or have an object1, object2, object3 that can all be switched around while looking the same to the player, etc.
HegemonKhan
08 Dec 2014, 07:12Object Name: orc_mlvl_99
Object Alias: orc king
Object Name: orc_mlvl_01
Object Alias: orc baby
Object Name: orc_mlvl_50
Object Alias: orc berserker
or
Object Name: monster_01
Object Alias: orc
Object Name: monster_02
Object Alias: ogre
Object Name: monster_03
Object Alias: troll
Object Name: npc_01
Object Alias: wise owl
Object Name: npc_02
Object Alias: ged the wizard
Object Name: npc_03
Object Alias: john the merchant
Object Name: pc_01
Object Name: HK
Object Name: pc_02
Object Name: OJ
Object Name: pc_03
Object Name: Marz
or to be even more secretive towards the player of your game:
Object Name: orc_mlvl_99
Object Alias: orc
Object Name: orc_mlvl_01
Object Alias: orc
Object Name: orc_mlvl_50
Object Alias: orc
as you don't want them to know if they're facing a powerful monster or a weak monster ahead of time.
HegemonKhan
08 Dec 2014, 08:02Marzipan wrote:No, I meant aliases for the verbs. Say I've got a pinata object, with a command I can let the player break, smash, or hit it, but with verbs I'm limited to just one.
As far as object aliases, the most use I've gotten out of them is when Quest won't let me name a room properly, I can still have it show up to the player the way I want with an alias.
there's one 'not quite' method for doing this:
use the Object as a more general category, for your 'sub' Verbs:
(just a quick and poor example, lol)
Object: character
Verb: stats
Verb: equipment
Verb: magic
Verb: items
Object: action
Verb: fight
Verb: magic
Verb: steal
Verb: sneak
Verb: talk
Verb: sleep
Verb: rest
Object: travel
Verb: homeland
Verb: grassland
Verb: dungeon
Verb: castle
Verb: town
The Pixie
08 Dec 2014, 08:13Verbs do not have a list like that, but you can still have multiple words, you just separate them with a semi-colon in the first text box (i.e., the unlabelled one above attribute).
The advantage of verbs is that you do not have to worry about whether the action is applicable to the object. For example, you can set a SMASH verb for an item, and in the script you know what the item is. If you use a command, you first have to check if the item is smashable. It is not a big deal really. Where verbs become really good is when you make up your own types, but you might want to wait a while before looking at that.

OurJud
08 Dec 2014, 14:59The Pixie wrote:The advantage of verbs is that you do not have to worry about whether the action is applicable to the object. For example, you can set a SMASH verb for an item, and in the script you know what the item is. If you use a command, you first have to check if the item is smashable. It is not a big deal really. Where verbs become really good is when you make up your own types, but you might want to wait a while before looking at that.
I'm struggling to get my head around that one. Why does using a verb mean you don't have to check if the item is smashable?
Let's say I have a vase, and on that vase I set a command pattern of 'smash vase; break vase; throw vase' which runs a script describing the action of smashing it, how are you saying it would be done better with a verb?
Marzipan
08 Dec 2014, 15:00The Pixie wrote:Verbs do not have a list like that, but you can still have multiple words, you just separate them with a semi-colon in the first text box (i.e., the unlabelled one above attribute).
See, I was sure I tried that before and just got a bunch of weird errors, but now I've got it working. Though it still feels slightly clunky that you go to the object to create the verb, then go to the 'Verb' list on the left to add the aliases, and then go back to the object to print the message. Seems like that's something that would be simpler if it was all done in one place.
Marzipan
08 Dec 2014, 15:05Let's say I have a vase, and on that vase I set a command pattern of 'smash vase; break vase; throw vase' which runs a script describing the action of smashing it, how are you saying it would be done better with a verb?
The benefit I can see is that you don't have to worry about having a script check if the player is holding the object first. And if you have several smashable items in the game, you can just quickly attach the same verb to each one.
I'll probably still just stick with commands for the most part, though.
HegemonKhan
08 Dec 2014, 21:40OurJud wrote:"The Pixie"
The advantage of verbs is that you do not have to worry about whether the action is applicable to the object. For example, you can set a SMASH verb for an item, and in the script you know what the item is. If you use a command, you first have to check if the item is smashable. It is not a big deal really. Where verbs become really good is when you make up your own types, but you might want to wait a while before looking at that.
I'm struggling to get my head around that one. Why does using a verb mean you don't have to check if the item is smashable?
Let's say I have a vase, and on that vase I set a command pattern of 'smash vase; break vase; throw vase' which runs a script describing the action of smashing it, how are you saying it would be done better with a verb?
because you wouldn't create~add a 'smash' Verb to that Object, unless that Object is an Object that you want to be 'smashable' (which, in this case), it would have the 'smash' Verb added to it, making it be 'smashable'.
Object: vase
Verb: smash
Object: the_concept~idea_of_love (or whatever can't be logically 'physically smashed', as my mind is failing me, lol)
Verb: (whatever Verb, except for a 'smash' Verb)
---------------------
very easy: you select the Verbs for each Object:
Object: monster
Verb: fight
Object: townsperson
Verb: talk
Object: merchant
Verb: buy
Verb: sell
as it would be il-logical to do the reverse:
Object: monster
Verb: talk
Object: townsperson
Verb: fight
Object: monster
Verb: talk
Verb: fight
Object: townsperson
Verb: fight
Verb: talk
or the il-logical:
Object: chest
Verb: goto // HUH?!
Object: forest (room)
Verb: open // HUH?!
Object: forest (room)
Verb: buy // HUH?!
Verb: sell // HUH?!
and it's this simple, just add the Verbs that you want that Object you have, to distinguish the Objects from one another.
VS
a Command:
(err, I didn't really use different Verb examples ~ oops I messed up, but you get the idea hopefully)
<game name="xxx">
</game>
<object name="room">
<object name="player">
<object name="potion_storage_object">
</object>
<object name="sword_storage_object">
</object>
<object name="axe_storage_object">
</object>
<object name="food_storage_object">
</object>
</object>
</object>
<command name="godtake_command">
<pattern>godtake</pattern>
<script>
foreach (object_x, AllObjects ()) {
if (not object_x.parent = player) {
if (object_x.type_string = "potion") {
object_x.parent = potion_storage_object
} else if (object_x.type_string = "sword") {
object_x.parent = sword_storage_object
} else if (object_x.type_string = "axe") {
object_x.parent = axe_storage_object
} else if (object_x.type_string = "food") {
object_x.parent = food_storage_object
}
// you get the idea...
}
}
</script>
</command>
here, using Verb examples, as I should've done already:
<game name="xxx">
</game>
<object name="room">
<object name="player">
</object>
</object>
<command name="godverb_command">
<pattern>godverb</pattern>
<script>
foreach (object_x, AllObjects ()) {
if (object_x.type_string = "potion") {
invoke (object_x.drink)
} else if (object_x.type_string = "sword") {
invoke (object_x.equip)
} else if (object_x.type_string = "axe") {
invoke (object_x.unequip)
} else if (object_x.type_string = "food") {
invoke (object_x.eat)
}
// you get the idea...
}
</script>
</command>
The Pixie
08 Dec 2014, 22:11OurJud wrote:"The Pixie"
The advantage of verbs is that you do not have to worry about whether the action is applicable to the object. For example, you can set a SMASH verb for an item, and in the script you know what the item is. If you use a command, you first have to check if the item is smashable. It is not a big deal really. Where verbs become really good is when you make up your own types, but you might want to wait a while before looking at that.
I'm struggling to get my head around that one. Why does using a verb mean you don't have to check if the item is smashable?
Let's say I have a vase, and on that vase I set a command pattern of 'smash vase; break vase; throw vase' which runs a script describing the action of smashing it, how are you saying it would be done better with a verb?
I was think about "smash #object#;break #object#;throw #object", where you would have to check the object could be smashed.
However, the verb system does allow more flexible matching than you have there. You could set vessel and pot to be synonyms of the vase, then Quest would match:
SMASH VASE
BREAK THE POT
THROW VESSEL
If you have lots of verbs for the vase, you only need to set the synonyms once. If you have lots of objects that can be smashed you only have to set the synonyms of smash once. This will really come into its own after beta-testing, and some says they tried DESTROY AMPHORA, and it did not work. If you used verbs, you just add "destroy" to the verb, and "amphora" to the object. Two changes and all done. If you were doing commands, you have a lot more work.
However, as I said, it is not a big deal either way.