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: actor text assignment  (Read 3946 times)

0 Members and 1 Guest are viewing this topic.

rollo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
actor text assignment
« on: March 24, 2013, 05:06:02 PM »

IHello.  am not using an actor but just point & click. With an actor if I click on an object, the respose is in white near the actor. I am using Game.Msg(speak); to respond , but it is printing the message in green and under the inventory bar, which I assume is the correct place. Is there a way to have the message printed in a different font perhaps in some kind window or certainly near the object I am looking at. Thanks
Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: actor text assignment
« Reply #1 on: March 24, 2013, 06:34:26 PM »

To change font of Game.Msg() function choose any font in Project Manager in System Font field of the Game Settings grid.

You can also use Game.LOG() function to print smth to the debug log and log file.

Or you can write your own message functionality, for example, based on Window object and Static control subobject.
Here is the example of very simple realization of it.
Create window named "Message" with Width=1024, Height=50. X and Y = that coordinates of the screen as you need to display the message.
In this window create static control named "Text" with such width/height parameters as the window. X and Y = 0. Choose any font you liked.
Attach to this window such script:

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. method Print (var m)
  4. {
  5.   var text = this.GetControl("Text");
  6.   text.Text = Game.ExpandString(m);
  7.   text.Visible = true;
  8.   Sleep(5000); // Time to display the message
  9.   text.Visible = false; // Hiding the message
  10. }

place this code somewhere  in game.script file:

Code: WME Script
  1. global Message = Game.LoadWindow(PathToWindow); // A path to created "Message" window

Anywhere when you need to use message logging use this code:

Code: WME Script
  1. global Message;
  2. Message.Print(Something);

This functionality shows only one string at one time and may be issues when you try to display next string if current string is still displayed. To fix this issues needs to make some improvements, and you can make them on your own.
Logged

rollo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
Re: actor text assignment
« Reply #2 on: March 24, 2013, 07:13:19 PM »

Thank you for your help. Will start experimenting with windows. Thanks
Logged

rollo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
Re: actor text assignment
« Reply #3 on: March 24, 2013, 07:38:27 PM »

Just one thing. When i run game, the windows appears in intro scene. Is there a way to only have it appear in a certain scene or do Is there a way to make the window transparent? When I make a new window, it makes a question window. I have created the window in interface\system. Is that correct? Thanks
Logged

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: actor text assignment
« Reply #4 on: March 24, 2013, 10:28:33 PM »

Yes, you're right. To make the window "transparent" simply delete all the default controls (buttons etc) and remove all the default images and tiled images from the window settings.
Or you can change window script to display/hide the whole window with all controls:

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. this.Visible = false;
  4.  
  5. method Print (var m)
  6. {
  7.   var text = this.GetControl("Text");
  8.   text.Text = Game.ExpandString(m);
  9.   this.Visible = true;
  10.   Sleep(5000); // Time to display the window
  11.   this.Visible = false; // Hiding the window
  12. }

And you can place window in interface\system, why not?

Just one thing. When i run game, the windows appears in intro scene. Is there a way to only have it appear in a certain scene or do Is there a way to make the window transparent? When I make a new window, it makes a question window. I have created the window in interface\system. Is that correct? Thanks
Logged

rollo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
Re: actor text assignment
« Reply #5 on: March 25, 2013, 03:27:20 PM »

That did the trick. Thanks very much 2.0
Logged
 

Page created in 0.105 seconds with 21 queries.