Extended Alarcost Dialog Choices Issues

Started by VampireWombat, Tue 15/05/2018 14:19:46

Previous topic - Next topic

VampireWombat

When I made dialog choices yesterday using the Extended Alarcost template 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.

Crimson Wizard

You could please post a link to the template topic or download link?

VampireWombat

Sorry about that, I probably should have thought of that...
Template thread.

Crimson Wizard

#3
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.

VampireWombat

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.

Crimson Wizard

#5
Oh, there is actually more there. You may find this line in dialog_options_render() function:
Code: ags

//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.

SMF spam blocked by CleanTalk