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: Semi smart dialog window with actor, name, text, fixed or variable display time  (Read 5453 times)

0 Members and 1 Guest are viewing this topic.

grayman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 3
    • View Profile

Ok i decided to slim the project and present it in a single full version of ~8MB
the actor still being huge  ;)

link is working now http://cte.seebc.gob.mx/wme-x.rar

---------------------------------------------------------------------------

Good day, this is my first post and first contribution too : )

I'm trying to do a SmartTalkWindow, something like

 O0 <AFROMAN> Blablabla
choose:
a) B) C)

when the bla bla bla part can be a single line or a multiple (very long) line, so this is what i already have and want to share with everyone...

Wintermute rocks!!!  ::rock

atte
(}{ >
grayman

This is called as:

WinNarrator.DisplayText(xText, "Odiseo", null);

in the scene_init.script

Code: [Select]
#include "scripts\base.inc"

// here comes the stuff which initializes the scene

actor.SkipTo(400, 400);
actor.Direction = DI_DOWN;
actor.Active = true;
var xText="Scene Init dialog...||Lorem ipsum dolor sit amet, consectetuer adipiscing elit.|| Nulla eu eros quis risus venenatis ultricies.|| Curabitur id quam.|| Donec gravida.";
WinNarrator.DisplayText(xText, "Odiseo", null);

global Statescene1;

if(Statescene1.Visited==true)
{
  WinNarrator.DisplayText("You already been here", "Jugador", 3000);
}

if(Statescene1.Visited==false)
{
  Statescene1.Visited = true;
  WinNarrator.DisplayText("First time you come back", "Jugador", 3000);
}

if(Statescene1==null)
{
  Statescene1.Visited = false;
  WinNarrator.DisplayText("First time in scene", "Penelope", 500);
}

and the window is declared in the base.inc as:

Code: [Select]
#include "scripts\const.inc"

global Scene;
global Keyboard;
global actor;
global WinNarrator;

in game.script you add this lines (right after Scene=Game.Scene;):

Code: [Select]
WinNarrator = Game.LoadWindow("scenes\sys\Narrator.window");
WinNarrator.Visible = false;

as you can see i use a weird (but more logical for me) kind of path

all the system windows are in scenes\sys\
and all the images and sprites are in scenes\sys\imgs\

you can see what i'm talking in this code:

scenes\sys\Narrator.window
Code: [Select]
WINDOW
{
  NAME = "Narrator"
  X = 1
  Y = 1
  WIDTH = 800
  HEIGHT = 600
  SCRIPT = "scenes\sys\Narrator.script"
  CLIP_CONTENTS = TRUE
  STATIC
  {
  NAME = "Actor"
  X = 1
  Y = 100
  WIDTH = 180
  HEIGHT = 180
  BACK = "scenes\sys\imgs\actor.image"
  IMAGE = "scenes\sys\imgs\face-left.bmp"
  VISIBLE = TRUE
  }
  WINDOW
  {
    NAME = "TextArea"
    X = 166
    Y = 100
BACK = "scenes\sys\imgs\wintext.image"
WIDTH = 400
    HEIGHT = 160 ; minimal size Text x 80
TRANSPARENT = TRUE
  }
  STATIC
  {
    NAME = "Text"
    TEXT_ALIGN = "left"
;    TEXT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla eu eros quis risus venenatis ultricies. Curabitur id quam. Donec gravida. Quisque neque nisl, rhoncus facilisis, tincidunt aliquet, pellentesque at, purus. Ut venenatis. Cras lacus nisi, tempus nonummy, ullamcorper nec, fringilla suscipit, nisi. Donec venenatis metus quis lacus. Cras scelerisque malesuada nunc. Aliquam laoreet, arcu nec malesuada consectetuer, orci ligula condimentum libero, vel eleifend purus ligula eu nulla. Vestibulum neque enim, tempus at, mollis in, laoreet eu, sem. Integer porttitor venenatis augue. Morbi congue ante sit amet tellus. Integer arcu ante, cursus vel, venenatis at, ullamcorper eu, neque. Donec vitae turpis at magna tempor mollis. In et quam. Duis at nulla sit amet elit tempus tristique. Phasellus malesuada ante a turpis. Pellentesque porta, mi ut commodo lacinia, ligula lorem tempus quam, sed pretium lacus nunc ultricies lacus. Mauris vel magna. In dignissim lorem vel dui."
    FONT = "fonts\bold_white.font"
    X = 186
    Y = 150
; BACK = "scenes\sys\imgs\black.image"
WIDTH = 360
    HEIGHT = 80 ; minimal size
    VISIBLE = TRUE
  }
}

and his script:
scenes\sys\Narrator.script

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

////////////////////////////////////////////////////////////////////////////////

on "LeftClick"
{
self.Close();
}

method DisplayText(Text, Actor, Duration)
{

var ImgActor = this.GetControl("Actor");
var TxtArea = this.GetControl("TextArea");
var Txt = this.GetControl("Text");

switch (Actor)
{
  case "Penelope":
  ImgActor.SetImage("scenes\sys\imgs\penelope-left.bmp");
  break;
  case "Odiseo":
  ImgActor.SetImage("scenes\sys\imgs\odiseo-left.bmp");
  break;
  case "Jugador":
  ImgActor.SetImage("scenes\sys\imgs\jugador-left.bmp");
  break;
  case "Narrador":
  ImgActor.SetImage("scenes\sys\imgs\face-left.bmp");
  break;
  default:
  ImgActor.SetImage("scenes\sys\imgs\face-left.bmp");
  break;
}

Txt.Text = "<<" + Actor + ">>|" + Text;
Txt.HeightToFit();

if (Txt.Height > 80)
  {
  TxtArea.Height = Txt.Height + 80;
  }
  else
  {
  TxtArea.Height = 160;
  }
this.Visible = true;
if (Duration != null)
  {
    if (Duration < 5000)
{
  Duration = 5000;
}
Sleep(Duration);
Txt.Text = "";
self.Close();
  }
  else
  {
  this.GoExclusive();
  }
}

As you can see i use 2 bmp for the actors 2 bmp for the window area and 1 bmp for the actor area (behind the actor)

you can download the file in http://cte.seebc.gob.mx/wme-x.rar try it! the full project is in http://cte.seebc.gob.mx/wme-x.rar (same link as above) but is huge! big graphics for the actor  ;D :D :o they are gona be available this monday...

« Last Edit: July 18, 2007, 12:37:37 AM by grayman »
Logged

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog

I can not get this to run :(

I could not load it.. had to copy the 3 text files from the root of teh data folder from the demo projecy

After that f5 to test insta crashed

:(

Also seasm both the lnks go to the same file.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe
 

Page created in 0.017 seconds with 23 queries.