Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: How to change Dialogue window (not Response Box) over heads  (Read 5293 times)

0 Members and 1 Guest are viewing this topic.

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
How to change Dialogue window (not Response Box) over heads
« on: April 14, 2008, 04:32:46 PM »

Hello,

I would like to have a speech window over character's heads with background image (transparent solid color with white text) and would like the window to automatically resize to text.  But which "window" is it that is displayed over characters heads in the demos/tutorials? Or how do I access the spoken text 'window' if it cannot be changed in WindowEdit? Would be nice to have such 'speech windows' like in older sierra games or the new 'So Blonde' game.

I'm working on a small adventure game with 5 other students and am trying to become familiar with scripting the interface, dialogue, menues, and controls.

Thanks in advance,
rkitting

Logged

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #1 on: April 14, 2008, 10:17:31 PM »

You can overwrite the talk method to use whatever window you want to display the text.
Logged
... delete the inner sleep ...

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #2 on: April 19, 2008, 03:24:14 PM »

After reading some forum posts I have a window coming up when character talks (window with static control for text).
However SizeToFit() or HeightToFit() doesn't change the size of my static control. Both commands return 'null'.
I have a TiledImage for the window and have also tried the tiled image for the control. Is there anything else I need to do to resize the text control and window
to fit its contents?  Here's my window file:

Code: [Select]
WINDOW
{
  NAME="DialogWin"
  CAPTION=""
 
 
  TITLE_ALIGN="left"
 
  X=110
  Y=115
  WIDTH=780
  HEIGHT=90
  DISABLED=FALSE
  VISIBLE=TRUE
  PARENT_NOTIFY=FALSE
  TRANSPARENT=FALSE
  PAUSE_MUSIC=TRUE
  MENU=FALSE
  IN_GAME=FALSE
  CLIP_CONTENTS=FALSE
 
  ALPHA_COLOR { 0, 0, 0 }
  ALPHA=0
 
  SCRIPT="interface\dialog.script"
 
  EDITOR_PROPERTY
  {
    NAME="Selected"
    VALUE="False"
  }

  STATIC
  {
    NAME="DialogText"
    CAPTION=""
   
    BACK="ui_elements\win_inactive.image"
    TEXT=""
    TEXT_ALIGN="center"
    VERTICAL_ALIGN="center"
   
    X=0
    Y=0
    WIDTH=800
    HEIGHT=100
    DISABLED=FALSE
    VISIBLE=TRUE
    PARENT_NOTIFY=TRUE
   
   
    EDITOR_PROPERTY
    {
      NAME="Selected"
      VALUE="True"
    }

  }
}


and the method 'DisplayText':

Code: [Select]
method DisplayText(Text, Duration)
{
  this.Visible = true;
  // query the static control
  var St = this.GetControl("DialogText");
 
  // set the text and wait
  St.Text = Text;

  St.HeightToFit();
  St.SizeToFit();
 
 
  Sleep(Duration);
 
  // hide the text after the "Duration" period has passed
  St.Text = "";
 
  this.Visible = false;
}

Logged

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #3 on: April 19, 2008, 03:44:00 PM »

Ok, got the resizing working for the static control after specifying a truetype FONT, but still not perfectly. Also the text alignment doesn't work when SizeToFit or HeightToFit is used.

Where exactly should I put the tiledimage and should the static control be the same size as the window?
« Last Edit: April 20, 2008, 09:30:50 AM by rkitting »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How to change Dialogue window (not Response Box) over heads
« Reply #4 on: April 20, 2008, 09:22:53 AM »

Keep in mind that when using the tiled images, the window dimensions are rounded to multiplies of the tile size. So for example if your tiled image contains 10x10 pixels big tiles, the window (static, button...) dimensions will always be multiplies of 10. Also, the dimensions should be big enough to contain at least three tiles.
You can test the behavior very visually in WindowEdit.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #5 on: April 20, 2008, 12:09:23 PM »

I guess the real problem is that I the .Width property of the static control is not changed by SizeToFit(). I wanted to change the width a little after the call to SizeToFit() according to the width before and after.... but the width stays the same.

Only using SizeToFit() puts the text right on edge of clipped! tiled image, no matter how big the dimensions are of the control.

Would be nice to have a way to change margins or padding of text so it doesn't stay on edge of image.
« Last Edit: April 20, 2008, 12:11:02 PM by rkitting »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How to change Dialogue window (not Response Box) over heads
« Reply #6 on: April 20, 2008, 04:53:32 PM »

I guess the real problem is that I the .Width property of the static control is not changed by SizeToFit().
I'm pretty sure it is. As long as font (and text) is assigned to the static control (as you already found), because the font is used to measure the dimensions.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #7 on: April 20, 2008, 09:04:10 PM »

Ok tried a different approach and now the width and height properties were changed.
I'm now getting the effect I wanted.

Now I just need to keep windows over character's heads.


Thanks for help :) 
« Last Edit: April 20, 2008, 09:20:31 PM by rkitting »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How to change Dialogue window (not Response Box) over heads
« Reply #8 on: April 21, 2008, 03:16:10 PM »

Can you give my some step-by-step instructions for reproducing the crash, please?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

rkitting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 44
    • View Profile
Re: How to change Dialogue window (not Response Box) over heads
« Reply #9 on: April 21, 2008, 04:17:54 PM »

It came from bad scripting  :) A block of code couldn't use a declared variable somewhere else in code. I moved the declaration and made it global.
Logged
 

Page created in 0.047 seconds with 23 queries.