<command name="fill pot cmd">
<pattern>fill pot with water; fill pot from waterfall; put pot in waterfall; put pot under waterfall; use pot on waterfall; use pot under waterfall; hold pot under waterfall; fill pot with waterfall; fill pot</pattern>
<script>
if (GetBoolean(jug, "filled")) {
msg ("You can only have one container filled at a time.")
}
else if (GetBoolean(bucket, "filled")) {
msg ("You can only have one container filled at a time.")
}
else if (GetBoolean(pot, "filled")) {
msg ("You can only have one container filled at a time.")
}
else {
msg ("You hold the pot under the flowing waterfall until it is filled.")
MoveObject (water1, pot)
SetObjectFlagOn (pot, "filled")
}
</script>
</command><command name="water to jug cmd">
<pattern>pour water into jug; transfer water to jug; put water in jug; transfer water to jug; pour water in jug</pattern>
<script>
if (GetBoolean(pot, "filled")) {
msg ("You pour the water from the pot into the jug.")
SetObjectFlagOn (jug, "filled")
SetObjectFlagOff (pot, "filled")
}
else if (GetBoolean(bucket, "filled")) {
msg ("You pour the water from the bucket into the jug.")
SetObjectFlagOn (jug, "filled")
SetObjectFlagOff (bucket, "filled")
}
else if (GetBoolean(jug, "filled")) {
msg ("The jug already contains the water.")
}
else {
msg ("There is no water in a container to be poured into the jug. You need to fill one from the waterfall first.")
}
</script>
</command>XanMag wrote:...
This command script is on the object pot. But it does not return my responses, only "I don't understand your command."
I know I can put this command on the 'room' and it will work, but let's say there is another waterfall in a different room. I'd like the command to follow around the pot and not be restricted to a room. I also know I can use all sorts of "If" player is carrying object bucket, "then" "if" object waterfall is visible, "then" follow said script, but that just seems like unnecessary coding. I also know that I can copy-paste each command into any room with a 'waterfall' in it, but what about commands on objects that can be moved around room to room? Is the easiest way to make a complicated if/then/if/then script and make it global? Ugh...
<command name="fill pot cmd">
<pattern>fill #object# with water; fill #object# from waterfall; put #object# in waterfall; put #object# under waterfall; use #object# on waterfall; use #object# under waterfall; hold #object# under waterfall; fill #object# with waterfall; fill #object#</pattern>
<script>
// first check if this object can be filled
if (not HasBoolean(objected, "filled")) {
msg ("That is not something you can fill with water.")
}
// now check if it is already full
else if (GetBoolean(jug, "filled")) {
msg ("It is already full of water.")
}
// is there water to fuill it from?
else if (GetBoolean(player.parent, "filled")) {
msg ("There is no waterfall here.")
}
// all checked okay, so do it
// use GetDisplayName to handle objects with and without alias
else {
msg ("You hold the " + GetDisplayName(object) + " under the flowing waterfall until it is filled.")
MoveObject (water1, object)
SetObjectFlagOn (object, "filled")
}
</script>
</command>