Sign in to follow this  
Followers 0
BlueScreen

Adlib issues

11 posts in this topic

#1 ·  Posted (edited)

Hi Guys,

I think I am missing something here.

Adlibenable ("x",5000)
For $i=1 to 1000
    ToolTip($i, 0, 0)
    sleep (200)
Next
Adlibdisable ()

Func x ()
Sleep (10000)
EndFunc
If I understand right, the x function will be executed every 5 secs, and in the mean while the main script paused.

So why when the 10 seconds (in the x func) are over the tooltip doesn't continue? :ph34r:

10x in advance, guys...

Edited by BlueScreen

Share this post


Link to post
Share on other sites



Remarks

Every 250 ms (or time ms) the specified "function" is called--typically to check for unforeseen errors. For example, you could use adlib in a script which causes an error window to pop up unpredictably.

The adlib function should be kept simple as it is executed often and during this time the main script is paused. Also, the time parameter should be used carefully to avoid CPU load.

Share this post


Link to post
Share on other sites

ezzetabi,

I have read the Help.

I still cannot understand why the tooltip doesn't continue counting. :ph34r:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The fact is that you stop the script for 10 sec every 5 sec. So the effect is that every 10 second more or less the loop is executed only once.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

OK. my mistake. :ph34r:

But if I fix it and do this:

Adlibenable ("x",15000)
For $i=1 to 1000
    ToolTip($i, 0, 0)
    sleep (200)
Next

Adlibdisable ()

func x ()
Sleep (5000)
EndFunc

The script starts and tooltip start counting. after 15 secs, there is a sleep of 5 secs. Once this sleep is over, I expected that the tooltip will count for another 15 seconds, but it counts only ~10 secs. Why? Is it because once the function is started 'Adlib' timer starts also?

Edited by BlueScreen

Share this post


Link to post
Share on other sites

Yea, basically. Every 15 seconds the adlib is processed, and causes it to pause for 5. That eats away into 5 seconds of the 15 until the next 5 second pause, so you only have 10 seconds left for the rest of the script before the adlib is executed agian.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Got it, finally... :ph34r:

Thanks everybody.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I agree, the behaviour is weird, BlueScreen :ph34r:

I modified your scriptlet slightly, which reveals interesting results:

Adlibenable ("x",5000)
    For $i=1 to 1000
    ToolTip("Loop:" & $i, 400, 300)
    sleep (200)
    Next
    Adlibdisable ()

Func x ()
    ToolTip("AdlibStart", 400, 300)
    Sleep (10000) ;change this value for interesting results
    ToolTip("AdlibEnd", 400, 300)
    Sleep(1000);this shows that the func is looping
EndFunc

.. See what they have to say on the Bug Reports forum .. ?

Edit: ... Since the helpfile does say that the rest of the script pauses. Which leads me to expect the timer to continue only after the adlib function terminates. But then, perhaps it's just a matter of interpretation of what actually pauses, and if this includes the timer or not? My head hurts - where's that weekend :(

Edited by trids

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

The script "pauses" in the sense that lines from the main script are not executed while lines from the adlib section are. The timers always update because...you can't stop time :ph34r: (The TimerInit() function simply returns the current PC time and TimerDiff works out the difference, pausing the script doesn't affect the PC time IYSWIM)

Edited by Jon

Share this post


Link to post
Share on other sites

OK ... thanks for making sense of it, Jon :(

Might be worth mentioning this in the AdlibEnable topic of the CHM? :ph34r:

Share this post


Link to post
Share on other sites

10x, Jon and trids. :ph34r:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0