Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Floating Caption Gone  (Read 2149 times)

0 Members and 1 Guest are viewing this topic.

VonDoom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
    • View Profile
Floating Caption Gone
« on: November 08, 2009, 06:31:06 PM »

Hi

I've run into some trouble here, hope you can help me. For some reason the floating caption has disappeared and I can't find why. I've combed the code and it seems the problem may be in the Caption Window, which is... weird because I haven't even touched that window. Any suggestions?

Code: [Select]
#include "scripts\base.inc"

// this script runs in an endless loop and does all the user-interface work
// that needs to be periodically updated
// such as the floating items captions display and positioning
// and the sliding inventory window handling

global WinCaption;
var WinInv = Game.GetInventoryWindow();

// infinite loop
while(true){

  // save the active object for later
  var ActObj = Game.ActiveObject;

  // handle the standard floating caption
  if(Game.Interactive && ActObj!=null)
  {
   if (Game.InventoryVisible == false)
   {
    if (Game.SelectedItem==null)
    {
      WinCaption.X = Game.MouseX;
      WinCaption.Y = Game.MouseY + 20;
      WinCaption.TextAlign = TAL_LEFT;
      WinCaption.Text = ActObj.Caption;
      // keep the caption on screen
      WinCaption.SizeToFit();
      if(WinCaption.X + WinCaption.Width > Game.ScreenWidth) WinCaption.X = Game.ScreenWidth - WinCaption.Width;
      if(WinCaption.Y + WinCaption.Height > Game.ScreenHeight) WinCaption.Y = Game.ScreenHeight - WinCaption.Height;  
}
   }
   else
   {
var prov = WinInv.GetControl("Description");
if (Game.SelectedItem==null)
     {
   prov.Text = ActObj.Caption;
}
else
{
     // handle the caption when you want to use an object with another
      var Item = Game.SelectedItem;
      prov.Text = "Use " + Item.Caption + " with " + ActObj.Caption;
     }
   }
  }
  else WinCaption.Visible = false;


  // go to sleep for 20 miliseconds to allow the engine to perform other tasks
  // it is important for the "endless" scripts to call the Sleep command, otherwise the game will get stuck
  Sleep(20);
}

EDIT:
Nevermind, already solved. As always, something really stupid.
« Last Edit: November 09, 2009, 01:26:05 AM by VonDoom »
Logged
 

Page created in 0.046 seconds with 24 queries.