MODULE: CustomDialogGui 1.9

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

Previous topic - Next topic

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