Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: VampireWombat on Tue 15/05/2018 14:19:46

Title: Extended Alarcost Dialog Choices Issues
Post by: VampireWombat on Tue 15/05/2018 14:19:46
When I made dialog choices yesterday using the Extended Alarcost template (http://www.adventuregamestudio.co.uk/forums/index.php?topic=48638) with the size changed to 640 x 360 that it made all the options overlap and clicking on them does nothing.
So I decided to start over with the default size. With the default template and nothing changed, I find that the default dialog displays fine, but none of the options can be selected. I tried clicking, using arrow keys, numbers, and even function keys. Nothing.
I used AGS build 3.4.1.1.12 on an Acer Laptop running Windows 7 if that information is in any way helpful.
I compiled and tested both the template version and the 640x360 version on my laptop and my desktop running Ubuntu and the issues persisted.

Any help or workaround would be great, thanks.
Title: Re: Extended Alarcost Dialog Choices Issues
Post by: Crimson Wizard on Tue 15/05/2018 14:40:55
You could please post a link to the template topic or download link?
Title: Re: Extended Alarcost Dialog Choices Issues
Post by: VampireWombat on Tue 15/05/2018 14:47:21
Sorry about that, I probably should have thought of that...
Template thread. (http://www.adventuregamestudio.co.uk/forums/index.php?topic=48638.msg636461487)
Title: Re: Extended Alarcost Dialog Choices Issues
Post by: Crimson Wizard on Tue 15/05/2018 20:10:48
Oh, I got it.

You need to go to General Settings, Backwards Compatibility and enabled "Use old-style custom dialog options API". This will make options work again.

As for the bad text coordinates, this is because the template script is written incorrectly. It actually uses literal numbers 320 and 200, and similar, in script when calculating dialog option positions. I suggest replacing these with System.ViewportWidth and System.ViewportHeight, as well as values relative to these (like "y = System.ViewportHeight - 40" instead of "y = 160") where necessary.

Look for "dialog_options_get_dimensions" function in GlobalScript - this is where it all starts.


PS. It really saddens me when people who write modules assume the game size in script.
Title: Re: Extended Alarcost Dialog Choices Issues
Post by: VampireWombat on Tue 15/05/2018 20:32:49
Thank you very much for the help.
Changing the option did fix it.
I will have to go through the GlobalScript when I have time. But the main issue is resolved. Thank you once again.
Title: Re: Extended Alarcost Dialog Choices Issues
Post by: Crimson Wizard on Tue 15/05/2018 20:46:55
Oh, there is actually more there. You may find this line in dialog_options_render() function:
Code (ags) Select

//ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontNormal, info.Width - 10);
ypos += 10; // assumes text height is 10


So, if you use different font, or font is scaled, this goes wrong. Normally one should use GetTextHeight function to know the height of the line of text, but they got it commented out for some reason. I have a certain guess why, you should not use "info.Width - 10" there, but "GetTextWidth(...) + 1" if you want to make sure it does not including text wrapping in calculation.