Vague command responses okay?

XanMag
What are you thoughts as players for the following scenario?

In my game it is required to 'use blade on the red car tires'. I have this in the 'use this object on another object' box.

I also want to have a command available that allows the player to type in random variations of stab tires with blade (as you can see in the code below). However, when the player tries to stab anything else with anything else in the room I used this code to respond.
    <command name="stab wrong tires cmd">
<pattern>stab #text# with #text#</pattern>
<script>
msg ("Stabbing something like that with that doesn't achieve the desired effect.")


Correct code:
    <command name="stab tires cmd">
<pattern>stab tires with stout knife; stab red car tires with stout blade; stab red tires with stout; stab red cars tire with stout blade; stab red cars tires with stout blade; stab tires with stout; stab red car tires with stout; stab red tires with stout; stab red cars tire with stout; stab red cars tires with stout; stab tires with blade; stab red car tires with blade; stab red tires with blade; stab red cars tire with blade; stab red cars tires with blade</pattern>
<script>
if (Got(stout blade)) {
msg ("You plunge the blade into the back driver's side tire and an angry hiss escapes. Pleased with your work, you jab the other three as well. On the fourth tire, the blade snaps. Oh well... tires and knife destroyed.")
SetObjectFlagOn (red car, "disabled")
panel.VehiclesDisabledCount = panel.VehiclesDisabledCount - 1
RemoveObject (stout blade)
}
else {
msg ("You are not carrying the right blade to do that. Right idea though.")
}
</script>
</command>


The question I have is "Is this okay for a response?" Would you just try stabbing everything in the room with every object in your inventory? Should I have a more detailed hint? Maybe add "Stabbing something like that with that doesn't achieve the desired effect. The only thing worth stabbing in this room are you and those red car's tires, but you better have a formidable weapon for even those fancy tires."

Also... is there an easier way to do this?

The Pixie
I think that is good response, as it hints at what the player needs to do.

Do not use #text# for your command. The only two times to use it are when the player has to refer to an object that is not held and not in the room, or when it does not refer to an object at all.

Instead, use #object#, which Quest will match up to an object. This means you do not have to put in all the alternative ways of referring to the object. As you have two objects (your types are an object, right? they should be, so the player can examine them), use #object1# and #object2#, and the pattern is simply:
stab #object1# with #object2#

This command will cover both the commands you have above, and handle two alternative verbs as well:
<command name="stab tires cmd">
<pattern>stab #object1# with #object2#;slash #object1# with #object2#;puncture #object1# with #object2#</pattern>
<script>
if (object1 = red car tire) {
if (object2 = stout blade) {
msg ("You plunge the blade into the back driver's side tire and an angry hiss escapes. Pleased with your work, you jab the other three as well. On the fourth tire, the blade snaps. Oh well... tires and knife destroyed.")
SetObjectFlagOn (red car, "disabled")
panel.VehiclesDisabledCount = panel.VehiclesDisabledCount - 1
RemoveObject (stout blade)
}
else {
msg ("You are not carrying the right blade to do that. Right idea though.")
}
}
else {
msg("Stabbing something like that with that doesn't achieve the desired effect.")
}
</script>
</command>

XanMag
Oooh. Very nice to know. Thanks again!

Marzipan
Pixie, just so you know you're posts are invaluable for more than just the people whose questions you're answering. I really appreciate the time you take to clearly explain things to those of us who are programming-impaired, and I've been building up a nice little collection of coding tips just quoting your posts and PMing them to myself for future reference. :)

ChrisRT
As someone who is new to Quest and programming in general, I agree - I feel like I learn something new/interesting every time I check the forums, and also have a few threads bookmarked for reference. The community on here is very helpful in general, and it's much appreciated. :)

jaynabonne
You can also do this with a verb instead of a command. That allows you to easily vary the behavior per object without having to have all this nasty "if this and that" sort of code. Quest does that for you.

First, create a verb called "stab". The defaults are reasonable for this, though you can customize them as desired. Note that "stab" will have object separators of "with" and "using". This means you can type "stab X with Y" or "stab X using Y". (And all the variations you have in your command can be handled by adding aliases to the objects...)

Then go to your tire and add the "stab" verb. It defaults to "Print a message". Change that to "Require another object". You then will have a list where you can add objects that you can stab the tire with ("stab tire with Y"). In this case, you want it to be the knife, so...

Click "Add" and pick the knife from the object dropdown. It will then pop up allowing you to enter the script for when someone types "stab tire with knife". In my case, I just printed, "The tire hisses."

Sample session:

> stab tire with knife
The tire hisses.

> stab flowers with knife
You can't stab them.



In case that makes life any easier... :)

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

Support

Forums