cardpicker


SUBMITTED BY: Guest

DATE: Sept. 17, 2012, 4:59 p.m.

FORMAT: Text only

SIZE: 1.9 kB

HITS: 58219

  1. --[[
  2. Script: Pick a Card v1.2
  3. Author: Modified by Keoshin/Taikumi
  4. Credits: This script was largely based on Sumizome's Pick a Card v1.3 mod5, updated by Zynox,
  5. Weee & h0nda, and was modified to use BoL's scripting API.
  6. Thanks to ikita for updating the script to use an alternative method to always pick the first card.
  7. ]]--
  8. if GetMyHero().charName == "TwistedFate" then
  9. -- Config:
  10. local HotkeyRed = 90 --Z
  11. local HotkeyYellow = 88 --X
  12. local HotkeyBlue = 67 --C
  13. -- Globals:
  14. local cards = {}
  15. cards[HotkeyYellow] = "Card_Yellow"
  16. cards[HotkeyBlue] = "Card_Blue"
  17. cards[HotkeyRed] = "Card_Red"
  18. local selected = HotkeyYellow
  19. local lastUse = 0
  20. local spellUsed = nil
  21. local player = GetMyHero()
  22. local function msgHandler(msg, key)
  23. if
  24. msg ~= KEY_UP or
  25. player:CanUseSpell(_W) ~= READY or
  26. GetTickCount() - lastUse <= 2500 or
  27. player.dead or
  28. cards[key] == nil or
  29. spellUsed ~= nil
  30. then
  31. return
  32. end
  33. lastUse = GetTickCount()
  34. selected = key
  35. spellUsed = true
  36. CastSpell(_W)
  37. end
  38. local function tickHandler() -- modified to be able to pick the first card
  39. if not spellUsed or player:CanUseSpell(_W) ~= READY then return end
  40. for k = 1, objManager.maxObjects do
  41. local object = objManager:GetObject(k)
  42. if object ~= nil and player:GetDistance(object) < 80 and object.name:find(cards[selected]) then
  43. CastSpell(_W) -- If we detect the card, cast W again to capture it
  44. spellUsed = nil
  45. break
  46. end
  47. end
  48. end
  49. BoL:addTickHandler(tickHandler, 50)
  50. BoL:addMsgHandler(msgHandler)
  51. end

comments powered by Disqus