How do I script a double click detector?

Started by Ytterbium, Sat 07/02/2004 03:48:23

Previous topic - Next topic

Ytterbium

I'm sorry if this is in the manual, but if it is, I couldn't find it.

I'd like my game to do something different if you double click on an inventory item rather than single click. I know this has been done in AGS games before (No, I'm not talking about Alien Rape Escape! Okay, fine, I am.), and I'd like to know how.

Please don't tell me to RTFM, because TFM doesn't answer TFQ.


Currently in production: Septigon

Darth Mandarb

Quote from: Ytterbium on Sat 07/02/2004 03:48:23Please don't tell me to RTFM, because TFM doesn't answer TFQ.
I don't have the answer you're looking for, but I just wanted to tell you this made me laugh!

That was pretty darn funny!  I hope you figure this out!

~ d

Chicky

im no programmer,

but couldnt you do somthing on the items actions like, on left click run script, if leftmousebutton then do {what ever you want}. I dunno just trying to help.

DTFM  ;)

-a chicken

Ytterbium

Quote from: oversizedchicken on Sat 07/02/2004 12:37:03
im no programmer,

but couldnt you do somthing on the items actions like, on left click run script, if leftmousebutton then do {what ever you want}. I dunno just trying to help.

DTFM  ;)

-a chicken

I know. What about double-left click?

Currently in production: Septigon

Dorcan

#4
There is a new tutorial I've just made  :)

http://www.digitalmindstudio.ch/script.php?langue=en&id=9

Ytterbium

Quote from: Dorcan on Sat 07/02/2004 19:04:34
There is a new tutorial I've just made  :)

http://www.digitalmindstudio.ch/script.php?langue=en&id=9

I changed it a little...

In repeatedly_execute:
Code: ags

  if  (timerClick>0)   {
    timerClick--;
  if  (timerClick == 0) 
      RunInventoryInteraction(game.inv_activated, 4); 
  }


In on_mouse_click:
Code: ags
 else if (button==LEFTINV) { //Selecting an inventory item
   timerClick = 0;
   SetActiveInventory(game.inv_activated);
   EnableCursorMode(4);
   SetCursorMode(4);
   }
else if (timerClick == 0)    {
      dblClick = 0;
      timerClick = dblClickSpeed;
    }
else   {
      timerClick = 0;
      dblClick = 1;
      RunInventoryInteraction(game.inv_activated, 4);  
}



This doesn't seem to work. For now I'll just make LEFTINV check if the cursor mode is Use Inv, but I'd much rather have a double click do it.

Currently in production: Septigon

Chicky

i jus dont wannna sound stupid,

what i mean is have it run script on left click, the script would be if leftmousebutton then (do whatever). So in theory your pressing it two times.

maybe anywayz

-a chicken

Kweepa

#7
osc,
Your idea is a simple one. Unfortunately too simple :)
The script would run the moment the left mouse button was clicked, and you'd then have to wait in the script for the second click.

Dorcan's code (unmodified) works for room interactions (thanks Dorcan!) but not for inventory interactions.

I think you'd have to create your own Inventory GUI to allow double clicks on the inventory objects through on_interface_click - that's how I'd do it anyway: by emulating the behaviour of the Inventory GUI object with buttons.

You might want to download some of the GUI templates for ideas and pointers.

[EDIT] The "Handle inventory clicks in script" option in General Settings doesn't seem to help.
Still waiting for Purity of the Surf II

SMF spam blocked by CleanTalk