PDA

View Full Version : Script.Wait


FoxLeader
01-31-2008, 07:43 PM
Hello,

I'm having some problems with a script I'm playing with. Itsn't any way to simulate an Script.Wait or something like this? I don't want the whole application to be frozen during the waiting time. Just my script. I'm trying to find a way to not use OnTimer to do some animations.

Here's my script:
Page OnShow:
wndSize = Window.GetSize(Application.GetWndHandle());
--Custom Variables
--Page Margin:
marginTop = 10;
marginBottom = 10;
marginRight = 10;
marginLeft = 10;

OnClick (any button):
thisSize = Button.GetSize(this)
thisPos = Button.GetPos(this);
Xpos = wndSize.Width - thisSize.Width - marginRight;
Ypos = wndSize.Height - thisSize.Height - marginTop;

while thisPos.X < Xpos do
if thisPos.Y < Ypos then
thisPos = Button.GetPos(this);
Button.SetPos(this, thisPos.X+1, thisPos.Y+1);
end
end

BTW, I have a problem in the last script. If I only add a value to the X axis, that's ok. It stops at the page limits. But if I add a value to the Y, it never stops and I'm forced to use CTRL+Alt+Del. Do you know what is the problem?

Thanks!
FoxLeader
Note: I attached the apz.

FoxLeader
02-02-2008, 02:55 PM
Hello,

I found this page (http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4956) explaining what I want in "plain Lua". Could anybody help me integrate this in AMS?

I had a quick look, this didn't work. And I don't really know how to do this... so any help would be appreciated :)

Regards,
FoxLeader

longedge
02-03-2008, 12:58 PM
Try the following code in the button on click, it works for me -

thisSize = Button.GetSize(this)
thisPos = Button.GetPos(this);
Xpos = wndSize.Width - thisSize.Width - marginRight;
Ypos = wndSize.Height - thisSize.Height - marginTop;

while not stop do
Button.SetPos(this, thisPos.X+1, thisPos.Y+1);
thisPos = Button.GetPos(this);
if (thisPos.Y > (Ypos-(thisSize.Height/2))) or (thisPos.X > Xpos) then
stop=true
end
end

stop = false

FoxLeader
02-03-2008, 04:00 PM
Thanks, this part worked :)

Does anybody has an idea for the second part? (the wait thing).

Regards,
FoxLeader

longedge
02-03-2008, 04:59 PM
Well I've been playing around with swf's that I put on a page as a 1 pixel object that do nothing but send fsCommands at various intervals, each one named differently so I can use them as multiple timers/counters. Don't know if using a flash object would be an option for you?

FoxLeader
02-03-2008, 07:26 PM
Yes, this might be an option in most cases since Flash is common, but I'd rather not have to relay on this. And in this case, it's not a real timer I want... it's just to make the script wait before acting...

The page I pointed should be a good start for a more experienced coder... but I'm not XD

I will post this in the suggestions forum. This might get more visibility and just be helpful for others :)