Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lua Script adding cool down timer

Featured Replies

So I haven't found a way to add a cool down timer to a lua script, certain conditions work but it seems to ignore the cooldown time left condition and continues to spam the lua script ability. Below is the lua script for casting growl, how would I go about implementing a 8 second cooldown before it tries to run the script again?

for i=1,50 do
    local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_PET)
    if spellName and spellName == "Growl" then
        CastSpell(i, BOOKTYPE_PET);
    end
end

You can check for your pet's spell cooldown like so:

local start, duration, enable = GetSpellCooldown(PET_SPELL_INDEX, 'pet') 
return (duration - (GetTime() - start)) * 1000

This returns the spell cooldown in milliseconds. The spell is ready when it returns a value lower than 0. You'll need to replace PET_SPELL_INDEX with i in your case.

  • Author
2 hours ago, Zer0 said:

You can check for your pet's spell cooldown like so:

local start, duration, enable = GetSpellCooldown(PET_SPELL_INDEX, 'pet') 
return (duration - (GetTime() - start)) * 1000

This returns the spell cooldown in milliseconds. The spell is ready when it returns a value lower than 0. You'll need to replace PET_SPELL_INDEX with i in your case.

How should I implement this? I tried as Lua condition made the adjustments but crash due to to many characters.

  • Author

I've got all this working and even added some more C sharp and Lua scripts to my fightclass but struggling with certain conditions like.

Hostile Unit Near, I am trying to setup disengage to activate when units are within a smaller range of 8. But this condition also seems to trigger from my pet which is always next to the target so it's always just spamming it when it's off cooldown.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.