Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Pages: 1 [2]  All

Author Topic: "Visual Novel"-like talk window // or: like in "Alpha Polaris"  (Read 13071 times)

0 Members and 1 Guest are viewing this topic.

Ryouko

  • Clumpsy, tea loving artist~
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 23
  • Uhm... nothing to say here! =D
    • View Profile
Re: "Visual Novel"-like talk window // or: like in "Alpha Polaris"
« Reply #15 on: January 31, 2012, 11:27:32 PM »

Quote
would be the best if you post the scripts which are troubling you.
Ah. Yes, yes - of course!
(Just how could I forget that?)
Okay, this is the Talkscript, it's attached to the actor:
Code: WME Script
  1. method Talk(Inhalt,Notiz,Stimmung)
  2. {
  3.  
  4.         // load the window
  5.         var dlgWindow = Game.LoadWindow("interface/talk/norm1.window");
  6.  
  7.         // fill in the required dialog properties
  8.         dlgWindow.Inhalt = "text";
  9.         dlgWindow.Stimmung = "normal"; // the name of the main window
  10.         dlgWindow.Notiz = "note";
  11.  
  12.         // init the window and start the text display
  13.         dlgWindow.ApplyEvent("Reden");
  14.  
  15.         // this is crucial, it will pause this script until the window closes
  16.         dlgWindow.GoExclusive();
  17.  
  18.         // we're done, unload
  19.         Game.DeleteWindow(dlgWindow);
  20. }
And that's the window script:
Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4. // the other script wants us to do the magic
  5. on "Reden"
  6. {
  7.   // notice that you can access the properties passed by the original script using this.SomeProperty notation
  8.  
  9.         var laune;
  10.         if (this.Stimmung == null) laune = "norm1";
  11.         else laune = Stimmung;
  12.        
  13.         var text1 = this.Inhalt;
  14.         var note1 = this.Notiz;
  15.  
  16.         //this.SetImage("ui_elements/talk/"+laune+".png");
  17.         this.SetImage("ui_elements/talk/norm1.png");
  18.  
  19.         var textbox = this.GetControl(Game.ExpandString(text1));
  20.         var notebox = this.GetControl(Game.ExpandString(note1));
  21.                
  22.         notebox.Text = "";
  23.         textbox.Text = "";
  24.         var lettera = new String(text1);
  25.         for (var i = 0; i < lettera.Length; i = i + 1)
  26.         {
  27.                 textbox.Text = textbox.Text + lettera.Substr(i, 1);
  28.                 Sleep(50);
  29.         }
  30.                
  31.         var letterb = new String(note1);
  32.         for (var j = 0; j < letterb.Length; j = j + 1)
  33.         {
  34.                 notebox.Text = notebox.Text + letterb.Substr(j, 1);
  35.                 Sleep(50);
  36.         }
  37. }

Alright, changed it, thank you, metamorphium. :>

- R.
« Last Edit: February 03, 2012, 11:22:45 AM by Ryouko »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: "Visual Novel"-like talk window // or: like in "Alpha Polaris"
« Reply #16 on: January 31, 2012, 11:43:38 PM »

this is strange!

Code: WME Script
  1. var textbox = this.GetControl(Game.ExpandString(text1));
  2. var notebox = this.GetControl(Game.ExpandString(note1));
  3.  

Are you sure your window has such a components?

Just next to it you call:

Code: WME Script
  1. var lettera = new String(text1);
  2.         for (var i = 0; i < lettera.Length; i = i + 1)
  3.         {
  4.                 textbox.Text = textbox.Text + lettera.Substr(i, 1);
  5.                 Sleep(50);
  6.         }
  7.                
  8.         var letterb = new String(note1);
  9.         for (var j = 0; j < letterb.Length; j = j + 1)
  10.         {
  11.                 notebox.Text = notebox.Text + letterb.Substr(j, 1);
  12.                 Sleep(50);
  13.         }
  14.  

Where you treat note1 and text1 as strings?

I bet you need to use GetControl with a proper window component name.

 
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Ryouko

  • Clumpsy, tea loving artist~
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 23
  • Uhm... nothing to say here! =D
    • View Profile
Re: "Visual Novel"-like talk window // or: like in "Alpha Polaris"
« Reply #17 on: February 01, 2012, 12:20:56 AM »

Oh, damn.
I knew I would make such a stupid mistake today. /headdesk
I accidentally changed the GetControl to the ExpandedString instead of the lettera/letterb variable. x_X
Okay, it looks like this now:
Code: WME Script
  1. #include "scripts\base.inc"
  2. #include "scripts\keys.inc"
  3.  
  4. // the other script wants us to do the magic
  5. on "Reden"
  6. {
  7.   // notice that you can access the properties passed by the original script using this.SomeProperty notation
  8.  
  9.         var laune;
  10.         if (this.Stimmung == null) laune = "norm1";
  11.         else laune = Stimmung;
  12.        
  13.         var text1 = this.Inhalt;
  14.         var note1 = this.Notiz;
  15.  
  16.         //this.SetImage("ui_elements/talk/"+laune+".png");
  17.         this.SetImage("ui_elements/talk/norm1.png");
  18.  
  19.         var textbox = this.GetControl("text");
  20.         var notebox = this.GetControl("note");
  21.                
  22.         notebox.Text = "";
  23.         textbox.Text = "";
  24.         var lettera = new String(Game.ExpandString(text1));
  25.         for (var i = 0; i < lettera.Length; i = i + 1)
  26.         {
  27.                 textbox.Text = textbox.Text + lettera.Substr(i, 1);
  28.                 Sleep(50);
  29.         }
  30.                
  31.         var letterb = new String(Game.ExpandString(note1));
  32.         for (var j = 0; j < letterb.Length; j = j + 1)
  33.         {
  34.                 notebox.Text = notebox.Text + letterb.Substr(j, 1);
  35.                 Sleep(50);
  36.         }
  37. }
So, the variables note1 and text1 are supposed to store the information (the text) given to the parameters Notiz and Inhalt in the method.
Current problem is:
Code: [Select]
00:15: Compiling script 'interface\talk\norm1.script'...
00:15:   Error@line 11: Variable 'Stimmung' is referenced but not defined

Thank you for your help, I really overlooked it.

- R.
« Last Edit: February 03, 2012, 11:23:02 AM by Ryouko »
Logged

Ryouko

  • Clumpsy, tea loving artist~
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 23
  • Uhm... nothing to say here! =D
    • View Profile
Re: "Visual Novel"-like talk window // or: like in "Alpha Polaris"
« Reply #18 on: February 01, 2012, 01:19:52 AM »

HURRAY! <3

Solved it. :>

Forgot the "this" in
Code: WME Script
  1. "laune = this.Stimmung"
And, of course, it's gotta be
Code: WME Script
  1. dlgWindow.Inhalt = Inhalt;
and so on.

I believe I'll be fine from here on.

Thank you both very much - I'm a beginner and really slow when it comes to logic and scripting, but thanks to you I managed to get my textbox and I learned a lot from it! =)
You're both amazing, thank you for your patience! <3

- R.
« Last Edit: February 03, 2012, 11:23:18 AM by Ryouko »
Logged
Pages: 1 [2]  All
 

Page created in 0.098 seconds with 20 queries.