Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: DrSlash on Sat 09/07/2011 10:38:11

Title: Right-clicking GUIs in 2.61
Post by: DrSlash on Sat 09/07/2011 10:38:11
So this is my first question about AGS and I hope the last.
I'm using 2.61 version and as I can see right-clicking GUIs is the same to left-clicking them. I've tried to use
if (IsKeyPressed(RIGHT)==1) SetNextCursorMode();
command to change the script so that it will set the next cursor mode after right-clicking the GUI but it doesn't work (of course, I've placed this command in GUI's script, not in on_mouse_click).
So, here is my question: I want to set the next cursor mode if player right-clicks the GUI. Is is possible?
Title: Re: Right-clicking GUIs in 2.61
Post by: Dualnames on Sat 09/07/2011 11:05:59
on mouse click append the following:


if (button==eMouseRight)
{
  GUI *theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
  if (theGui!=null)
  {
    mouse.SelectNextMode();
  }
}




Now whether that's doable in AGS 2.61, well, beats me. But I believe it is.
Title: Re: Right-clicking GUIs in 2.61
Post by: Khris on Sat 09/07/2011 12:03:17
No, it isn't. Unless you lose the pointers, oo-code and enums.

DrSlash:
Why on earth would you still use 2.61? I've desperately tried to think of a reason but I can't. Win98 compatibility...?

Re your problem:
Try on_event:

function on_event(int event, int data) {

  if (event == GUI_MUP && data == RIGHT) SetNextCursorMode();
}
Title: Re: Right-clicking GUIs in 2.61
Post by: monkey0506 on Sat 09/07/2011 12:16:59
I just wanted to point out that even in 2.7+ what Dual said is still incorrect because on_mouse_click is never, ever, ever, ever, ever, ever fired when you click on a GUI or non-InvWindow GUIControl. :P

And wasn't Win98 supported until 2.71 or 2.72 at least? So I too fail to see why you haven't considered upgrading to a higher version of AGS. If you did want to upgrade, 2.7x should be able to import your project. If you wanted to consider upgrading to anything in the 3.x branch you would have to upgrade to the 2.7x branch first, then you can upgrade to a newer version. I mean, if you wanted to.

I can't think of a specific reason why you wouldn't have upgraded from 2.61 to 2.62 at least though. It's been a long time since 2.62 came out, so I don't recall off the top of my head if it would have "broke" anything, but I remember developing with it (vaguely :P). Seriously, the 2.7+ OO-system, pointers, enums, struct member functions..it's really made the script language much more powerful. 3.0 introduced dynamic arrays too which are something I'm rather fond of. :)
Title: Re: Right-clicking GUIs in 2.61
Post by: DrSlash on Sat 09/07/2011 12:58:24
I still use 2.61 because old versions of AGS were designed to create games in Sierra style. And that is exactly what I need :)
Title: Re: Right-clicking GUIs in 2.61
Post by: monkey0506 on Sat 09/07/2011 13:24:18
...there's nothing stopping you from creating a Sierra-style game in newer versions of AGS. The same default GUIs are still being distributed with the default template, and you can still script whatever you'd like. And besides, once you've started a game project, upgrading it doesn't typically alter anything unless something went wrong.
Title: Re: Right-clicking GUIs in 2.61
Post by: Khris on Sat 09/07/2011 13:47:41
I must have missed the memo about AGS ditching Sierra functionality just because it became prettier, way more powerful, way more user-friendly, and had tons of new features implemented. Oh wait, there never was such a memo ::)

(Although I can see why one would think that a more user-friendly engine would no longer support creating Sierra games ;))
Title: Re: Right-clicking GUIs in 2.61
Post by: DrSlash on Sat 09/07/2011 18:44:05
Well, nothing of these really works. Let's rephrase my question: Is there any way to find out which mouse button player uses?

What about my version of AGS - I surely know that newer versions have all functions of old ones. It's just because I'm very used to 2.61 and I even suppose I'm adept in it :)