Implied Player as Object for Verbs

WynkynNod
Hello, I'm new here.
I've been using Quest in my browser and find it very intuitive and easy to use, with help online easy to find...
Except for this one problem:

I'd like to attach certain verbs to my player, so that no matter where my player is, if the player types certain verbs, the player will receive a specific response.

Here is one example:
In my game, the player is involved in a hide-and-seek game.
When the player types 'hide', it is intended that the object being hidden is the player. I would like, in most cases, for the player to get the response "You cannot hide here."
In certain 'rooms', there are hiding places, and I've been able to successfully hide the player if the player types "Hide in ___" (such as "Hide in circle of trees" or "Hide in closet"). To do that, I attached the verbs 'hide' and 'hide in' to the objects that are hiding spots.

In most rooms, where there isn't a specific or obvious place to hide, if the player types "Hide", they get the response, "I don't understand your command," which is probably pretty confusing for the actual player.

I added the verb 'hide' to the player object, but that doesn't seem to make a difference. It only works if the player types "hide me", not if the player just types "hide".

Is there a way to give a more tailored response to a verb in which the implied object is the player? Can I make 'me'/'player' an implied default object? Can I alter the response for general verbs that have no specified objects, so that a script can run?

Thanks for any help.

jaynabonne
I think you want to use commands instead of verbs.

A verb takes an object. For example, if you attach "hide" to a book, then you'd be able to type "hide book". It won't recognize "hide" on its own, which is why you get that error. But you can just create a "hide" command and then have it do what you like (e.g. hide the player). Moreover, commands in rooms take precedence over same-named commands in the global space. So you can have a "hide" global command that says "You can't hide here" and then put specific "hide" commands in the rooms where you want hiding to be possible.

When you say "using Quest in my browser", does that mean you're editing with the online Quest editor? If so, there might be some differences from what I said, as the online editor doesn't support all the Quest features. Let me know if so.

WynkynNod
Jaynabonne,
I am editing with the online Quest editor.
After going back to the tutorial to read about commands, I was able to reach my goal by creating a 'hide' command. Thanks for the advice!

HegemonKhan
I don't know about the online web browser version, but in the offline desktop version, at the top of the screen is a horizontal bar, that has the 'Add' choice, which you can select to add a Command in, and also, in the left pane's 'tree of stuff' (('ve no idea if the online web browser version has this or not, as well), there's the Command as well, to add in Commands.

Verbs are for buttons and hyperlinks, attached to specific Objects, and I guess the default built-in Verbs too have a typed-in input feature too, though it's probably specific and limited to that Object only (I didn't know you could do typed-in inputs with Verbs).

Commands allow for typed-in inputs during game play, and thus are much more powerful than Verbs (technically, the Verbs are actually sub-commands made for only acting upon specific Objects, thus limiting their power~usefulness), as Commands are for general~universal usage.

Though, this makes Commands a bit more advanced to work with, but hopefully not too bad for you to figure out, if I can explain them well enough (and if not, Jay certainly can, laughs).

Commands are just like Verbs, except:

1. it's 'pattern' field:

since a Command uses typed-in input during game play, you need to put in an 'activation string' and what you want to use within your Command (aka: an Object, text ~ ie Strings, and~or how many Objects and~or texts~Strings):

in code, it looks like this (the GUI~Editor, shouldn't need explanation to set it up), an example:

(and it matters, as Jay said, of whether you add the Command to~inside of an Object, or globally ~ NOT inside of any Object)

<command name="fight_command">
<pattern>fight #object#</pattern>
</command>

<object name="orc">
<inherit name="editor_object" />
</object>


so, during game play, you would have to type in, for example:

fight orc

this tells quest, that you want to use your (for example) 'fight_command', and the Object, you'll be using in your Command's added scripts, is the: orc

if you want to just get a textual input (NOT an actual Object itself), it would be:

<command name="fight_command">
<pattern>fight #text#</pattern>
</command>


now, there's some coding practical concept condition~scenario~situational issues with both of these methods:

if you use the #object# (which tells quest to search for an Object with that NAME attribute), then what if:

the person playing the game, only knows the Object's ALIAS Attribute of 'orc', whereas the game creator probably has the Object's NAME attribute as 'orc_1' for his information and organizational use only. So, when the person types in 'fight orc', quest searches for an Object with the NAME (ID) Attribute of 'orc', but there is no Object with that NAME Attribute (as 'orc_1' is not 'orc', obviously). You can 'easily' code for this, but the key word is 'code', lol. You need to know how to do so, or at least how to copy and paste the code given to you into the correct spot in your game code (or you can try to manually add in the scripts via the GUI~Editor, which might also not be easy to do so).

and there's probably other issues that I can't think of for the moment... (err, just thought of some, such as 'checks' needed upon the searching of the Object, ie: is the Object 'reachable', and etc conditions~'checks' too)

if you use the #text#, then you got to code in, if you then want to find the Object that has a label (NAME or ALIAS) that matches up with what you typed-in for the text, which is easy to code in too, again though, you got to do some coding, as well.

-----

anyways, if you want to do multiple Objects~texts, an example:

<command name="fight_command">
<pattern>fight #object1# #object2# #object3#</pattern>
</command>
// an example input during game play: fight orc troll ogre

// or

<command name="fight_command">
<pattern>fight #text1# #text#2 #text3#</pattern>
</command>
// fight orc troll ogre

// or if you prefer the string structure of (using Objects in this example), for just one alternate example:

<command name="fight_command">
<pattern>fight #object1#, #object#, and #object3#</pattern>
</command>
// fight orc, troll, and ogre

// oh, and lastly, before I forget, you can do both Object and text too (using the same example above):

<command name="fight_command">
<pattern>fight #object1#, #tex1t#, #object2#, and #text2#</pattern>
</command>
// fight orc, troll, ogre, and goblin


-------

2. PARAMETERS:

now, the final part of working with Commands, is the scripting (add scripts) and it's PARAMETERS usage:

not only does quest search for an Object that exists with the same NAME attribute of #object# (or the inputed text, #text#, if not using #object#), but it then can USE that inputed Object or text in it's scripts (this is what the # symbols do in the Command's Pattern Attribute: #object# or #text#), via it's PARAMETERS (via #object# and~or #text#, if you want to know more about using PARAMETERS with Functions too, let me know):

<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="strength" type="int">100</attr>
</object>
<object name="orc">
<inherit name="editor_object" />
<attr name="endurance" type="int">50</attr>
<attr name="hp" type="int">25</attr>
</object>
</object>
<command name="fight_command">
<pattern>fight #object1#</pattern>
// during game play, the person types in: fight orc
// orc -> object1 -> used in the scripting below
<script><![CDATA[
damage = player.strength - object1.endurance
if (damage < 0) {
damage = 0
}
msg ("You attack the " + object1.name + " for " + damage + " damage.")
if (object1.hp <= 0) {
msg ("You killed the " + object1.name + "!")
} else if (object1.hp > 0 and object1.hp < 25) {
msg ("You wounded the " + object1.name + ".")
} else if (object1.hp = 25) {
msg ("You are too weak to even damage the " + object1.name + ".")
}
// obviously this code is very poor, but it's just an example for you
]]></script>
</command>


------

Hopefully, you can follow along and understand, but at the very least, I hope I didn't scare you off, laughs. Quest's code is very noobie-friendly, it's really not that scary or confusing~complex! (well crafting your own code is ~ but that's another matter, lol) ... (I just used code, as it's quick for me to use to explain things).

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

Support

Forums