Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Change description text location  (Read 598 times)

0 Members and 1 Guest are viewing this topic.

Chaos

  • supporter
  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 39
  • "WME rocks!"
    • View Profile
Change description text location
« on: November 21, 2017, 12:17:49 PM »

Hiya!  :) I need to change the text that appears everytime you use an item on another. (That little piece of text that says "Use xxxx on xxx" ... I was wondering if there's a way to change the Y cordinate and make this text appear much lower on the screen.  ???
Logged

NAItReIN

  • Occasional poster
  • **
  • Karma: 1
  • Offline Offline
  • Posts: 57
    • View Profile
Re: Change description text location
« Reply #1 on: November 21, 2017, 01:11:58 PM »

Hello  :)

Quote
I was wondering if there's a way to change the Y cordinate and make this text appear much lower on the screen

Of course, there is a way how to manipulate with text possition when you want to use one item with another. Please, open game_loop.script.

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. global WinCaption;
  4. global WinMenu;
  5.  
  6. // infinite loop
  7. while(true){
  8.  
  9.   // save the active object for later
  10.   var ActObj = Game.ActiveObject;
  11.  
  12.   // handle the standard foating caption
  13.   if(Game.Interactive && ActObj!=null)
  14.   {
  15.     if (Game.SelectedItem==null)
  16.     {
  17.       WinCaption.X = Game.MouseX;
  18.       WinCaption.Y = Game.MouseY + 20;
  19.       WinCaption.TextAlign = TAL_LEFT;
  20.       WinCaption.Text = ActObj.Caption;
  21.  
  22.       // keep the caption on screen
  23.       WinCaption.SizeToFit();
  24.       if(WinCaption.X + WinCaption.Width > Game.ScreenWidth) WinCaption.X = Game.ScreenWidth - WinCaption.Width;
  25.       if(WinCaption.Y + WinCaption.Height > Game.ScreenHeight) WinCaption.Y = Game.ScreenHeight - WinCaption.Height;
  26.     }
  27.     // handle the caption when you want to use an object with another
  28.     // this is what you need so you can try changing X or Y coordinates by  yourself
  29.     else {
  30.       var Item = Game.SelectedItem;
  31.  
  32.       WinCaption.X = 0;
  33.       WinCaption.Y = 580;
  34.       WinCaption.Width = Game.ScreenWidth;
  35.       WinCaption.TextAlign = TAL_CENTER;
  36.       WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
  37.     }
  38.     WinCaption.Visible = true;
  39.     WinCaption.Focus();
  40.   }
  41.   else WinCaption.Visible = false;
  42.  
  43.   // go to sleep for 20 miliseconds to allow the engine to perform other tasks
  44.   Sleep(20);
  45. }
  46.  

Let´s have a closer look on this piece of code:
Code: WME Script
  1. // handle the caption when you want to use an object with another
  2.     // this is what you need so you can try changing X or Y coordinates by  yourself
  3.     else {
  4.       var Item = Game.SelectedItem;
  5.  
  6.       WinCaption.X = 0;
  7.       // change this value
  8.       WinCaption.Y = 580;
  9.       WinCaption.Width = Game.ScreenWidth;
  10.       WinCaption.TextAlign = TAL_CENTER;
  11.       WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
  12.     }
  13.     WinCaption.Visible = true;
  14.     WinCaption.Focus();
  15.   }
« Last Edit: November 21, 2017, 01:14:21 PM by NAItReIN »
Logged

Chaos

  • supporter
  • Lurker
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 39
  • "WME rocks!"
    • View Profile
Re: Change description text location
« Reply #2 on: November 21, 2017, 03:15:17 PM »

Thanks a lot!... It finally works!!!   :D I think I finally found exactly that ít is actually located on the game_loop.script.
Code: [Select]
// handle the caption when you want to use an object with another
    else {
      var Item = Game.SelectedItem;

      WinCaption.X = 0;
      WinCaption.Y = 820;
      WinCaption.Width = Game.ScreenWidth;
      WinCaption.TextAlign = TAL_CENTER;
      WinCaption.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
    }
    WinCaption.Visible
(I´ve just changed the value of WinCaption.Y = to exactly what I needed)  The thing is I´ve been looking after it for many months (checking many scripts like game or game-loop but sadly I couldn´t found it until now. ) Thanks again.
Logged
 

Page created in 0.235 seconds with 17 queries.