Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Event problems with inventory items  (Read 2381 times)

0 Members and 1 Guest are viewing this topic.

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Event problems with inventory items
« 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?
« Last Edit: March 28, 2004, 09:54:47 AM by deadworm222 »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5677
    • View Profile
    • Dead:Code Site
Re:Event problems with inventory items
« Reply #1 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.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:Event problems with inventory items
« Reply #2 on: March 28, 2004, 10:05:19 AM »

Logged

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:Event problems with inventory items
« Reply #3 on: March 28, 2004, 10:07:50 AM »

Nothing else uses right click and there's no loops.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5677
    • View Profile
    • Dead:Code Site
Re:Event problems with inventory items
« Reply #4 on: March 28, 2004, 11:59:07 AM »

Registry path bug fixed, don't know about the events though.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:Event problems with inventory items
« Reply #5 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. ???
Logged
 

Page created in 0.166 seconds with 22 queries.