Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Whyshchuck on Thu 26/04/2018 16:17:03

Title: GUI accessible from dialog
Post by: Whyshchuck on Thu 26/04/2018 16:17:03
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!
Title: Re: GUI accessible from dialog
Post by: Crimson Wizard on Thu 26/04/2018 16:28:21
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) Select

EGO: say something
NPC: say something
   gMyGUI.Visible = true;
NPC: say something else
Title: Re: GUI accessible from dialog
Post by: Whyshchuck on Thu 26/04/2018 16:34:17
unfortunately not, because dialog script is blocking global script and gui is inoperative
Title: Re: GUI accessible from dialog
Post by: Crimson Wizard on Thu 26/04/2018 16:36:42
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...
Title: Re: GUI accessible from dialog
Post by: Whyshchuck on Thu 26/04/2018 16:42:40
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) Select
@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?
Title: Re: GUI accessible from dialog
Post by: Crimson Wizard on Thu 26/04/2018 16:46:41
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.
Title: Re: GUI accessible from dialog
Post by: Whyshchuck on Thu 26/04/2018 16:50:43
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.
Title: Re: GUI accessible from dialog
Post by: Crimson Wizard on Thu 26/04/2018 16:57:04
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.