Custom GUI [ASSISTED]

Started by , Mon 07/02/2005 16:24:59

Previous topic - Next topic

Nexic

Hello.

I am very new to AGS and I would like to build a different gui system to the standard one that is available. Basically I would like a system where:

Hovering the mouse over a hotspot will show the name of that thing,

Right Clicking brings up the inventory,

Left Clicking on something will bring up a toolbar that displays only verbs that are possible to use on that object (so and lampost would have just 'look' and a key could have 'look' and 'get'

With an inventory item selected, the cursor will light up only when it hovers over something it can actually be used with.

I realise this is a very complex set of specifications, and I don't expect anyone just to give me the exact code to use to do this. But what I would like is for someone to point me in the right direction. Im proficient in programming, so I'm sure I can pick up the scripting easily, but I have no idea of the AGS syntax or even where to type in the code for this gui!

Thanks

Ishmael

This isn't probably the exactly correct place to post this, but a mod will move it in that case...

I'll give you a list of functions to look at in the Manual to get some idea on how you'd do it, and I suggest you read through the scripting tutorial to get to know with AGS' syntax a bit better. If you know C, AGS script is quite similiar.

Anyway, have a look at these Manual entries:
GetLocationName
GetLocationType
GetHotspotProperty
GetObjectProperty
GetCharacterProperty
ProcessClick
SetGUIPosition

And thss global variable ought to help you out with the inventory bit:
game.inv_activated

Also, these are quite neccesary to make it all work:
mouse.x
mouse.y
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

monkey0506

Look at the help manual and the tutorial that comes with AGS and you should be able to get some idea of what to do.

1. Ã, For hovering over a hotspot:
Ã,  Ã,  In the GUI tab of the game editor create a new GUI, and give it a name, such as "MOUSELABEL".
Ã,  Ã,  Draw a label (hover the mouse over the buttons to find "GUI Label").
Ã,  Ã,  Use the GUI Editor window to edit the size, shape, font, colors, etc., and set the label text to "@OVERHOTSPOT@"
Ã,  Ã,  In the global script, in repeatedly_execute:

Code: ags
SetGUIPosition(MOUSELABEL, mouse.x, mouse.y)


You can change the x or y values with addition or subtraction (i.e. SetGUIPosition(MOUSELABEL, mouse.x - 10, mouse.y + 10)). Ã, And if this is supposed to follow the mouse, I would suggest making the label background and outline transparent (set to 0 in the GUI Editor window). Ã, The other stuff should be pretty easy to figure out once you learn the syntax. Ã, Oh, by the way, you said you don't know where to type the code:

In the main AGS window click on "Script" or something like that, and then "Global script". Ã, That is where most of your code will go. Ã, :)

Ishmael

I've never got the object name display to work using a GUI that follows the mouse. Well, it was an older AGS version, and I haven't tried it with the new one.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Nexic

Thanks for the help :)

monkey0506

Quote from: Ishmael on Mon 07/02/2005 17:49:21
I've never got the object name display to work using a GUI that follows the mouse. Well, it was an older AGS version, and I haven't tried it with the new one.

I just now realized your problem (I think).  I've read that post several times, and I remembered how I solved the same problem.  You most likely did the logical thing and set the GUI to Popup Modal (as you wouldn't want it on all the time (presumably)).  But, if you consider what that does, it pauses the game.  @OVERHOTSPOT@ would not processed (I think(?)).  Nor would mouse-clicks.  So, to fix it, make the GUI a "Normal GUI" and turn it off in game_start, and turn it on/off as necessary.  If that doesn't work, P.M. me and I could try to help you.

Nick Dangerous

I'd set variables into the objects script to declare which buttons should be active, then start a script activating the gui and, depending on the just set variables, hides,  the buttons you don't need. If you want the buttons at specific positions, I'd create a gui for each one of them.

SMF spam blocked by CleanTalk