I need help with using a multi-object command

lightwriter
Basically, I added a cancook boolean attribute to the defaultobject type and am looking for a way to get this script working where if the player uses certain things like Raw Fish on any object in the room that cooks or in inventory (like a lighter) then it runs a function that makes sure object 2 (the one that would do the cooking) can cook, you can't cook with a refrigerator but you can with a stove, if only it is on. So the function also checks to make sure that object2 is switchedon.
Now I'm having issues with a solution that returns the cooked version of this item. The only thing I can think of is having an script to each object (named the same thing) that the cook_item function calls if all conditions are met true.
Is there a simpler solution?
Here is my code if I'm making this way more complicated by trying to clarify my issue:

//below is the actual command part, basically, just a copied version of useon
^cook (?<object1>.*) (on|with) (?<object2>.*)$
//here is what that does
cook_item (object1, object2)
//Next is the function code
if (object2.cancook) {
if (object2.switchedon) {
// both conditions are met so this is where the code goes but I don't know what to do after this
}
}

Pertex
Add an additional object attribute to each item you want to cook where you save the name of the cooked item e.g
<object name="apple">
...
<cooked type="object">roastapple</cooked>
</object>

and move an object for the cooked item (roastapple) into an invisible room.
In your command move this cooked object into the inventory and remove the original item.


//below is the actual command part, basically, just a copied version of useon
^cook (?<object1>.*) (on|with) (?<object2>.*)$
//here is what that does
cook_item (object1, object2)
//Next is the function code
if (object2.cancook and object2.switchedon) {
MoveObject (object1.cooked, player)
MoveObject (object1, junkyard))
}

lightwriter
Thanks for the help!

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

Support

Forums