Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Question about LeftClick on Button/Inventory  (Read 3145 times)

0 Members and 1 Guest are viewing this topic.

Pixelschmied

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 16
    • View Profile
    • www.seelentanz.com
Question about LeftClick on Button/Inventory
« on: January 27, 2008, 10:39:33 AM »

Hello WMs,

I search around the board/wiki, but I can't find any solution to my problem. I will try to explain. There are two opportunities to open the inventory. With the <TAB> key you can open/close, or you move the cursor to the top, it will brings a window and you can click on the "bag" to open/close the inventory. Or you can close the open inventory with left click on the "close" button.

Now my problem/question: If I pickup a item in the inventory and left click on the "close" button in the inventory or in the top on the "bag" button, the CanHandleEvent is active and the actor will talk his "use item-x with...". How can I disabled this handle? I wish that if you have a item-cursor you will not get any messages if you left click on the "close" or "bag" button. I find in the documentation the attribute IgnoreItem, but I don't no how and where to use it. Here is a little screenshot, so that you may be better understood.



Can anyone help me? Thank you in advance.

Pixelschmied

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Question about LeftClick on Button/Inventory
« Reply #1 on: January 27, 2008, 03:13:54 PM »

The code responsible for this is in scripts\game.script. In the on "LeftClick" handler there's something like:

Code: WME Script
  1.     // using an inventory item on another object
  2.     else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
  3.  

Change it to something like this to ignore windows and buttons:

Code: WME Script
  1.     // using an inventory item on another object
  2.     else if(Game.SelectedItem != null && Game.SelectedItem != ActObj && ActObj.Type != "button" && ActObj.Type != "window")
  3.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Question about LeftClick on Button/Inventory
« Reply #2 on: January 27, 2008, 03:15:07 PM »

The "IgnoreItems" attribute only works for objects within the scene, not for user interface.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Pixelschmied

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 16
    • View Profile
    • www.seelentanz.com
Re: Question about LeftClick on Button/Inventory
« Reply #3 on: January 27, 2008, 03:46:53 PM »

Hello Mnemonic,

thanks a lot. It works perfectly. I was not quite sure where I must changing/modifed the LeftClick handler. I have tried a lot, but nothing worked fine. I may know now how to query window and buttons.

And thank you for the note about the attribute "IgnoreItems".

Nice WE,

Pixelschmied
Logged
 

Page created in 0.085 seconds with 24 queries.