Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: KristjanMan on Sat 25/03/2006 09:34:11

Title: Problems with changing cursor graphic
Post by: KristjanMan on Sat 25/03/2006 09:34:11
I'm using AGS v2.71

I have a problem with my GUIs. On my GUI1 I have a button that opens GUI2 (inventory) On the GUI2 i have button that should close GUI2, but i don't know how to scrip it my GUI script looks like this at the moment
  {
gGui2.Visible = true;

Now how do i scrip it like that that the other button will close the GUI2?
Title: Re: GUI buttons
Post by: Ashen on Sat 25/03/2006 09:45:30

gGui2.Visible = false;


Setting it to true would turn the GUI on.
Title: Re: GUI buttons
Post by: KristjanMan on Sat 25/03/2006 09:49:12
Thanks! I can't belive it was so obivius(did i spell that right?) You can now close this topic
Title: Re: GUI buttons
Post by: KristjanMan on Sat 25/03/2006 14:43:35
Wel sense they haven't closed this thread i'll use this one I have a another problem
I used AGS about two years ago and then there was thing such as SetCursorMode but now its diffrent i checked the help of AGS but i can't understand it can you help
For example i would like that when i click on inventory item with intraction cursor the cursor would change to cursor (for example) sword
What would be the code for such thing?
Title: Getting error
Post by: KristjanMan on Sun 26/03/2006 15:16:55
(http://www.2dadventure.com/ags/error123456789987456321123654789987456321.PNG)
This is what the error looks like what does "Not enogh parameters to call in function" mean anyway
this is what my code is like
if (mouse.Mode == eModeInteract) {
Ã,  mouse.ChangeModeGraphic (eModeSword);
}
else mouse.UseDefaultGraphic ();
Title: Re: Getting error
Post by: monkey0506 on Sun 26/03/2006 15:32:06
Mouse.ChangeModeGraphic (http://adventuregamestudio.co.uk/manual/Mouse.ChangeModeGraphic.htm) takes two parameters, (CursorMode) mode, and (int) slot, and is used for permanent changes ("This permanently changes the specified mode's cursor graphic.").

Mouse.UseModeGraphic (http://adventuregamestudio.co.uk/manual/Mouse.UseModeGraphic.htm) on the other hand, takes one parameter (CursorMode) mode and is used for temporary changes to be changed back with Mouse.UseDefaultGraphic (http://adventuregamestudio.co.uk/manual/Mouse.UseDefaultGraphic.htm) ("Use this to restore the cursor picture after you changed it with the UseModeGraphic function.").

[EDIT:]

Oh, and BTW, "Not enough parameters in call to function" means just that:  you didn't put enough parameters in the function call, i.e., you supplied one parameter to a function expecting two.

When you get this error message, it is usually best to look up the function that is generating the error to make sure that (a) it is the function you intended to use and (b) you put the parameters in correctly (in the correct order).
Title: Re: Getting error
Post by: KristjanMan on Sun 26/03/2006 16:16:09
Oh this function only changes the graphics but i would need some like SetCursorMode witch won't work in 2.7
Title: Re: Getting error
Post by: nihilyst on Sun 26/03/2006 16:23:18
When you open your AGS help by pressing F1 and are searching for SetCursorMode, you'll find the new way to do it.

cheers
nihilyst
Title: Re: Getting error
Post by: monkey0506 on Sun 26/03/2006 17:02:31
Look up the Mouse.Mode (http://adventuregamestudio.co.uk/manual/Mouse.Mode.htm) property.

Set it like:  mouse.Mode = eModeInteract;
Title: Re: Getting error
Post by: KristjanMan on Sun 26/03/2006 17:23:44
Thanks guys! I found a way to make it work without errors
Title: Re: Problems
Post by: A�rendyll (formerly Yurina) on Mon 27/03/2006 09:48:30
mouse.mode can be used for your problem. Since I don't have a full code, I'd suggest opening the default (not empty) gametemplate and get the code from the e.g. look mode button. Easy as pie!

(and obvius needs to be obvious :P)
Title: Re: Problems
Post by: KristjanMan on Mon 27/03/2006 14:13:41
Thanks i'll try that
Title: Re: Problems
Post by: Ashen on Mon 27/03/2006 17:38:03
Try reading the manual. Looking up SetCursorMode would've pointed you to the entry for mouse.Mode (http://www.adventuregamestudio.co.uk/manual/Mouse.Mode.htm) (note the capital M for 'Mode').

For the example you gave, no coding is even required. By default, clicking an inventory item with the interact mode (eModeInteract) will set it as the active item - and unless you've changed the settings AGS should use the active item's graphic as the cursor. (The 'Don't use inventory graphics as cursors' shouldn't be checked.)

You might also want to look up some of the other Mouse functions and properties (http://www.adventuregamestudio.co.uk/manual/Mouse%20functions%20and%20properties.htm).

EDIT: Merged with other, similar thread.