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
}
}