Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: deadworm222 on March 28, 2004, 09:41:44 AM

Title: Event problems with inventory items
Post by: deadworm222 on March 28, 2004, 09:41:44 AM
I have this very very weird problem with right clicking. When right clicking an object in the inventory, it should execute the Examine event - but no.

Code: [Select]
on "RightClick"
{
  // variable ActObj is the object clicked, if any
  var ActObj = Game.ActiveObject;
 
  // Was an actual object clicked?
  if (ActObj!=null)
  {

    if (ActObj.CanHandleEvent("Examine"))
    {
        ActObj.ApplyEvent("Examine");
    }else{
      ActObj.ApplyEvent("RightClick");
   }
  }else{
    Scene.ApplyEvent("Examine");
  }
}

Left clicking works like dream, so what's the problem? There's nothing wrong with the items' .script files. I found out, by using a Game.Msg function, that for some reason when clicking an inveotory item ActObj.CanHandleEvent("Examine") is false! But why?
Title: Re:Event problems with inventory items
Post by: Mnemonic on March 28, 2004, 09:51:31 AM
I tried this exact piece of code and it works without any problem. I take it this piece of code is in game.script, right?
Please check if the "RightClick" event isn't stolen by some other handler and also check if there isn't any "endless loop" in the beginning of the game.script. If it is, it must be moved to a separate script otherwise the events cannot be handled.
Title: Re:Event problems with inventory items
Post by: deadworm222 on March 28, 2004, 10:05:19 AM
I'll check. Another strange thing: Every time I reopen the project file, the registry path , which I usually keep blank, has changed to M
Title: Re:Event problems with inventory items
Post by: deadworm222 on March 28, 2004, 10:07:50 AM
Nothing else uses right click and there's no loops.
Title: Re:Event problems with inventory items
Post by: Mnemonic on March 28, 2004, 11:59:07 AM
Registry path bug fixed, don't know about the events though.
Title: Re:Event problems with inventory items
Post by: deadworm222 on April 06, 2004, 08:46:39 AM
RightClicking works now. I just had forgot to attach scripts to the items! I need to be flogged. ???