Sign in to follow this  
Followers 0
Onoitsu2

Adlib And Making A Second One

1 post in this topic

#1 ·  Posted (edited)

Ok here is something I have been pondering, using an Adlib, and having another item function as an Adlib, but having a different delay...

This SHOULD help in this kind of situation.

AdlibEnable("adlib1",50)

global $adlib2_timer = TimerInit(), $adlib2_delay = 500;time in miliseconds

Func adlib2()
;===============Put Adlib2 Code In This Function===============
EndFunc

Func adlib2_check()
;===============Leave this function unchanged===============
    If TimerDiff($adlib2_timer) > ($adlib2_delay - 1) Then
        adlib2()
    $adlib2_timer = TimerInit()
    EndIf
EndFunc

Func adlib1()
    adlib2_check()
;===============Put Main Adlib Code Here===============
EndFunc

now just add a call to your adlib2_check() function at the start of your main adlib function.

THIS ONLY WORKS IF YOUR MAIN ADLIB DELAY IS TO BE LESS THAN THE 2ND ADLIB DELAY!!

And obviously the Adlib2 delay must be evenly divisible by the Adlib1 delay if you want it to call on time.

Using this method you can potentially have unlimited Adlib's, and probably more useful to have the main Adlib be on a delay of 1 ms and then have no code inside it except for the calls to the usermade adlib functions as then you can specify any number for delay and potentially get it to always be within a 0 - 5ms delay after the time you wanted, of course this is dependent on the Adlib's that are called prior to the latter ones in the list.

Laterzzz,

Onoitsu2

Edited by Onoitsu2

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

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