406
Technical forum / Re: Molly and Sally
« on: October 25, 2008, 09:15:43 PM »
Thank you SpellBreaker---You set me on the right direction--I had copied the last part of the script incorrectly from the book--
this is what the script should be according to the book using bare bones scripting and this now works. Thanks!!!!
#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;
// infinite loop
while(true){
// save the active object for later
var ActObj = Game.ActiveObject;
if(Game.Interactive && ActObj!=null)
{
WinCaption.X = Game.MouseX;
WinCaption.Y = Game.MouseY + 20;
WinCaption.TextAlign = TAL_LEFT;
WinCaption.Text = ActObj.Caption;
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;
WinCaption.Visible = true;
}
else WinCaption.Visible = false;
Sleep(20);
}
My only problem now so far is that both Molly and Sally don't move--only one.
this is what the script should be according to the book using bare bones scripting and this now works. Thanks!!!!
#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;
// infinite loop
while(true){
// save the active object for later
var ActObj = Game.ActiveObject;
if(Game.Interactive && ActObj!=null)
{
WinCaption.X = Game.MouseX;
WinCaption.Y = Game.MouseY + 20;
WinCaption.TextAlign = TAL_LEFT;
WinCaption.Text = ActObj.Caption;
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;
WinCaption.Visible = true;
}
else WinCaption.Visible = false;
Sleep(20);
}
My only problem now so far is that both Molly and Sally don't move--only one.