MODULE: CustomDialogGui 1.9

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

Previous topic - Next topic

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

SMF spam blocked by CleanTalk