Hello there, adept AGS scripters of the world,
I am having troubles with a temporary custom dialogs GUI. I simply copied the examples and modified them to suit the game, and it works like it should and renders nicely, but there are two things I don't really know how to.
Basically, I'd like to be able to make the GUI look like a book page where you can click certain things, others not, and where you can flip pages to bring up the next pair of, let's say, 7 clickable dialog lines.
The first thing I fail at is a line break for long sentences within the dialog_options_render-function. I just don't know where to put it and how to use the GetTextWidth command appropriately.
The second thing is the flipping of the pages - how can I determine that after a certain amount of displayed responses, others should be displayed on the next page?
I realize this could be some trouble to explain, but I'd really, really appreciate it.
Well, decide on the width of the area that you want to render the text into. Then, use GetTextHeight to find out how tall the text will be, and use DrawStringWrapped to draw it there.
Thanks, Chris! I think the first part of it works now (I had overlooked the DrawStringWrapped command in the manual), but since I have changed the script, all the dialog options are cluttered on top of each other and I can't seem to fix it. I am pretty confused by what "width" and "height" actually mean...especially since in the example, it says:
ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontFont0, 10000);
I don't get where that 10000 is coming from, could somebody explain it to me? Thanks!
The example in the manual is overly-simplistic, and just supplies a width of 10000 such that the text will never wrap. Rather than 10000 you should supply the width of the area that you're drawing the options into.
I can't remember why the example uses 10000 actually, it should probably be "info.Width - 10" or something like that.
Alright, the first part works like a charm now!
The next step would be to determine when one book page is full and the player has to switch over to the next page.
I suppose I should try to first render only, let's say, seven options in the dialog_options_render-function and then display the next seven using the dialog_options_mouse_click. I'll try my luck and maybe come back and whine if I fail.
edit: Alright, I am back to whine, already. I have managed to display a certain amount of dialog options, but switching (by right clicking on the GUI without clicking a dialog option) over to the next page will trigger one of the options on the next page immediately.
If your dialog_options_get_active function returns an option number, AGS will process that when the player clicks the mouse. The example in the manual just checks the Y co-ordinate and returns the option at that vertical position, so you probably need to exclude the location of your scroll arrows from returning an option number.
This custom dialog stuff is quite complicated, but the idea is that it provides AGS with the power for advanced scripters to be able to create script modules with custom dialogue systems -- it's certainly not something I'd recommend playing around with if you're not completely comfortable with scripting :)
I totally agree that this kind of advanced scripting is way over my head - which puts me in kind of an awkward situation, as it seems like this is the only way I can implement a custom dialogs GUI for a certain room, or is there another possibility to do this?
I have been searching the manual and the forums high and low for a clue if and how it is possible to change the dialogs GUI at runtime, but to no avail.
game.speech_text_gui The textwindow GUI number used for sierra-style speech.
From the game variables page in the manual.
~Trent
If you mean the Dialog Options GUI, you can change it temporarily using the SetGameOption function (http://www.adventuregamestudio.co.uk/manual/SetGameOption.htm).
Quote from: Pumaman on Wed 03/12/2008 21:54:21
If you mean the Dialog Options GUI, you can change it temporarily using the SetGameOption function (http://www.adventuregamestudio.co.uk/manual/SetGameOption.htm).
Zounds, I have never even seen this page! Thanks² and hooray for my completely worthless scripting efforts! I could have simply asked for it right away, I guess...
Trent R, thanks, I knew of the existence of that command - after all, it is not as well hidden as the other one.
Dang, meant to post the one CJ did but wasn't thinking... I think I should probably take a break from the forums.....
~Trent
Hey!
I've just finished a module for the custom dialogs, don't worry - the code is in english ;)
(http://blog.sonores.de/wp-content/uploads/2008/12/customdialog.png)
It supports optional bullets, up/down scrolling borders and background graphics.
Get it while it's hot - so far I haven't found any bugs, but there could be still some in.
Oh, and I've only tested it in 320x200...
By the way, is it good enough for the module section?
Abstauber saves the day!
Woo-hoo! Great job, I was pulling my hair over here...
Yay, thanks!
The module is now here, btw.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36313.0
Quote from: abstauber on Sun 14/12/2008 16:06:09
Yay, thanks!
The module is now here, btw.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36313.0
Groovy.