Lucasarts style gui problems

Started by Mr_Threepwood, Sun 02/10/2005 19:00:29

Previous topic - Next topic

Mr_Threepwood

I recently started AGS and after a bit of initial mucking around I decided to get started on a first game, which of course wont have many special features but would be good as a way to learn AGS.Ã,  I really despise the sierra style GUI so as a first step to my game I decided to try and make a Lucas arts style one, unfortuanetly I have some scripting errors and some logic problems.

First I got the gui layed out, then i tested by making functions such as walk, talk and stuff to set the cursor accordingly.Ã,  However then I realized that wouldnt work if I wanted the status label to change each time I did something like that, so instead I made them run scripts, here is an example.

walk button is named btnWalk, label is named lblStatus

Code: ags

#sectionstart btnWalk_Click
function btnWalk_click(){
Ã,  mouse.Mode=eModeWalkto;
	lblStatus.SetText ("Walk to");

}
#sectionend btnWalk_Click


as of now that does absolutely nothingÃ,  :(.

I would like to know how to make that work.

Another thing I've thought about is this, am I even going about making the status label the right way in the scripts?Ã,  Later on when I want to make the label update when it goes over hotspots and such how will i do this, will it need to be in the repeatedly execute method?

Also with the cursors, If I dont want the cursor to actually change icons do i still need to do the change cursor thing?Ã,  I'm wondering because I will have a lucasarts animated style crosshair, so every time I change the cursor will it reset the animation (thus making it look as if the cursor blinks)?

Im very confused right now with how to make the label work, any help would be appreciated.

/edit Also I was wondering what exactly does the #sectionstart and #sectionend do in the code, what does it tell the comptuer?
I am a mighty pirate

Ashen

#1
Once you've named the button, (btnWalk, in this case) AGS can automatically create the function for it - all you have to do is click it in the GUI editor.
The created functions are in the format btnWalk_Click(GUIControl *control, MouseButton button) and, AFAIK, need both those parameters - even when they aren't used. So:
1) Make sure the Click property of btnWalk is set to call the right function (e.g. btnWalk_Click).
2) Try using the auto-created functions, instead of the ones you made. (Copy the code from yours, and delete them.)
3) If it still doesn't work, post again, with exactly what you did and any error messages you might've got.

QuoteAlso with the cursors, If I dont want the cursor to actually change icons do i still need to do the change cursor thing?
Not as such. You could use a single cursor, and use a variable to check what 'Mode' to run (if(mymode == 1) Display ("I can't use that.");, etc) - which is kind of necessary for LucasArts style GUIs anyway, because of the number of possible modes it allows. You could also simply use the same cursor/animation for every mode, and stick with the 'change cursor thing'.


Quotewhen I want to make the label update when it goes over hotspots and such how will i do this
Using
Code: ags

lblStatus.SetText("Walk to @OVERHOTSPOT@");

should do the trick.

If you haven't already, read through the LucasArts GUI Help Thread (a little out-of-date in places, but still useful), and take a look at one of the LucasArts GUI templates on Rui's page. There's only one re-written for 2.7 (and that not fully - it still uses interface_click instead of the individual GUI Control scripts), but you may still learn something from the code.
I know what you're thinking ... Don't think that.

Mr_Threepwood

I looked at the monkey island template and it confused the hell out of me with all the defines and stuff, ugh.  Maybe I jumped into this too fast and should try using a template for my first game.
I am a mighty pirate

Ashen

There's also this tutorial, that might be of use to you. It's a nice, relatively simple version of the same interface - written for 2.7, and maybe a bit better documented than the older ones.
I know what you're thinking ... Don't think that.

Mr_Threepwood

Thanks, that tutorial is a LOT easier to understand then just looking at the global script in the monkey island template.  I think I can actually get things rolling now.
I am a mighty pirate

SMF spam blocked by CleanTalk