EDIT: After digging around a little, I've noticed that there are two separate commands for "
use object" and "
use object on|with object." I'm guessing my answer lies there. So, for now, I'm just gonna split up my code into two separate commands. If there's another way to deal with this issue, please let me know for future reference.
I'm making a command for lighting flammable objects like candles, matches, lamps, torches, etc.
In some cases, the object can be lit by itself (a match), in other cases it needs something to ignite it (a candle).
I have everything working fine as long as there are TWO objects put in ("light candle with match"),
but I can't get it to do anything with just one object ("light match"). It always says "I don't understand your command."
I'm not sure if the problem is my basic understanding of command patterns, the way I tried to use "object2 = null," or something else in the script (or all of those things).
I'm using the command pattern setting with the pattern
light #object1# with #object2#.
Here's the code for the script:
if ((HasAttribute(object1, "flammable") or HasAttribute(object1, "ignite"))) {
if (object2 = null) {
if (HasAttribute(object1, "ignite")) {
do (object1, "ignite")
}
else {
msg ("Light the " + object1.alias + " with what?")
}
}
else {
if (HasAttribute(object1, "ignite")) {
msg ("You realise the " + object1.alias + " is self-lighting.")
do (object1, "ignite")
}
else {
if (Got(object2)) {
if (HasAttribute(object2, "ignite")) {
msg ("You light the " + object1.alias + ".")
}
else {
msg (object2.alias + " cannot light " + object1.alias + ".")
}
}
else {
msg ("You don't have the " + object2.alias + ".")
}
}
}
}
else {
msg ("You can't light the " + object1.alias + ".")
}