Dialog Options background? (Solved)

Started by Hobbes, Thu 27/05/2021 09:24:18

Previous topic - Next topic

Hobbes

Quick one... I know I've got the option to build a custom GUI interface (which requires advanced scripting and scares me a little bit!). However what I just want is to put a sprite behind my dialog options, that's all. I like the default option which puts all dialog choices at the bottom of the screen, but I would like to change the text colours + use a full-width sprite behind it.

Is there a way to achieve this without programming a full custom GUI?

Thanks in advance!

Potajito

Have you look at https://www.adventuregamestudio.co.uk/forums/index.php?topic=36313.0 ? You can do all sort of things, and it's what you are looking for and so much more.

Hobbes

Thanks for your response! I have looked at it in the past, my only concern is that modules can get a bit messy at times when AGS updates. So I don't really want to depend on a module to then run into potential compatibility issues later on and have no ideas how to fix it. :)

I'll give it a go though if there's no easy way to do it without. Even this module does a lot more than what I'm looking for perhaps? Thanks!

Potajito

Quote from: Hobbes on Thu 27/05/2021 10:22:43
Thanks for your response! I have looked at it in the past, my only concern is that modules can get a bit messy at times when AGS updates. So I don't really want to depend on a module to then run into potential compatibility issues later on and have no ideas how to fix it. :)

I'll give it a go though if there's no easy way to do it without. Even this module does a lot more than what I'm looking for perhaps? Thanks!
You could be right, but even if the module is not maintained or can do more than you need, it's always going to be easier than building your own display module, which may face the same issues down the road.

fernewelten

Quote from: Hobbes on Thu 27/05/2021 10:22:43
potential compatibility issues

We should differentiate here between modules, on the one hand, and plugins, on the other hand.

Modules are pre-written pieces of AGS source code. Their code is open and -  once it is installed - modifiable. So if a module doesn't do what you want specifically and you are crafty enough, then you can simply edit the code to your liking. However, just as with any piece of “foreign” software, it may be written in a way you find hard to understand; and if you do decide to add modifications and the original author publishes an update, then you yourself need to integrate your changes and the update changes. The more you have changed the module, the harder that may turn out to be.

In general, modules work for all ecosystems (windows, linux).

Plugins, on the other hand, are pieces of machine code that interact with the machine code of AGS (either its editor or its engine or both). So if a new AGS version comes along, it is quite possible that some plugins no longer harmonize, and in this case there is little you can do about it unless you happen to have the plugin source and can deal with the language it is written in. Thus if your code has relied on a plugin that no longer harmonizes then you may be in a rut.

Also, with Engine plugins it is quite possible that a plugin is written for some specific ecosystems but not for others, e.g., it is available for Windows but not for Linux. In that case, you can only compile your games for the ecosystems that the plugin is provided for.

In a nutshell, you remain in control with modules but you do not with plugins.

Crimson Wizard

#5
Quote from: fernewelten on Thu 27/05/2021 15:02:42
In a nutshell, you remain in control with modules but you do not with plugins.

Modules also have compatibility issues, these arise when scripting language changes. Even if a user has control over module's script, they are not necessarily skillful enough to fix it.

That said, the AGS currently supports full backward compatibility. In General Settings there's "Backwards Compatibility" section that lets you, for example, choose older script support. This will make your game run any script written like 10-15 years ago.

All that said, the original problem could likely be resolved without a module.

Quote from: Hobbes on Thu 27/05/2021 09:24:18However what I just want is to put a sprite behind my dialog options, that's all.

In General Settings there's "Dialog" section and within: "Use GUI for dialog options". Make a GUI, assign a sprite as its BackgroundGraphic, then put its ID (number) into that option.
If I remember correctly, the GUI position matters, so you may have to edit it to keep dialog options at the bottom of the screen.

Hobbes

Dear both,

Thank you so much for this feedback. Fernewelten, you're right, I was thinking about plugins mainly. I remember using a few way back in the day and then tried to update to a newer AGS version and things went a bit... wrong. And then it quickly became a "I have no idea what I'm doing scenario".

Crimson Wizard, I tried to it this way but as soon as I set the GUI to be used for dialogs, the option to change X and Y coordinates for it (as well as the width, which I would want to set to 200 for full-screen coverage) went out the window too. Which is probably why I'll need to circle back to the module mentioned earlier.

And whilst I can always set my game to an earlier scripting version, I seem to have this compulsive desire to keep things up-to-date. I think that's based on past experiences where my work on Buccaneer 2 (we are talking back in 2004/2005 here) went out the window and I messed up a lot of stuff when trying to update to the latest version. And then I was stuck using an older version of AGS, etc etc. I really like all the work you're doing on the engine & editor and would like to keep up with the latest scripting features. Therefore, if I can avoid it, I would like to stay away from any custom coding that might complicate matters later. If that makes sense? (I do realise all of this is stemming from my own inexperience at scripting and therefore the niggling fear of messing up my game halfway-through!)

Crimson Wizard

Quote from: Hobbes on Fri 28/05/2021 01:34:35
Crimson Wizard, I tried to it this way but as soon as I set the GUI to be used for dialogs, the option to change X and Y coordinates for it (as well as the width, which I would want to set to 200 for full-screen coverage) went out the window too.

Does not it work when you set GUI's x, y, width and height? I thought it is supposed to work.

Quote from: Hobbes on Fri 28/05/2021 01:34:35
And whilst I can always set my game to an earlier scripting version, I seem to have this compulsive desire to keep things up-to-date. I think that's based on past experiences where my work on Buccaneer 2 (we are talking back in 2004/2005 here) went out the window and I messed up a lot of stuff when trying to update to the latest version. And then I was stuck using an older version of AGS, etc etc. I really like all the work you're doing on the engine & editor and would like to keep up with the latest scripting features.

You can keep using new features and enable old script commands at the same time. There are options for both of these choices.
https://adventuregamestudio.github.io/ags-manual/Settingupthegame.html#general-settings
See "Backwards Compatibility" section for more information.

Hobbes

I've been playing with this a bit more. My custom dialog GUI is dialog number 7 and I've uploaded all sprites required to draw a simple green box behind my dialog options.

As said before, I would just very much like this box to be drawn towards the lower half of the screen. I've tried GUI.Y & GUI.SetSize. My question, where do I set these? Every time I start a dialog? Or is there a more global way to set this?

I've added this to the first room of my game:

Code: ags

gDialog.SetPosition(0, 100);
gDialog.SetSize(320, 50);


My thinking is that should move the GUI (which is called gDialog) to the second half of the screen and make it full-width.

However, I get this:



Note that this is the 6th room (in that order) the player enters. So whatever I've set in Room 1 might be well and truly forgotten perhaps? I'm just not sure of where to "play" with these GUI settings to see impact. And whether the Dialog GUI option even allows such tinkering, since it dynamically changes size according to the dialog options / length of sentence?

I would be happy with keeping it to its auto-size ability, but just further down the screen... having dialog options superimposed over my characters isn't really what I'm going for.  ;)

Crimson Wizard

I just tested this, and it definitely should work.

Quote from: Hobbes on Mon 31/05/2021 12:37:11
As said before, I would just very much like this box to be drawn towards the lower half of the screen. I've tried GUI.Y & GUI.SetSize. My question, where do I set these?

If these values are supposed to be constant you can set them up right in the editor, where you edit GUI properties.
Alternatively you could use function game_start (e.g. in your global script).

Quote from: Hobbes on Mon 31/05/2021 12:37:11
I've added this to the first room of my game:

Code: ags

gDialog.SetPosition(0, 100);
gDialog.SetSize(320, 50);


Where exactly have you put these lines (what room function)? Are you certain that they got called? For example you may set a break point there, or just "Display("I am here");" nearby to test that engine actually runs this part of the script.

To double check, your game's resolution is 320x200/240?

Hobbes

I'm wondering if I've gone about things the wrong way here. I seem to remember (possibly from older versions of AGS?) that a Dialog GUI had to be a TextWindow GUI. Which is how I've created the Dialog Options GUI. That GUI doesn't hold any options to set X or Y coordinates in the Editor:



This is what I've put in Room_Load on Room 1:

Code: ags

function room_Load()
{
gGui1.Visible = true;
gGui4.Visible = true;
gDialog.SetPosition(0, 100);
gDialog.SetSize(320, 50);
}


Should it perhaps not be a TextWindow GUI? Is that the way to do this?

Crimson Wizard

Quote from: Hobbes on Tue 01/06/2021 11:54:50
Should it perhaps not be a TextWindow GUI? Is that the way to do this?

Yes, I meant regular "Normal GUI". TextWindow does not have a fixed size or position, and resized automatically to the amount dictated by the situation.

Hobbes

That makes a lot of sense. Apologies for not sharing that earlier, I was erroneously thinking it *had* to be a TextWindow.

It's working like a dream now, thank you!

SMF spam blocked by CleanTalk