I thought I was better at this...
It's been a while though, and last time I didn't create a custom GUI. I just had no GUI, and made it so you right-clicked through cursors.
Anyways, I would like to have a GUI that pops up on a right-click where you then select a cursor mode by clicking a button on the interface, and then right-click again (or just click a button) and have the GUI vanish. I think something like this was used in Grrr! Bearly Sane and probably other games as well.
I have the buttons set up and I have the GUI set to Popup Modal but from there I don't know where to go. Where should I put the scripting, and how should it look?Edit:
I got the GUI to pop-up on right click but now I can't get it to go away. It just stays there.
This is what's written in the global script:
[code]#sectionstart on_mouse_click // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
if (button == eMouseLeft)
if (button == eMouseRight) // right-click, bring up GUI
gKarma.Visible = true;
There was some code in there about not allowing clicks while paused but I just whacked that right off, and also changed some other stuff from the default. What I want to happen is that when the GUI is up once you click a button (to select a new cursor type) the GUI goes away, or if you right-click again it defaults to the walk cursor and the GUI goes away. What lines of code do I need to add for this?
I mean if I put:
if (button == eMouseRight)
gKarma.Visible = false;
I'm just going to get some weird reaction or error, right?
I notice there's a section in the global script called #sectionstart interface_click. Would I put the "close-code" in there instead?
Also, is there any way I can get the GUI to pop-up where the player right-clicks? As of now it just pops up rougly in the middle of the screen where I have specified the coordinates.