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: Language String doesnt work?  (Read 2918 times)

0 Members and 1 Guest are viewing this topic.

Darky

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 109
    • View Profile
    • Spreadcamp
Language String doesnt work?
« on: October 24, 2009, 06:15:19 PM »

I wanted to do multiple messages on the quit window for when the user quits the game. I therefore named the message field in quit.window "quitmsg"
Then in quit.script I wrote:

Code: WME Script
  1. // set a random quit text every time
  2. var QuitMsg = new Array();
  3. QuitMsg[0] = "/QUIT0001/Testtext 1";
  4. QuitMsg[1] = "/QUIT0002/Testtext 2";
  5. QuitMsg[2] = "/QUIT0003/Testtext 3";
  6. QuitMsg[3] = "/QUIT0004/Testtext 4";
  7. QuitMsg[4] = "/QUIT0005/Testtext 5";
  8.  
  9. // get control over the quit text to insert the random new one
  10. var QuitText = this.GetControl("quitmsg");
  11. QuitText.Text = QuitMsg[ Random(0, 4) ];
  12.  

The corresponding messages are also in string.tab

It indeed displays the texts in the window now but only the texts I defined in the array, for example: /QUIT0005/Testtext 5
So it displays just what I have in the array. I even changed the texts from the string table and it just ignores it.

What goes wrong?
« Last Edit: October 24, 2009, 06:19:15 PM by Darky »
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: Language String doesnt work?
« Reply #1 on: October 25, 2009, 12:40:03 PM »

Normally you can assign translated string this way:
Code: WME Script
  1. QuitMsg[0] = Game.ExpandString("/QUIT0001/Testtext 1");
  2. // etc...
  3.  

or even better in your case (centralized translation)

Code: WME Script
  1. QuitText.Text = Game.ExpandString(QuitMsg[ Random(0, 4) ]);
  2.  
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Darky

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 109
    • View Profile
    • Spreadcamp
Re: Language String doesnt work?
« Reply #2 on: October 25, 2009, 12:53:53 PM »

Perfect, that works fine! Thank you so much!

Another thing learned ;D
Logged
 

Page created in 0.029 seconds with 25 queries.