Object.UsableWith(string inventory object, function name)
Sets the inventory object which can interact with the Object, when the player uses the inventory object with Object executes the function.
function Main()
{
//Title of the Room
SetTitle("Bedroom");
//Image background and walkable area
CreateScreen("bedroom","107,207,246,207,257,192,511,194,518,209,648,212,656,193,690,193,788,393,15,393,107,207");
//Adding the player
CreatePlayer(620,190);
//-Window
Window=CreateInvisibleObject("52,182,33,164,24,116,35,67,58,44,71,62,76,92,75,129,67,161");
Window.description="Window to the outside.";
if(SearchParameter("WindowOpen"))
{
Window.DoorTo("outsideleft",640,75);
}else{
Window.description+="It's closed with key.";
Window.use=WindowClosed;
Window.UsableWith("Key",OpenWindow);
} //-Drawer
Drawer=CreateInvisibleObject("197,181,217,181,218,200,195,198");
Drawer.description=("It's empty");
if(!SearchParameter("KeyTaken"))
{
Drawer.description=("Aha! here is the key to open the window.");
Drawer.take=TakeKey;
}
}
function OpenWindow()
{
Window.DoorTo("outsideleft",640,75);
Window.description="Now I can go out.";
RemoveInventoryObject();
CreateParameter("WindowOpen");
Player.Say("Done, It's open");
}
Get the latest version here.