Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Left click pop-up menu  (Read 3816 times)

0 Members and 1 Guest are viewing this topic.

elfersp

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Left click pop-up menu
« on: February 15, 2009, 04:21:38 PM »

Hey guys!

I'm very new to WME - so I apologize if this is a dumb question.

What I want to do is have a little window pop up with text options when I left click on something.  So, rather than first choose "look" or "take" and then click on an object, I want to simply click on the object (lets say a newspaper) and after the click, have a simple black window with "Look at newspaper" and "Take newspaper" pop up as clickable choices near where I clicked.  If I click somewhere else (not on either choice) then the window goes away and my click does whatever.

I could *almost* implement this with default dialog behavior, but it would have some drawbacks.  First, the choices are down at the bottom of the screen, so I have to move the mouse away from what I clicked in order to choose.  Next, because the dialogs seem persistent by default, I also have to have a third option of something like "do nothing."  So - I'm looking to get around both of these issues.

Does this make sense?

Thanks for the help, guys!
Paul
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Left click pop-up menu
« Reply #1 on: February 16, 2009, 08:25:24 AM »

In scripts\game.script there's a code which is executed on right click (on "RightClick" ....). It displays the menu. Basically you'd need to move this code to on "LeftClick". However, the left click handler does some additional stuff, such as selecting an inventory item on click. So you'll have to decide how will your inventory work. Will left click select items? But in that case the player won't be able to use menu on them.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

elfersp

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Left click pop-up menu
« Reply #2 on: February 16, 2009, 09:54:15 PM »

Hmm - no, I'm not trying to emulate the current right click behavior...  I'm really trying to just have an additional behavior that I could add on the left click event - not changing the global left click behavior.

So - I left click on the ground, I walk there.  I click on an inventory item, that works.  I click on something with only one action, I do that action.  I click on something with TWO actions, and I see two text links, which I can choose between or ignore.  Clicking somewhere else would make them go away.

Does that make sense?

So right now I have something like:
Code: WME Script
  1. on "LeftClick"
  2. {
  3.         var Selected1;
  4.  
  5.         Game.Interactive = false;
  6.  
  7.         Game.AddResponse(0,"Talk to the guy.");
  8.         Game.AddResponse(1,"Look at the guy.");
  9.         Game.AddResponse(2,"Do nothing.");
  10.  
  11.         Selected1 = Game.GetResponse();
  12.        
  13.         switch(Selected1) {
  14.                 case 0:
  15.                         Actor1.Talk("Hey.");
  16.                         Actor2.Talk("Hey.");
  17.                         break;
  18.                 case 1:
  19.                         Actor1.Talk("It's a guy.");
  20.                         break;
  21.                 case 2:
  22.                         break;
  23.         }
  24.         Game.Interactive = true;
  25. }
  26.  
  27.  

And I would want something similar - where I author, at the click event level, what options to show and what to do in each case.

Again - the drawbacks with the current way are that you have to include a "do nothing" option (someone could click by accident and then have to click "do nothing") and that you have to go to the bottom of the screen in order to choose, when your mouse is nowhere near there.  If it could pop near the mouse click, and if it could go away if it isn't clicked, that would be perfect.

Hope this makes sense.  Thanks for the help!
« Last Edit: February 17, 2009, 04:35:22 AM by elfersp »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Left click pop-up menu
« Reply #3 on: February 22, 2009, 10:34:29 AM »

Hmm - no, I'm not trying to emulate the current right click behavior...
I think you are. The current default right-click handler already does that. It checks if the clicked object offers some of the menu actions, if it does, the menu is displayed, otherwise it just sends right-click event to it. The "do nothing action" is clicking outside the menu (or you can add an extra button to the menu for closing it).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

elfersp

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • View Profile
Re: Left click pop-up menu
« Reply #4 on: February 25, 2009, 03:11:40 PM »

Thanks, Mnemonic!

I will take a closer look at the right click behavior and see what I can learn from it.

I would think I need to create a new window, like the current right-click window...  but one that could be reconfigured to display whatever lines of text I supply before showing it...
Logged
 

Page created in 0.056 seconds with 22 queries.