Please login or register.

Login with username, password and session length
Advanced search  

News:

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

Author Topic: Letter by letter writing  (Read 3864 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Letter by letter writing
« on: January 29, 2012, 09:19:47 PM »

For J.U.L.I.A. I wrote a little method, which after you supply string and time does the following:

1. it writes letter by letter the specified and localized string
2. it waits for a specified time and then the text disappear

So how does it work?

1. create a script and call it system_writer.script

Code: WME Script
  1. #include "scripts/base.inc"
  2.  
  3. method Initialize()
  4. {
  5.         var win = Game.CreateWindow();
  6.         this.win = win;
  7.         win.Visible = false;
  8.         win.X = 0;
  9.         win.Width = 1024;
  10.         win.Y = 374;
  11.         win.Height = 20;
  12.         var edit = win.CreateStatic();
  13.         edit.Height = 20;
  14.         edit.Width = 1024;
  15.         edit.X = 0;
  16.         edit.Y = 0;
  17.         edit.SetFont("fonts\tahoma.font");
  18.         edit.TextAlign = TAL_LEFT;
  19.         this.edit = edit;
  20. }
  21.  
  22. method Write(textToWrite, time)
  23. {
  24.          var win = this.win;
  25.          var ed = this.edit;
  26.          win.Y = 374;
  27.                 
  28.          ed.Text = Game.ExpandString(textToWrite);
  29.         ed.SizeToFit();
  30.    
  31.        ed.X = 512 - ed.Width / 2;
  32.    
  33.      
  34.         
  35.          ed.Text = "";
  36.          win.Visible = true;
  37.          var str = new String(Game.ExpandString(textToWrite));
  38.  
  39.  
  40.          for (var a = 0; a<str.Length; a=a+1)
  41.          {
  42.                        ed.Text = str.Substr(0,a+1);
  43.                         ed.SizeToFit();
  44.                        
  45.                        Sleep(100);
  46.          }            
  47.          Sleep(time);
  48.         
  49.          ed.Text = "";
  50.          win.Visible = false;
  51.         
  52. }
  53.  

2. in scripts/base.inc add

global writer;

3. in scripts/game.script add the following:

Code: WME Script
  1. writer = new Object("scripts\system_writer.script");
  2. writer.Initialize();
  3.  

4. now whenever you want to use it, try:

Code: WME Script
  1. writer.Write("Testing letter by letter writer.", 1500);
  2.  


Hope this helps. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

piere

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 299
  • Sorry for any bad english in my posts. Game on !
    • View Profile
Re: Letter by letter writing
« Reply #1 on: January 30, 2012, 12:18:48 AM »

Thanks for the code ! would be cool if you posted different fun code samples too. I hope to see more stuff from J.U.L.I.A. soon !
Logged

shuin

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • View Profile
Re: Letter by letter writing
« Reply #2 on: January 30, 2012, 09:42:43 PM »

Very useful. Thank you!
Logged
Untitled project status: production

Chaos

  • supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 35
  • "WME rocks!"
    • View Profile
Re: Letter by letter writing
« Reply #3 on: February 15, 2012, 11:36:44 AM »

Thank you a lot, Meta!  :) This is very useful indeed...I'm sure I'll be using such a cool feature very soon.
« Last Edit: February 15, 2012, 11:41:07 AM by Chaos »
Logged

keybone

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 112
    • View Profile
    • Lucine
Re: Letter by letter writing
« Reply #4 on: February 24, 2012, 07:31:51 PM »

tk for share your script:)
Logged
Lucine Company http://www.lucine.it/
Tales of Lucine: The Realm of Hobdark http://www.lucine.it/TalesOfLucine

binary1

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 51
    • View Profile
Re: Letter by letter writing
« Reply #5 on: September 22, 2013, 12:40:12 AM »

Very cool and useful!  Works like a charm!  Thanks.
Logged
 

Page created in 0.581 seconds with 17 queries.