Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: frission on Mon 08/10/2007 16:59:17

Title: Text parser GUI [SOLVED]
Post by: frission on Mon 08/10/2007 16:59:17
I'm trying to make a Sierra-style text parser GUI. I've set up a GUI with the appropriate controls on it, and I think I've basically got it to work, except that the function called based on the Activate property of the Text Box control seems to be expecting a variable to be passed. Basically the game crashes and says that it expected 0 variables but instead got 1.

I couldn't find any documentation on the Activate function in the documentation. The documentation tells me how to use the parser once I've gotten some text inputted, but the description of how I get to that point is a little sketchy. Could someone help me out?
Title: Re: Text parser GUI
Post by: Ashen on Mon 08/10/2007 17:08:21
Believe it or not, this sounds like a simlar problem to this one (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=32582.0). (No, they don't seem anything alike, but bear with me on this...)

I'm guessing you made the Activate function yourself? In which case, you probably didn't add the parameter it requires:

function txtTextbox_Activate(GUIControl *control) {
// Your code here
}


Adding that parameter to the function declaration should get rid of the crash. In future, double-click your controls after you've named them, to have AGS autocreate the function with the right parameters.


Or, if that's not the problem, can you post the function as you declared it, and tell us a little more about what you've done so far?
Title: Re: Text parser GUI
Post by: frission on Mon 08/10/2007 17:13:13
That fixed it, thanks. I figured it was probably asking for a pointer to the GUI (so it would know what in particular had called it) but I wasn't at all sure how to give that.

Is there a way I would know to do that? Just for future reference.
Title: Re: Text parser GUI
Post by: Ashen on Mon 08/10/2007 17:22:48
I learnt by looking at previously made Control functions, I don't think it's covered anywhere in the manual.
The GUI editor is meant to auto-generate GUI Control functions with the right parameters in place, so there's really no need for the user to know what they require. It still WILL generate them, in fact, it's just that some people (you, me and Rich, so far) are finding that the floating 'Properties' window won't do it any more, you have to click the Control (or the GUI, in the case of GUI_Click). That'll create the function if it doesn't already exist, and open the script at the right point.

For reference anyway:
Button_Click, GUI_Click: Require GUIControl *control, MouseButton button
Slider_Change, ListBox_SelectionChaged, TextBox_Activate: Require GUIControl *control
Title: Re: Text parser GUI
Post by: frission on Mon 08/10/2007 18:00:13
Thanks! Glad to know I wasn't totally crazy in not being able to find this anywhere. :-)