<command name="PourOnOrWhateverYourCommandNameIs">
if (HasAttribute (object, "pouron")) {
do (object, "pouron")
} else {
msg ("You can't do that.")
}
</command>
<type name="obj_plant">
<pouron type="script">
msg ("The plant appreciates the water. You don't know how you know this, but it does.")
</pouron>
</type>
<type name="npc_person">
<pouron type="script">
msg ("They probably wouldn't appreciate that as much as a plant would.")
</pouron>
</type>XanMag wrote:Types... I am confused by them. I get the first half of that, but I am unsure of the second half. I don't understand --> <type name="obj_plant">
<pouron type="script">
By now, I should get it, but I do not.
Also, keep in mind, I am trying to explain in my tutorial using the GUI. If I understood this code, I'm sure I could go back and forth between code view and the GUI and figure out how to implement this using the GUI only.
If this is too difficult to generate using GUI only, I still would like to know how to do this for future reference.
Thanks!
XanMag wrote:Just out of curiosity, can you match a command to a shared attribute? I'm not even sure I am asking that correctly.![]()
For example, if I have this as a regular expression command (assuming it would work):
^(pour|dump|add|empty|put|use) (the |)(bottle|water|bottle of water) (on|over|into|onto) [attribute]
The [attribute] here would be anything in my game that I gave that attribute to. Maybe, I want to give the attribute "plant" to several objects in my game and would like an appropriate response for each plant object. Or maybe, for some reason I want to give the attribute "NPC" to all humans and would like a response for pouring water on the NPCs. Does that make any sense?
I know I could replace the attribute with #object# and do an If/Else if/Else If/etc.../Else to check if the object is a water source, but that's not what I am going for. Again... I'm not entirely sure that explanation (#object#) is accurate but hopefully you get what I mean?
Sorry if this is a stupid question, but I'm sure you all are used to them! Thanks in advance!
^(pour|dump|add|empty|put|use) (the |)(?<object_1>.*) (on|over|into|onto)(?<object_2>.*)$if (not GetBoolean(object_1, "full_of_water")) {
msg("You try to pour from the " + GetDisplayAlias(object_1) + " but there is nothing in it.")
}
else if (not GetBoolean(object_2, "can_be_poured_over")) {
msg("You can't go around pouring stuff on any " + GetDisplayAlias(object_1) + " you find lying around.")
}
else {