GUI accessible from dialog

Started by Whyshchuck, Thu 26/04/2018 16:17:03

Previous topic - Next topic

Whyshchuck

Hello,

Nearly whole the game I write is one very very long dialogue.
I use Default game template and have problem with accessibility of menu, saving, loading etc.
The only way I could solve it was adding additional option "MENU" in every dialogue, which stops dialog script and makes GUI visible. I had to add additional integer with number of current dialog which is changed every new dialog starts, and loop in room script which runs dialog with proper index when game is loaded.
Maybe there is any better way to do that?

Thanks!

Crimson Wizard

Not sure I understand what you are trying to do correctly, but if what you need is referencing some GUI from the dialog script: you may use any kind of regular script commands in dialog if you indent them with 1 or more spaces, like this:
Code: ags

EGO: say something
NPC: say something
   gMyGUI.Visible = true;
NPC: say something else

Whyshchuck

unfortunately not, because dialog script is blocking global script and gui is inoperative

Crimson Wizard

#3
Quote from: Whyshchuck on Thu 26/04/2018 16:34:17
unfortunately not, because dialog script is blocking global script and gui is inoperative

Oh, so you want to have user work with GUI? In that case you must stop the dialog.
Dialogs are just like other script functions, they are blocking user clicks while the function is running. User actions may only be handled in between function runs.
Also, AFAIK no other GUIs may be operated while dialog options are on screen. At least not with built-in dialog options.


In other words, I guess your solution is the most natural one that comes to mind. Perhaps that may be optimized somehow to make it easier to handle, but that would require some good thinking first...

Whyshchuck

but is it possible to make it accessible in any way other than putting additional option in dialogue
Now I have last option MENU, which contains:
Code: ags
@X
  gMenu.Visible = true;
stop


But it's not preferable way to make it.
Maybe it's possible to create some hotspot or there is another way to add visible and clickable button, which would make gui on and stop the dialogue?

Crimson Wizard

I do not think AGS allows to click anywhere else when the built-in dialog options are on screen. It just won't run events for those other objects when dialog options loop is running.

You would have to script your own dialog options mechanic to allow that, unfortunately.
Which is doable in theory, but would require to change the way you are starting dialogs.

Whyshchuck

OK, I understand.
Any additional option, I see is to create additional character in font table which would be "MENU" but bordered or made different than other options in any other fancy way.

Crimson Wizard

#7
Quote from: Whyshchuck on Thu 26/04/2018 16:50:43
Any additional option, I see is to create additional character in font table which would be "MENU" but bordered or made different than other options in any other fancy way.

Oh, that's an interesting idea.

Actually, it makes me realize there is a way. You may script custom dialog visuals, which allows you to draw literally anything on options GUI. You may draw some kind of button there, but you would have to write your own detection code to know when user clicks on it.

Look for the "Custom dialog options rendering" and DialogOptionsRenderingInfo articles in the manual, it has some basic examples there.

SMF spam blocked by CleanTalk