46
Technical forum / strange behaviour if the Sleep function
« on: February 10, 2009, 12:15:15 PM »
hi, i discovered yesterday a strange behaviour of my sleep function.
Till yesterday, this code worked correctly:
But since yesterday my sleep function doesn't work correct anymore. As you maybe see, this script changes the position of the window every 2 milliseconds 128 times. strangely this worked till yesterday but now it looks like i can enter any low sleep values but it always takes arround 2-3 seconds for this loop to complete. using larger values are working fine, for example 1000ms but it looks like it doesnt matter if i say Sleep(2) or Sleep(15).....
[EDIT:] Strangly enough, after i posted it, i tryed it a second time and now it works again. But then i closed the Wintermute Project Manager, and now the problem returned
Till yesterday, this code worked correctly:
Code: [Select]
method ShowPort(PortraitName, Place, Slide)
{
if (loc_Portrait!=null)
{
Game.UnloadObject(loc_Portrait);
}
if ((Place != 1) && (Place != 2) && (Place != 3))
{
Place = 2;
}
loc_Portrait = Game.LoadWindow("windows\Portrait.window");
loc_Picture = loc_Portrait.GetControl("Picture");
loc_Picture.Text = "IM ACTIVE!";
loc_Picture.SetImage(PortraitName);
NO_CONTROL = true;
if (Slide == true)
{
if (Place == 1)
{
for (var j=0; j<128; j=j+1)
{
loc_Portrait.SkipTo(-256+(4*j), 768);
Sleep(2);
}
}
if (Place == 2)
{
loc_Portrait.SkipTo(512, 768);
}
if (Place == 3)
{
for (var i=0; i<128; i=i+1)
{
loc_Portrait.SkipTo(1290-(4*i), 768);
Sleep(2);
}
}
}
NO_CONTROL = false;
}
But since yesterday my sleep function doesn't work correct anymore. As you maybe see, this script changes the position of the window every 2 milliseconds 128 times. strangely this worked till yesterday but now it looks like i can enter any low sleep values but it always takes arround 2-3 seconds for this loop to complete. using larger values are working fine, for example 1000ms but it looks like it doesnt matter if i say Sleep(2) or Sleep(15).....
[EDIT:] Strangly enough, after i posted it, i tryed it a second time and now it works again. But then i closed the Wintermute Project Manager, and now the problem returned