MODULE: CustomDialogGui 1.9

Started by abstauber, Sun 14/12/2008 16:03:36

Previous topic - Next topic

abstauber

Abstract
Abstract: With this module you can add all sorts of dialog GUIs.
          Think of it as an easy to use interface to AGS' native DialogOptionsRendering

Dependencies 
AGS 3.4 or later

Version
1.9

Github
https://github.com/dkrey/ags_customdialog

Downloads
https://github.com/dkrey/ags_customdialog/releases/

Screenshots
icon based:


text based:


high-res and bottom up sorting:



Revision History
Since this is on github now, you can follow the changes there.

Enjoy :D

Dualnames

That sure looks cool.. nice sales pitch!!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Shane 'ProgZmax' Stevens

That's quite nice.  It looks like you have it allow as much vertical space as necessary for the text but the horizontal is locked to the limits of the gui?  Or is there some upper limit to the number of characters as well?

abstauber

I don't know if I get you right, but currently there's no horizontal scrolling as I'm using word wrap. So if you have a really long string, it might get wrapped three times, but is still shown.


Shane 'ProgZmax' Stevens


Dualnames

Abs? Is this compatible with 640x480 reso?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

#6
I haven't used high res coordinates, so if not pixel perfect. But apart from that it works fine.
If you're using it in high res you might want to turn off the outer border line though. Edit: That should work now too.

Dualnames

Quote from: abstauber on Tue 16/12/2008 16:30:55
I haven't used high res coordinates, so if not pixel perfect. But apart from that it works fine.
If you're using it in high res you might want to turn off the outer border line though.

It works apart from the arrows. The clickable area is weird and doesn't work properly.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

You still have the mousewheel ;D
But thanks for the hint, i'll look into that.

Dualnames

I 've implemented it into my game and will still use it, but I just made all the dialog non clickable.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

Could it be, that you're not using the current version?
I just re-checked 640x480, it works great. The issues you're having sound like v1.1 ;)

Dualnames

I'm using 1.1 so I just got unlucky..thanks abs.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

very welcome. Thanks to you I could iron out two more bugs. So if you're using line numbering, you should upgrade again ;)

TheMagician

Absolutely great and useful module Abstauber! ... makes custom dialog options look so easy  :D

However, I'm having trouble when translating the game.
Dialog options that have 'show' and 'say' enabled in the dialog editor only appear once in the translation file - which is the normal behaviour. So I enter the translation for that line, compile the game and this is what happens:
- The dialog box still shows the option in the original English version
- When I click on the option the character says the translated version.

I'm not sure if you can change this behaviour or whether it is a problem with an internal function of AGS.

abstauber

We should also thank kaputtnik for demanding that module :)
To be honest, I totally forgot about translations, but now it should work.

Pumaman

Great work with this :)

I think that the translation thing is actually a bug in the AGS Dialog.GetOptionText command, which should return the translated text. I'll get that fixed for 3.1.2, but your workaround of using GetTranslation should continue to work fine :)

kaputtnik

Quote from: abstauber on Wed 24/12/2008 12:35:39
We should also thank kaputtnik for demanding that module :)

It has been a pleasure. Demanding things and getting credit for is so top notch, I think I'll make this my professional goal. I will now go and become a film producer, see you soon.
I, object.

Galen

Excellent mate, just what I wanted (since the default dialog window is a bit dull).

Dualnames

#18
Thing's were fine with this module, but for a reason I don't know now it's bugging my game. I'm using AGS 3.1.1 and everything was fine, but now I start a dialog I get this error.



This was tracked down by Leon, but after playing my game I got it as well.

EDIT: I want to use that module in my game..
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Pumaman

Can you upload the crash dump file for me to check it out?

abstauber

Does your game crash with any dialog or just a certain one? And if so, is there anything special about it, like a special char?
Or does the game still crash, if you replace that dialog?

I'm just wondering because line 103 in my module is empty and line 104 counts the numbers of options... maybe it's the best to wait for CJs analysis.

Dualnames

#21
Cj, Leon has kept the dump file, since he reported it. There's this thing abstauber, I managed to reproduce it, If you load the game and or save the game (opening the save and load gui doesn't affect it) and then try to run the dialog, the game crashes. It crashes with two dialogs (that's the total number of them). There's not a special char inside it, when the game's about to start the dialog makes a small pause and crashes.

Edit: The line is 109. ( I updated (in case I haven't) to the newest version, and it still occurs).
        I'm using AGS 3.1.1 (just saying)
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Pumaman

Well, is it only Leon that has this problem, or do you get it too? If so, can you upload the game so that we can investigate?

abstauber

#23
Hey, I can crash the sample game too  :)




Code: ags

  // Fill GUI Background
  if (CDG.bg_img==0) info.Surface.Clear(CDG.bg_color);
  else info.Surface.DrawImage(0, 0, CDG.bg_img, CDG.bg_img_transparency);


As you've already mentioned, it crashed after the game is beeing loaded. But it only occurs, if a background image has been used.

So it doesn't crash if CDG.bg_img is set to 0 and stays 0. But as soon as DrawImage is involved, the games crashes after being loaded.


@Dualnames:
In order to get rid of this showstopper, I'd suggest, you go on without a background image until this bug gets ironed out.


@CJ
Here's a crashdump (pls. remove the .doc)
http://www.2dadventure.com/ags/CrashInfo.3.11.1056.dmp.doc


update
It doesn't seem to crash in AGS 3.1.2(R2) anymore... hmm... or a least I can't get it to crash.

Pumaman

Hmm, how did you make it crash? I tried loading the sample game with 3.1.1 and running it, but it seemed to work fine both before and activating the device.

Did you have to make any changes to the sample game to get it to crash?

abstauber

Hmm.. as I said, unfortunately I can't reproduce it anymore  :-\

What I did to make it crash:
1) Talk to Roger
2) Exit the dialog
3) Activate the device
3) Save the Game
4) Quit the Game
5) Run the .exe again
6) Load the game
7) Talk to Roger and vóila..

I've used the same version that I've uploaded here as well without any changes, but still it just doesn't want to crash again.

btw. I'm on vacation for the next 2 weeks, not that you think I don't care anymore ;)

Knoodn

is it possible to use an alpha blended GUI for dialogs? it doesn't work for me. there are only pink pixels instead of transparent ones.

Dualnames

#27
Has the Bug been fixed for AGS3.1.2+ Versions?

EDIT:Actually no. If you start any custom dialog gui dialog then restore a game and try to run a new one the same error appears.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Pumaman

Quote from: Knoodn on Wed 11/02/2009 22:10:21
is it possible to use an alpha blended GUI for dialogs? it doesn't work for me. there are only pink pixels instead of transparent ones.

Currently this is not supported, however I will consider adding it for a future version of AGS.

QuoteHas the Bug been fixed for AGS3.1.2+ Versions?

EDIT:Actually no. If you start any custom dialog gui dialog then restore a game and try to run a new one the same error appears.

I still can't reproduce this following abstauber's steps, it works fine for me with 3.1.1 and 3.1.2.

Dualnames, could you upload the crash dump file from when it crashes with 3.1.2?

Dualnames

QuoteHas the Bug been fixed for AGS3.1.2+ Versions?
I still can't reproduce this following abstauber's steps, it works fine for me with 3.1.1 and 3.1.2.

Dualnames, could you upload the crash dump file from when it crashes with 3.1.2?

Sure, no trouble.
Crash dmp

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Pumaman

Thanks. With the help of that crash dump I think I've narrowed down the problem, though I still can't reproduce it myself. Can you please try this new acwin:

http://www.adventuregamestudio.co.uk/acwin.zip

and see if that solves the problem?

Dualnames

Quote from: Pumaman on Sun 15/02/2009 14:08:50
Thanks. With the help of that crash dump I think I've narrowed down the problem, though I still can't reproduce it myself. Can you please try this new acwin:

http://www.adventuregamestudio.co.uk/acwin.zip

and see if that solves the problem?

Does it? My god it does. Thanks a million bunch for that Chris.. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Pumaman

#32
Glad to hear it! This fix is now included in 3.1.2 SP1.

abstauber

Hey,

just uploaded version 1.3 with three new features.

1) the GUI is now able to appear at your mouse cursor's xy-position
2) width and/or height can be auto adjusting. If you use a scaling background image, this might look a little strange ;)
3) auto alignment for the up-down arrows

'hope you'll like it :)

Dualnames

Oh..that's great. It was just perfect..but I think it just went better. Great man, I'm so using it. You still don't want money right?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

Hehe, thanks :)
And there's still room for improvements - unfortunately the more I add the more confusing it gets with all its variables.

Maybe for new features, I'd use comma seperated strings as variables ;)

abstauber

The dialog GUI strikes again: now it's time for 1.4 !

Featuring icon support, custom border decorations and lot's more.

To use GUI icons, you only have to rename your dialog topics.

For example
(d13,20)Good Bye

In the brackets:
d: tells the gui, that this topic is a dialog topic.
13: the icon to be drawn
20: the highlighted icon

Another example:
(i21,22)Jelly Beans

In the brackets:
i: tells the gui, that this topic is an inventory topic. Inventory topics can be sorted after dialog topics. You can also add a linefeed in front of inventory topics
21: icon
22: highlight icon

Just make sure stick to this syntax and don't forget the brackets.

Things, you should be aware of when using icons:
* You can't mix icon and text style in the same dialog. So if you want icons for a dialog, use have to use this syntax for the whole dialog. You can still have different dialogs of course ;)

* You have make sure to uncheck "say" in the dialog editor. If you want the topic to be said, you have to add the text in the dialog itself.

Trent R

Wow! This excellent module just got even better! The icon support looks awesome abs.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Knox

This is really great...thanks a lot for your work, its really cool! :)
--All that is necessary for evil to triumph is for good men to do nothing.

xenogia

When I try and use it I get the following

GlobalScript.asc(64): Error (line 64): Undefined token 'CDG'


abstauber

I assume, you set up the GUI in your global script. So you need the following line in there as well.
(place it somewhere in the first lines and not in a function)

Code: ags

import CustomDialogGui CDG;



uswin

Hi, abstauber, your module is great, well I had a question, is it possible to create custom GUI to use for Speech / text in ags ( not for dialog option) in your module ? , Just like speech / text gui in japanese RPG game ?





thanks.


abstauber

Hi, thanks for using :)
But I'm afraid if you "just" want the speech to be displayed in a GUI, you don't need this module. It's just for selecting and showing dialog options, not for the speech itself.

As far as I know you could use the option: "custom text-window GUI" in the general settings tab.

uswin

Well, yeah, I already know that custom text gui thing,
but the point is, custom text gui doesn't give me the flexibility to create a text gui such as in the above picture, (with a character picture above the text gui and other decoration that doesn't use tile).
And when I see your module which is quite similiar with what i thought so i'm just curious.
Please let me know if you ever come across the solution for something like this

well thanks for the reply ;D

abstauber

A little off topic, but you could try denming's video tutorials starting from part 34
http://www.youtube.com/watch?v=zZpRKs4rZQY
This could be what you need.

Maybe there's also someone on the beginners forum who has some experience in sierra style portrait dialogs.

Good look :)

uswin


Dualnames

Attempting to update from 1.3 to 1.4, a rearrangement of some short happened to all the elelements of my custom dialog guis and they're all 25 pixels to the right..does this have to do with the centering thing?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

abstauber

*cough* I've messed up left and right in the before 1.4.
You should be fine, if you just flip left and right.

If it doesn't help, could you give me some more details?

Tanique

First of all fabulous job with this module!  It's so thorough and leaves so much to the imagination!  Great work and thank you for sharing!  Just an observation about the right-left switch:

Quote from: abstauber on Sat 04/07/2009 11:22:45
*cough* I've messed up left and right in the before 1.4.
You should be fine, if you just flip left and right.

If it doesn't help, could you give me some more details?

I think what has occurred is the letter display buffering is no longer in sync with the mousover-hotspot buffering.  If you put a "this.border_left" value of 30, the mouse will not highlight any text while hovering within the first 30pxls on the LEFT side of the GUI, which is what it's suppose to do.  However, at the same time, it is also producing a text display boundary 30pxls from the RIGHT of the GUI.  Both the text and the mousover-highlighting borders need to be in sync for left/right, because right now their lefts and rights are opposite, and yet scripted into the same single value.  Hopefully what I said makes sense.  If it doesn't let me know and I'll try to find another way to explain it.

Also, I have a suggestion, although I'm not sure how easy it is to script.  For the vertical autosize function, it appears that the dialog window is always stretched downward to accommodate new text.  Is there a way to make the bottom of the dialog box the anchor point so the box stretches upwards instead?

Thanks again for a great module.  Keep up the good work!

abstauber

Hi Tanique,

thanks a lot for you feedback. Here's a new beta which should iron out those problems with the highlighting:
CustomDialogGui_beta.zip

While I've been correcting the highlighting, I've stumbled upon a problem with the alignment of the arrow sprites. So now the arrow position is independent from the gui borders, but on the downside, you have define their offset yourself.

Code: ags

    CDG.auto_arrow_up_offset_x      = 5;
    CDG.auto_arrow_down_offset_x = 5;
    CDG.auto_arrow_up_offset_y      = 4;    
    CDG.auto_arrow_down_offset_y = 16;  


I've also added your requested anchor point:
Code: ags

    CDG.mouse_anchor  = eAnchorTopLeft;


So now, all you need is to set the mouse_anchor to eAnchorBottomLeft.

If everything's fine with the beta, I'll update the first post and make it "public".

Tanique

Thanks Abstauber!

I played around with the beta and everything seems to be working fine.  Buffers and border edges seem to be happy again! Just one comment:

the new "this.mouse_anchor" is fabulous and I'm sure will be useful for a number of users.  However, is there a way to apply anchorpoint options for dialog boxes with fixed positions, not just for the mousecursor-position option?  As an example, I want to have my dialog box always in the bottom-left corner of the screen, so the dialog options will stretch the box upwards with the bottom edge always on the same position.  Basically, exactly what you did for this.mouse_anchor only for a fixed xy position.  I don't know enough about scripting to go about doing it myself.

Thanks again!

abstauber

I'm glad to see, that this bug is finally gone :)
Actually it's a good thing that you're yet learning to script. I bet, most users silently fix those bugs themselves rather than reporting it.

If I got you right, you like to have autosize with a fixed position featuring the mouse anchor.

Well, this should do it:
CustomDialogGui_beta2.zip

Could you please take a look and tell me if it works for you?

Tanique

lol I think I'm confusing you!   ??? My bad...

Ok I've fiddled around with the General Settings and what I'm looking for is "Print Dialog Options Upwards" to be "true"

With your module imported that option seems to do nothing. I think it's being overridden.  So if there's a way to change that setting in your module instead that would be super awesome  ;D

By the way, you rock.

abstauber

Hehe, maybe my subconscious didn't want to understand it, since the mouse anchor has been much easier to script ;D

Anyway, "print dialog option upwards" does the following, according to the Editor:
The first dialog option will be at the bottom, and the last at the top

Here's a new flag, that mimics this behaviour (I hope)
Code: ags

CDG.dialog_options_upwards=true; 


It does work in text mode as well as in vertical icon mode (without icon_sort_inv).
CustomDialogGui_beta3.zip

Btw. I'm getting kind of curious, how your GUI might look like ;)

Tanique

Hmm, so just to confuse us even more, it turns out that the "Print dialog options upwards" description, and what it actually does, are different lol.

If you have no special custom settings for a GUI set, and turn "Print dialog options upwards" to TRUE, all options are still listed downwards as usual.  BUT as the number of active options decreases and the list gets shorter, the top options shift DOWN instead of the bottom options shifting UP.

I'm a quick learner and after reading through your scripting I think I'm able to script what I want myself.  Give me a day or two and if I figure it out I'll post a demo of what I end up with and what the code looks like.

abstauber


abstauber

Thanks for you PM. Now I finally understand, what you've needed. :)

Here's the new beta:
CustomDialogGui_beta4.zip

I've renamed the var mouse_anchor to anchor_point, since it doesn't have much to do with the mouse anyway.

Here's a sample GUI which you can paste in the demo, after you've updated it with the beta:

Code: ags

    dialog_id = 0; 
    showGuiType.Text = "GUI: Text GUI bottom to top";
    CDG.setAutosizeCorners(49, 107, 43, 44);
    CDG.setAutosizeBorders(47, 108, 42, 109);
    CDG.seperator_visible       = false;
    CDG.autosize_maxheight      = 180; 
    CDG.bg_color                = 50744; 
    CDG.text_color            = 0;
    CDG.text_color_active     = 1;     
    CDG.gui_xpos                = 0;
    CDG.gui_ypos                = 200;
    CDG.border_left             = 17;
    CDG.border_right            = 16;
    CDG.border_top              = 5;
    CDG.border_bottom           = 5;   
    CDG.auto_arrow_align        = 3;
    CDG.auto_arrow_up_offset_x   = 5;
    CDG.auto_arrow_down_offset_x = 5;
    CDG.auto_arrow_up_offset_y   = 4;    
    CDG.auto_arrow_down_offset_y = 16;
    CDG.yscreenborder            = 0;
    CDG.xscreenborder            = 0;
    CDG.anchor_point             = eAnchorBottomLeft;
    CDG.dialog_options_upwards   = true;
    CDG.gui_pos_at_cursor        = false;
    CDG.autosize_height          = true;     



Edit: The beta is now final. These are the new options:

CDG.anchor_point
CDG.dialog_options_upwards
CDG.auto_arrow_up_offset_x
CDG.auto_arrow_down_offset_x
CDG.auto_arrow_up_offset_y
CDG.auto_arrow_down_offset_y

Digital Mosaic Games

I´ve tried to use your example and your template but it says It can´t be run with the beta version and I need AGS 3.2.0. But there isn´t a AGS 3.2.0 :(

abstauber

*cough* yes, I admit, it's a little awkward.
The module of course works with 3.1 - but I've compiled the demo with a release candidate of AGS 3.2.
So if you want to try out the demo, get the latest release candidate of AGS 3.2 here:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37668.0

(you have to scroll down)

Sorry about this - as soon as the 3.2 goes final, I'll update the demo

Knox

Hey Abstauber,

I love this module! I was about to post a bug but then noticed it was fixed in your new release :)

However I ran into a little problem but im not sure if its your module though, causing the prob... Here is the prob:

Im using Custom Dialog1.5, 1024x768 and 32 bits. My customdialog GUI is a png with the pink color as transparent. Everything works great in window mode, but when I go full screen and have the borders on left or right for widescreen (in the release candidate), the customdialog GUI is off-center (part of it gets eaten from the borders, and its way way right off-center).

Would this have something to do with your module, or (more likely) the fullscreen with borders in the release candidate (2)?

If it has nothing to do with your module, Ill post this then in the bugs section.
--All that is necessary for evil to triumph is for good men to do nothing.

abstauber

Since it works in windowed mode and the script doesn't make a difference between that and fullscreen, I assume (hope) that we can blame AGS for it :D

So my guess is, that the widescreen borders somehow affect the coordinates of the special drawing surface, AGS is providing for custom dialogs.

I'll have to work on the module in the next days anyway, because Monkey_05_06 has sent me some really interesting code, which needs to be included. So if I'll encounter this widescreenborder problem too, I'll let you know.

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

GarageGothic

Seems like it could be related to this widescreen border bug. Hopefully it'll be fixed in the next stable version of AGS.

Knox

Problaby, eh? I agree, hopefully it'll be fixed for the next version :)

PS: When you press on the arrow to go up or down the dialog options, right now it goes up by one, I believe. Is there a way to make it go up or down by more...? For example, say on my page I have 3 questions that are showing, but since there isnt enough room, the other 3 arent displayed...you have to press the arrow to scroll down to see the other 3. Instead of pressing the arrow two more times, can I set the arrow so it just displays the next 3 questions?

(Hope that makes sense? :P )
--All that is necessary for evil to triumph is for good men to do nothing.

abstauber


Knox

--All that is necessary for evil to triumph is for good men to do nothing.

abstauber

Here's a new beta
http://shatten.sonores.de/wp-content/uploads/2009/12/CustomDialogGui_beta1.zip

- added an option to scroll through multiple rows per click.

it's called like this:
Code: ags
 CDG.scroll_rows = 2


- added support for (semi)transparent backgrounds and antialiased ttf fonts. (Thanks Monkey_05_06)

So whenever you have a background image and set it's transparency above 0, this feature is activated.
Since it's just a workaround until the AGS supports this natively, there are a few drawbacks:


* Tinting is not supported (yet)
@Monkey_05_06: you told me, that this should be easy, but I have no idea, how to reproduce a character's tint.

* no walkbehinds

* no area lighting

Of course, these drawbacks appear only, if you have a character or object behind the transparent part of the GUI.

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

The Character/Object-specific tinting I don't know a work around for. You might have misunderstood me. The problem is that there's no way (that I know of) to get a Character/Object's current tint levels.

The walkbehinds cannot be supported as is. A workaround for that is to use objects/characters instead. Otherwise your characters will always appear in front of the walkbehinds in any area where the dialog options are being rendered at. Outside of that area it shouldn't be a problem (as denoted by abstauber above). ;)

Finally as for the area lighting, I think that should be possible using the Tint functions right? It's something I probably need to account for myself in my codes, but I'm not using any of these things myself so it does make it more difficult to understand what exactly needs to be done to emulate them. :=

Knox

Hey abstauber,

Works GREAT! Its exactly what I needed...Thanks :)
--All that is necessary for evil to triumph is for good men to do nothing.

Knox

Hey abstauber,

I was wondering if it would be too much to ask to add another feature to this already-great module?

It would be nice to have highlight image and push-down image for the Up arrow and Down arrow

Something like:

Code: ags


  this.uparrowHighlight_img     = 45;
  this.uparrowPushed_img     = 45;

--All that is necessary for evil to triumph is for good men to do nothing.

abstauber

Hmmm... if you can make into the highscore of my current game, I'll add it ;D ;D


And because of my cheesy attempt of surreptitious advertising, I'll add it anyway ;)


@Monkey
QuoteThe Character/Object-specific tinting I don't know a work around for. You might have misunderstood me.
Yup. I thought that you might have found a way of reading explicit tints. I've already added your updated functions :)

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

Crimson Wizard

I have a question. Can I use this module to make a totally custom dialog, like when dialog options aren't taken from dialog object, but inserted manually from some list?

Also, I think there's a mistake in information, it sais: AGS 3.2.1 SP-1 or later, but AGS 3.2 isn't yet released... did you mean AGS 3.1.2 instead?  ::)

abstauber

Hey Crimson!
You're right, I've meant 3.1.2 :) On the other hand, the latest example has been compiled with 3.2 RC2, since I didn't pay attention, which editor I launched that moment. But the module works fine in 3.1.

Unfortunately the module itself depends on AGS' internal dialog functions. Lists or textfiles aren't currently supported.
I haven't tried these module (AGS 2.7), but it seems like they override the dialog functions or do something of their own.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25866.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=9528.0



@General Knox
QuoteIt would be nice to have highlight image and push-down image for the Up arrow and Down arrow
Sorry letting you wait - right now, highlighted images are not possible, because there's no way to refresh the dialog surface by hand. But Chris already knows about this, so when he adds this feature, I'll upload the new version

Rulaman

Hi Abstauber,

is it possible to modify your module so, that the up- and down arrows are over and under the text like in this picture?


http://img145.imageshack.us/img145/8706/dialogtemplate.png



The first part is a little modification of the available parameters.
The next three parts are the behaviour that i want.

The second part is in the middle part of an scrollable dialog.
The third part is the module start.
The fourth part is the dialog end.


Greetings
Rulaman
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

abstauber

Hi Rocco, Rulman (doh!)

this should be possible. If you're using a fixed gui, this is no big deal since you have these options to control the arrow position:
Code: ags

  CDG.uparrow_xpos    = 189;
  CDG.uparrow_ypos    = 1;
  CDG.downarrow_xpos  = 189;
  CDG.downarrow_ypos  = 90;


If you're using auto aligned arrows, you can define their relative positions like this:
Code: ags

  CDG.auto_arrow_up_offset_x = 1;
  CDG.auto_arrow_up_offset_y = 1;
  CDG.auto_arrow_down_offset_x = 1;
  CDG.auto_arrow_down_offset_y = 1;  


Cheers!

Rulaman

Hi abstauber,
Im' not Rocco  :)

I already modified this variables.

Let me describe my problem a little more precise.

I have a dialog with 7 options and a DialogGUI with five dialog lines (as shown in the picture.)
At first i want see the first four dialog lines and in the fifth line my down arrow.

Now I press my down arrow and get in the first line an up arrow, in the lines two till four my dialog options and in line fifth an down arrow.

At the end of the dialog only the up arrow is shown in the first line and the last four dialog entries.

I hope it is now clear. I though the picture was self explaining.

Rulaman
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

abstauber

@Rulaman
Sorry, I've been in hurry when I've answered your post :)
If I get you right, you want the scrolling arrow to appear in the first/last line of the dialog. I think I've seen this on the gameboy before :)

But unfortunately the module doesn't support this. And if I write it in, text wrapping will definitely become a problem  :-\

So what you could do is to adjust the top/bottom borders when scrolling.

@General Knox
Thanks for adding the bug report to the tech forums. Could you try this beta and tell me if its good now?
http://shatten.sonores.de/wp-content/uploads/2010/02/CustomDialogGui_beta3.zip

I've also added the requested scroll arrow images, but it's still kind of experimental.

Code: ags

    CDG.scroll_btn_delay = 0.5;
    CDG.uparrow_img             = 123;
    CDG.uparrow_hi_img          = 122;
    CDG.uparrow_push_img        = 124;
    CDG.downarrow_img           = 126;
    CDG.downarrow_hi_img        = 125;
    CDG.downarrow_push_img      = 127;

Knox

Hey Abstauber,

The custom dialog GUI is now centered, even with side-borders and full screen....yes! Thanks a lot!!

Also, the highlight images/push images for the arrows works great...thanks a lot!

I might be mistaken, but I think that the scroll rows function might be broken though, not sure(?)...could be just me :P...perhaps you can test on your end? Im setting it to 5 like before, but it only scrolls down 1, like before the feature was added (but again, it might be me who did something wrong so Ill go double-check, :P)

Great work as usual...:)
--All that is necessary for evil to triumph is for good men to do nothing.

abstauber

Hey thanks :)

I just checked the scrolling option in low and highres. It scrolls fine here - can you give more some more details on your GUI (like fixed or autoposition, icons or text) ?

Just as a side note: the highlighting is very experimental. In order to refresh the GUI surface so the highlight gets visible, I have to set the active dialog option to 1.

This means if you click really fast on the arrows or quickly hover it and then click, it's possible that the first dialog option gets accidently chosen.

abstauber

Okay, time to get out of the beta state: here's 1.6.

The most important change is a bugfix, to correctly draw non-square icons. There's also experimental support for highlighted scroll arrows, but I don't recommend using them until AGS fully supports it.

Enjoy :)

Knox

The link for 1.6 is in the first post, right (or am I a huge retard)?  :P
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

Hey abstauber..just wanted to let you know I have a grievance with your module. Normally I'd just script this type of thing myself but I am working with general_knox and considering I'm on the clock here there's no need to reinvent the wheel when between the two of you the groundwork, foundation, and a fair amount of the structure of the building have already been set in place.

In the header file you have the following lines:

Code: ags
int CDG_active_options[];
int CDG_active_options_height[];
int CDG_active_options_width[];
int CDG_active_options_sprite[];
int CDG_active_options_hisprite[];
int CDG_active_options_per_row[];
String CDG_active_options_text[];


This unnecessarily duplicates the arrays in every single subsequent script, which if you have a lot of scripts (especially if there are a lot of rooms) this can create a very significant consumption of memory. Can you define the arrays in the script file and put an import in the header instead?

Also, a lesser issue here..why is there no import of the CDG instance?

abstauber

@General_Knox: Yep :)

@monkeh'
I'll drop you a pm in order to get some c-tutoring

Edit: Done! Thanks to you, v1.6.1 is now online :)

AdamM

After installing the module I got an error saying 'eFontNormal' was undefined. I only have fonts with enums like eFontFont0 and eFontFont1.

Is eFontNormal a default name, and if so, is the reason I don't have it because I started working on my game way back in AGS 2.7?

EDIT: It must not be that, the 'Custom dialog options rendering' article in the help files states it was written for AGS 3.1, and it mentions 'eFontFont0' in its example script.

abstauber

No worries :D

You can safely rename eFontNormal to eFontFont0. It's just the name of the default font being used to draw text.


Simple use search and replace in CustomDialogGui.asc and get rid of the 'wrong' name.

AdamM

No, I meant, why is it eFontNormal in the first place? All the other default variables compile with no error messages, so where did eFontNormal come from?

abstauber

Oh I see, you've got a point here.

For the demo game I thought it's a good idea to give  fonts names like eFontSpace and also eFontNormal.

But I see that is  a bit awkward if you import the module in one of your own projects.
Yeah, maybe I should change that.

abstauber

*Bump* New version with 32-bit alpha channel support.

Just set bg_img_transparency to "-1" in order to preserve the background sprite's alpha channel.

Code: ags
CDG.bg_img_transparency = -1;

abstauber

Thanks to Secret Fawful, here's a bugfix release. Semi-transparent GUI backgrounds now appear correctly in scrolling rooms.

Mehrdad

Hi sorry for up old topic
It seems there is some problem with new version of AGS 3.4.0.8 .Is any update for this module?
My official site: http://www.pershaland.com/

abstauber

Believe it or not, I finally added 3.4.x support. Many thanks to Ben and Dave for waking me up :)
http://shatten.sonores.de/wp-content/uploads/2017/01/CustomDialogGui_17.zip

Sorry Mehrdad for keep you waiting for such a long time. If this proves to be stable, I'll update the first post and call it an official release.

Mehrdad

Thanks so much abstauber . It works Fine  ;-D
My official site: http://www.pershaland.com/

deadsuperhero

#94
This is a really great module, and I've managed to get pretty far with it in a very short amount of time. I was trying to write my own custom dialog rendering for the past week, and it was much more difficult than I imagined.

Two minor questions:
1. is it possible to set a sprite background for dialog options on eIconMode? I'd kind of like to have icons for dialog options, but also wrap the corresponding image and text with some kind of background to make it look like a button. I guess it might be possible to hack the existing script to draw sprites around each dialog option, similar to how the entire dialog UI allows for a sprite border to be drawn around itself...

After a bit of hacking, it is technically possible, though I'm still debugging how best to do this. Right now, I'm using a static sprite image, but would love to eventually shift over to drawing borders to account for longer dialog options. I added this in the section for Icon GUI Vertical Mode, just before rendering the wrapped string:

Code: ags

info.Surface.DrawImage(CDG.text_bg_xpos, ypos, CDG.text_bg, CDG.text_bg_transparency, 
     CDG.gui_width - CDG.text_bg_xpos - CDG.border_left +10, CDG_active_options_height[i]);


It's absolutely a hack, and I still need to come up with ways to properly address spacing between the buttons...but, it's a start.



2. Is there a value I can set to define the width of dialog options? Currently it's slightly short on the UI, resulting in a bunch of text squished together.


Here's a quick screenshot of what I mean:



Sort of, I just ended up hard-coding a little bit of extra space in the drawing function for each option. Very hacky on my part, but it mostly works now:
The fediverse needs great indie game developers! Find me there!

Dave Gilbert

Hello! Apologies for the necro-posting. Abstauber doesn't seem to post much here anymore and the link to this module no longer works. Is the latest version archived anywhere?

abstauber

Hey, sorry for being gone. Apparently I've missed a few posts, at least I didn't get the notification from last year and I even got some PMs  8-0
But at least I got a notification now - so yes the link from post #92 works for me. I'm keeping my fingers crossed that this module still works with recent versions of AGS. As you might tell, I haven't looked at the code for quite some time.

Dave Gilbert

#97
The version I have doesn't work with AGS 3.6.0.13, but the commands are easily updated. Just a quick search and replace fixes it. If you want to know what I did, lemme know.

Edit: What I did was do a search and replace for the following:

Replace System.ViewportWidth with Screen.Width
Replace System.ViewportHeight with Screen.Height
Replace GetViewportX() with Game.Camera.X
Replace GetViewportY() with Game.Camera.Y

There was also a compilation error because the command "ignoreScaling" no longer works with objects. My custom dialog window won't need to scale, so I didn't bother trying to fix it and instead just commented that bit out. :D It works fine.

edit2: Also, hi Abstauber!

eri0o

Google Chrome blocks http downloads from https pages I think. I think right click, "save link as..." still works. I recently had the same problem downloading some old games from the AGS Games DB.

abstauber

Well since some of you still find this module useful, here's v1.8 along with a refreshed demo.

// 1.8    Added: AGS 3.5 support
//        Removed workaround for pushed down arrows
//        Bumped min. version to 3.4

https://github.com/dkrey/ags_customdialog
https://github.com/dkrey/ags_customdialog/releases/download/1.8/CustomDialogGui_1.8.zip
https://github.com/dkrey/ags_customdialog/releases/download/1.8/customdialoggui_demo.1.8.zip

eri0o

Thanks for the update! It's a really useful module!

Dave Gilbert

#101
Very cool! I've been having a few niggly issues with this module so hopefully someone can help.

I have border images and a background image. Both the border and the background have a transparent color. The border displays just fine, but it looks like the background and the borders are overlapping (the spots where the transparent color gets darker). Normally I'd expect the borders to be drawn right on the outside of the background, but the bottom and right borders are being drawn *on* the background (or vice versa), and the background is extending further to the right and down than it should. Any ideas what is happening here?



I am using an autosized width and height with an anchor point of "top left."

My goal is for the background to be one continuous transparent color, with no overlapping (which creates those weird black spots).

Thanks!

-Dave

abstauber

#102
Actually I've never tested the module with semi transparent borders yet :-[

I'll try to recreate the issue and hopefully this problem also arises in 320x200 .

@eri0o: Thanks :)

Dave Gilbert

I could probably remove the transparent bits of the borders so the background fills up the whole thing, but any ideas why the background is extending *beyond* the borders? I feel like that shouldn’t happen.

I have a deadline of mid-June to get this done so if you don’t think you’ll have time before then I will try to find a workaround.

Dave Gilbert

#104
Actually, while I've got you, there is a second issue I'm having that's been giving me some confusion.

I'm using the auto height and width, so the size of the dialog box is supposed to change depending on the number of options within the box. Sometimes the size is correct, and other times it is not.

Here's a video of what I am encountering (ignore the placeholder walk cycles and audio watermark!): https://www.youtube.com/watch?v=DJ17OlYIfuA

In this example, I perform these steps to reproduce the problem each time:
1 - talk to the old lady. Dialog box is displayed correctly.
2 - exit the dialog without selecting anything
3 - talk to the other character
4 - exit the dialog without selecting anything
5 - talk to the old lady again
6 - Dialog box is displayed INCORRECTLY.
7 - exit the dialog without selecting anything
8 - Talk to the old lady again.
9 - Dialog box is displayed correctly.

In this instance, there is only a small amount of blank space at the bottom on the window, but in other instances the blank area is much larger. There doesn't seem to be a rhyme or reason to it that I can see.

Any ideas on why this might be happening?

Thanks and hope all is well!

-Dave

abstauber

This looks like a variable isn't properly reset.
My daughter's birthday party will be tomorrow, so after I that I'll look into these issues.

Don't worry, I won't vanish without noticing ;)

abstauber

Partial success!
I was able to fix the transparency issue. But I'm having trouble replicating the issue with the bottom border.



Could you give me some details on the dialog itself?

Dave Gilbert

Thanks so much! Regarding replicating the issue, I can see the issue with the bottom border in the animated image your post! You can see the background color extends beyond the border to the right and down. Is that by design?

abstauber

#108
No that was on purpose and represents a fake drop shadow. With the bug present you would see differences in the lighting of borders.

That's the source for my transparency test
[imgzoom]https://i.imgur.com/EvhmwbC.gif[/imgzoom]

Here's a closeup - this should be accurate now.



What I meant was the "white space" below the last dialog option in your video. I'm having two dialogs with three visible options and I don't get any blank options or wrong heights.

eri0o

The dialog height of the last line, notice the space below, in the closeup, is different from the gif shown, if both are the same dialog, maybe this is the issue?

Dave Gilbert

#110
Oh I see! So that "dropshadow" is part of the border graphic and unrelated to the problem I'm having?

As for the blank space underneath the dialog, as I said sometimes it's just one extra space, other times several. I can't think of anything special or specific to my dialogs, although I do use some custom functions to remove and add dialog options. That could be related.

Here are the functions I created. Perhaps one of these is not playing nice with your module? Probably threeDialog() or setupDialog() if I had to guess. If you want a sample of one of my dialog scripts, let me know.

Quote
function setupDialog(this Dialog*)  // This tells the game what dialog is currently being run, called at the Dialog startup entry point
{
  game.show_single_dialog_option=1;
  currentDialog=this.ID;
}

function myOptionOn(int option) // turns a dialog option on
{

  dialog[currentDialog].SetOptionState(option, eOptionOn);
 
}

function myOptionOff(int option,  bool forever) //turns dialog option off
{

  if (forever==false)
    dialog[currentDialog].SetOptionState(option, eOptionOff);
  else
    dialog[currentDialog].SetOptionState(option, eOptionOffForever);
}

function oneDialog(int option) //remove all dialogs, then add a single one which plays right away.
{
    game.show_single_dialog_option=0;

  int x=1;
dialog[currentDialog].SetOptionState(option, eOptionOn);
  while (x<=dialog[currentDialog].OptionCount)
  {
    if (x != option) dialog[currentDialog].SetOptionState(x, eOptionOff);
    x++;
  }
}

function threeDialog(int option1, int option2, int option3) //remove all dialogs, then add three to be displayed
{

    game.show_single_dialog_option=1;

  int x=1;
  while (x<=dialog[currentDialog].OptionCount)
  {
    dialog[currentDialog].SetOptionState(x, eOptionOff);
    x++;
  }
 
  dialog[currentDialog].SetOptionState(option1, eOptionOn);
  dialog[currentDialog].SetOptionState(option2, eOptionOn);
  dialog[currentDialog].SetOptionState(option3, eOptionOn);
}


eri0o

@abstauber

I noticed the width used is different in the functions  in the code here:
https://github.com/dkrey/ags_customdialog/blob/main/CustomDialogGui.asc#L237-L239


My guess is since the GetHeight uses a different width, it predicts a line break, but since the actual width used has 2 more pixels, they are enough for the line break to not happen and thus you keep the height assuming that line break.

I may have misunderstood, but this is the first guess I would use to explore this.

@Dave, can you remove the +2 in these lines and see if it solves?

Dave Gilbert

#112
I saw only one +2 in those lines. I removed it and the bug still happens.

edit: I also downloaded the updated version of the script to test the transparency issue, and that also still remains. The problem of the background sticking out one pixel beyond the border to the right and bottom is also still there.

Here is a link to the image files I'm using, if that helps. I am also using the autosize for height and width, using these parameters:

Code: ags

  this.border_top      = 15;
  this.border_bottom   = 5;
  this.border_left     = 30;
  this.border_right    = 30;
  this.border_visible  = true;
  this.border_color    = -1;

  // Background
  // set bg_img_transparency to -1 if you're using 32-bit graphics and
  // want to preserve the alpha channel  
  this.bg_img                = 6503;
  this.bg_img_scaling        = 0;
  this.bg_img_transparency   = -1;
  this.bg_color              = -1;

  
  // optional autosize, overrides your width and height setting
  // also overrides the position of your scrolling - arrows
  this.autosize_height       = true; 
  this.autosize_width        = true;
  this.autosize_minheight    = 10; 
  this.autosize_maxheight    = 1500; 
  this.autosize_minwidth     = 300;
  this.autosize_maxwidth     = 900; 

Snarky

Is it possible you imported the sprites for the bottom and right borders without preserving the alpha channel? Seems like that might cause it to appear like that in-game.

Dave Gilbert

I imported them all at the same time and the top ones work fine, so that's doubtful. I imported them again just as a sanity check, and the bug remains. It definitely looks like the background is being painted underneath the border, and it extends one pixel beyond it to the right and bottom.


Dave Gilbert

Wait! I set the background image scaling to 0 instead of 1. Now it works!



The extra line problem still remains, but at least the border looks correct now!

Snarky

#116
It still doesn't look quite right to me. The green border has a gap on the lower left side and a near-gap on the upper right side (right above/below the cut-off corner), and a "bright dot" where it looks like it's being drawn double for a couple of pixels on the lower right side. But maybe that's intentional, or at least baked into the sprite assets? But there's also a transparent horizontal line across the top, between the border and the text.

Dave Gilbert

Quote from: Snarky on Sat 07/05/2022 07:22:19
It still doesn't look quite right to me. The green border has a gap on the lower left side and a near-gap on the upper right side (right above/below the cut-off corner), and a "bright dot" where it looks like it's being drawn double for a couple of pixels on the lower right side. But maybe that's intentional, or at least baked into the sprite assets? But there's also a transparent horizontal line across the top, between the border and the text.

The transparent horizontal line was due to an extra transparent pixel at the bottom of the top border graphics. Since the background image extended one pixel beyond where it was supposed to, I hadn't noticed. :D

The holes in the border corners are part of the images, but the stray dark/bright bits at the bottom right are definitely not.

abstauber

I still dare to say, that the rendering of the gui itself is now fixed.

But I am now finally able to replicate the issue - although only with line wrapping dialog options.
Maybe if I fix this, it also fixes your issue.

Dave Gilbert

Yay! Thanks, Dirk. Ready to test when ready. :D

abstauber

I've just pushed a new commit to the repo.
https://github.com/dkrey/ags_customdialog/blob/main/CustomDialogGui.asc

This fixes the issue at least for me. The problem was that the module needs parse all dialog options in advance to calculate the max gui width, before calculating the height of the individual dialog options.

*keeping fingers crossed*

Dave Gilbert

This seems to (thus far) work! Thank you so much!

abstauber

yay, this was a tough nut to crack - I'm glad that it works now.

@eri0o:
About the +2 which I added to the borders. For some strange reasons, this extra space is needed or else I get some unwanted line wraps. For example the text  "option 1" fits in the row, but "option 2" will be wrapped -  maybe because I don't use a fixed width font? Adding two extra pixels gets rid of the problem - in a somewhat dirty way.

Anyway - I could spot any other bugs for the moment, so I've just published a new minor release.  And I still can't believe that the initial release is from 2008 :=
For a certain Ben304 game which never got released.

Snarky

#123
There is a longstanding bug in AGS (it was pointed out as least as early as 2005) where the value returned by GetTextWidth is not the same as that used for line wrapping. Adding 1 is usually enough of a workaround, but if you're working with Text Overlays, TextWindow Controls, or certain functions, you may need to take additional padding values into account as well. If you read that thread, CW explains the ins and outs of it.

abstauber

Ah okay - thanks for pointing me in that direction. At least now I know the reason behind adding 2 px :)

abstauber

#125
I had to publish a new version, because I forgot to remove a debugging fragment. So if you use 1.8.1 please upgrade to 1.9.
I also added the option to set a color for chosen dialog options.

Background on the debugging part:
I tried to see if resetting the scollstate works so I change the player's lightling level

Code: ags

  if (CDG.reset_scrollstate) { 
    player.SetLightLevel(50);
//and so on...

So of course this has to be removed

Dave Gilbert

So I should just remove all instances of player.SetLightLevel?

(I ask because I added some extra code to set the position of the box based on the player position so it's not easy for me to just copy/paste the existing code)

abstauber

Quote from: Dave Gilbert on Thu 19/05/2022 20:42:32
So I should just remove all instances of player.SetLightLevel?
yup, that should do the trick.

Dave Gilbert

Hello! I decided to update the graphics to make them a little snazzier, and I've hit another snag.



As you can see, there is a weird chunk cut out of the lower-right. The chunk remains the same size regardless of how large the window is. All I did was replace the graphic sprites. I've uploaded the sprites here. Any idea why this may be happening?

Any light-shedding appreciated!

-Dave

eri0o

My guess is this usage of width instead of height is a typo. If my intuition is right, then switching the right sprite to be a squared one instead of a rectangle (just stretching so it's height matches it's width), should fix it.

Dave Gilbert

#130
Sorry it took me awhile to reply! Was launching another game. :)

I tried your suggesting of making the "right" sprite a square, but sadly issue still remains. Do the other sprites need to be made a square as well?

Regarding this script:

Code: ags
CDG.gui_height-Game.SpriteHeight[CDG.borderDecoCornerDownright]-Game.SpriteWidth[CDG.borderDecoFrameRight]);

You said that the "usage of width instead of height" is a typo. I replaced "Game.SpriteWidth" with "Game.SpriteHeight" and this is the result:



eri0o

#131
@Dave Gilbert

I think I figured, opened a PR: https://github.com/dkrey/ags_customdialog/pull/1/commits/2a2691f02fbe7a8812bc715a3806993da1d92eb0

In line 1105

Code: ags
CDG.gui_height-Game.SpriteHeight[CDG.borderDecoCornerDownright]-Game.SpriteHeight[CDG.borderDecoCornerUpright]);

Need to also switch the last borderDecoFrameRight for borderDecoCornerUpright


Spoiler
[close]

Dave Gilbert

THANKS!! That did the trick. :D

abstauber

Thanks @eri0o for already providing the fix  :) I've already merged your PR

SMF spam blocked by CleanTalk