Jump to content

How does AdlibRegister exactly work?


 Share

Recommended Posts

Hey everyone,

I've been messing around with some new things and adlibs look extremely useful/interesting, however, I can't seem to get it to work.. Here's what I have

HotKeySet("{F1}", "_Exit")

$qCount = 1
Global $_Timer
AdlibRegister($_Timer, 1000)
AdlibUnRegister($_Timer)

While 1
  SoundPlay(@WindowsDir & "\media\tada.wav", 1)
  $qCount += 1
  ToolTip('"Tada" has been played ' & $qCount & " times",200,200)
WEnd

Func _Timer()
   Local Static $iCount += 1
   ConsoleWrite($iCount)
   If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount)
EndFunc

Func _Exit()
   Exit
EndFunc

Basically I want it to call the _Timer function but it doesn't seem to work :/ any ideas?

Link to comment
Share on other sites

49 minutes ago, Danp2 said:

Move this line to after the While loop or within your _Exit function --

AdlibUnRegister($_Timer)

Hey Danp2,

Thanks for the reply. I've modified the code to...

HotKeySet("{F1}", "_Exit")

$qCount = 1
Global $_Timer
AdlibRegister($_Timer, 1000)

While 1
   SoundPlay(@WindowsDir & "\media\tada.wav", 1)
   $qCount += 1
   ToolTip('"Tada" has been played ' & $qCount & " times",200,200)
WEnd



Func _Timer()
   Local Static $iCount += 1
   ConsoleWrite($iCount)
   If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount)
EndFunc

Func _Exit()
   ToolTip("")
   AdlibUnRegister($_Timer)
   Sleep(2000)
   Exit
EndFunc

I'm not sure if this is what you meant but this still does not work.

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

×
×
  • Create New...