Jump to content

AdlibEnable


Nahuel
 Share

Recommended Posts

Maybe this is a stupid quick question: Why can't I use AdlibEnable more than once?

Example:

AdlibEnable("func1",1000)
AdlibEnable("func2",2000)

Func func1()
    SplashTextOn("","This is func1",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
EndFunc

Func func2()
    SplashTextOn("","This is func2",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
EndFunc

While 1
    Sleep(10)
WEnd

This will only call func2.

Link to comment
Share on other sites

Hi,

so you have to put the logic in the one func.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Maybe this is a stupid quick question: Why can't I use AdlibEnable more than once?

Example:

AdlibEnable("func1",1000)
AdlibEnable("func2",2000)

Func func1()
    SplashTextOn("","This is func1",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
EndFunc

Func func2()
    SplashTextOn("","This is func2",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
EndFunc

While 1
    Sleep(10)
WEnd

This will only call func2.

Parameters

function The name of the adlib function to call.

time [optional] how often in milliseconds to call the function. Default is 250 ms.

Return Value

None.

AdlibEnable("func1",1000) 


Func func1()
    SplashTextOn("","This is func1",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
    AdlibEnable("func2",2000)
EndFunc

Func func2()
    SplashTextOn("","This is func2",200,25,-1,-1,1)
    Sleep(500)
    SplashOff()
    AdlibEnable("func1",1000)
EndFunc

While 1
    Sleep(10)
WEnd
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

No need to modify the AdLibEnable() when it's called, just put the logic in the function to know what to do. This technique would allow an unlimited number of different timers:

HotKeySet("{ESC}", "_Quit")

AdlibEnable("_FuncX")

Global $Timer_1 = TimerInit(), $Timer_2 = TimerInit()

While 1
    Sleep(10)
WEnd

Func _FuncX()
    If TimerDiff($Timer_1) >= 2000 Then _Func1()
    If TimerDiff($Timer_2) >= 5000 Then _Func2()
EndFunc   ;==>_FuncX

Func _Func1()
    $Timer_1 = TimerInit()
    SplashTextOn("", "This is func1", 200, 25, -1, -1, 1)
    Sleep(500)
    SplashOff()
EndFunc   ;==>_Func1

Func _Func2()
    $Timer_2 = TimerInit()
    SplashTextOn("", "This is func2", 200, 25, -1, -1, 1)
    Sleep(500)
    SplashOff()
EndFunc   ;==>_Func2

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...