[EasyUO] Focus' Ability Spammer

If you make a Client-side script you can publish it here for other players to use
Locked
Focus
Novice Scribe
Posts: 5
Joined: Sat Aug 28, 2010 6:06 pm

[EasyUO] Focus' Ability Spammer

Post by Focus »

This script will re-cast four abilities
* Primary Weapon
* Secondary Weapon
* Evasion
* Lightning Strike
when it is necessary. Has a menu and hot keys to switch re-casting on/off.

Please inform me if you find any bugs.

Code: Select all

;; ---------------- Focus' Ability Spammer ---------------- ;;
;; Recasts primary/secondary weapon ability, evasion and    ;;
;; lightning when they have ran out.                        ;;
;; -------------------------------------------------------- ;;

;; -------------------- User Settings --------------------- ;;
;; Hotkey modifier is used when pressing the hotkeys.
;; Options are Shift, Alt, Ctrl
;; You can also leave empty
set %hotkeyModifier Shift

;; The hotkey buttons, modifier + these buttons will
;; switch the spamming on/off.
set %primaryHotkey a
set %secondaryHotkey s
set %evasionHotkey d
set %lightningHotkey f

;; -------------------------------------------------------- ;;


;; --------- Main Code (Do not edit below here) ----------- ;;
set %primary #false
set %secondary #false
set %evasion #false
set %lightning #false


set %time 0

if *FASave = 1
{
    display YesNo Do you wish to use your last settings?
    if #dispres = No
        gosub setSettings
}
else
    gosub setSettings

gosub setWatch
set #menuButton Blah
gosub mainMenu
menu show

set %minDmg #minDmg
set %maxDmg #maxDmg

mainLoop:
; If the weapon has changed.
; The 15 is there so we don't do this everytime we bless, curse etc.
if ( Abs ( %minDmg - #minDmg ) > 15 ) || ( Abs ( %maxDmg <> #maxDmg ) > 15 )
{
    gosub setWatch
    set %minDmg #minDmg
    set %maxDmg #maxDmg
}
gosub hotkeys
if #menuButton = closed
    halt
if #menuButton = primary
{
    if ! %primary
    {
        set %secondary #false
        set %lightning #false
    }
    set %primary ! %primary
}
if #menuButton = secondary
{
    if ! %secondary
    {
        set %primary #false
        set %lightning #false
    }
    set %secondary ! %secondary
}
if #menuButton = evasion
    set %evasion ! %evasion
if #menuButton = lightning
{
    if ! %lightning
    {
        set %secondary #false
        set %primary #false
    }
    set %lightning ! %lightning
}
if #menuButton <> Blah
    gosub mainMenu

set #menuButton Blah
gosub hotkeys
if %primary
{
    cmpPix 1 t
    {
        event macro 35 0
        wait 2
    }
}
gosub hotkeys
if %secondary
{
    cmpPix 2 t
    {
        event macro 36 0
        wait 2
    }
}
gosub hotkeys
if %evasion
{
    if #sysTime - %time > 7600
    {
        event macro 15 147
        set %time #sysTime
    }
    ; If an other spell blocked our casting
    if #sysTime - %time > 1200
    {
       cmpPix 3 t
       {
           event macro 15 147
           wait 1s
       }
    }
}
gosub hotkeys
if %lightning
{
    cmpPix 4 t
    {
        event macro 15 149
        wait 2
    }
}

goto mainLoop




sub setSettings
    set #menuButton Blah
    primaryMenu:
    gosub setupMenu #false #false
    menu show
    event macro 8 1
    wait 5
    
    primaryLoop:
    if #menuButton = closed
        halt
    if #contName <> abilityicon_gump
        goto primaryLoop

    set *FAprimaryX #contPosX
    set *FAprimaryY #contPosY
    
    set #menuButton Blah
    
    secondaryMenu:
    gosub setupMenu #false #false
    menu set ability secondary ability
    menu show
    event macro 8 1
    wait 5

    secondaryLoop:
    if #menuButton = closed
        halt
    if #contName <> abilityicon_gump
        goto secondaryLoop

    set *FAsecondaryX #contPosX
    set *FAsecondaryY #contPosY
    
    set #menuButton Blah

    evasionMenu:
    gosub setupMenu #false #false
    menu set ability evasion spell
    menu show
    event macro 8 1
    wait 5

    evasionLoop:
    if #menuButton = closed
        halt
    if #contName <> spellicon_gump
        goto evasionLoop

    set *FAevasionX #contPosX
    set *FAevasionY #contPosY
    
    set #menuButton Blah

    lightningMenu:
    gosub setupMenu #false #false
    menu set ability lightning strike
    menu show
    event macro 8 1
    wait 5

    lightningLoop:
    if #menuButton = closed
        halt
    if #contName <> spellicon_gump
        goto lightningLoop

    set *FAlightningX #contPosX
    set *FAlightningY #contPosY
    
    set #menuButton Blah
    
    set *FASave 1
return

sub setWatch
    savePix *FAprimaryX *FAprimaryY 1
    savePix *FAsecondaryX  *FAsecondaryY 2
    savePix *FAevasionX *FAevasionY 3
    savePix *FAlightningX *FAlightningY 4
return

sub hotkeys
    if #menuButton = closed
        halt
    onHotKey %primaryHotkey %hotkeyModifier
    {
        set #menuButton primary
    }
    onHotKey %secondaryHotkey %hotkeyModifier
    {
        set #menuButton secondary
    }
    onHotKey %evasionHotkey %hotkeyModifier
    {
        set #menuButton evasion
    }
    onHotKey %lightningHotkey %hotkeyModifier
    {
        set #menuButton lightning
    }
return


sub mainMenu
	menu Clear
	menu window transparent 65
	menu Window Title Focus' Ability
	menu Window Color Teal
	menu Window Size 117 142
	menu Font Transparent #true
	menu Font Align Right
	menu Font Name Times New Roman
	menu Font Size 15
	menu Font Style b
	menu Font Color WindowText
	if %primary
	    menu Font BGColor Red
  else
      menu Font BGColor Teal
	menu Button primary 0 0 117 33 Primary

  if %secondary
	    menu Font BGColor Red
  else
      menu Font BGColor Teal
	menu Button secondary 0 36 117 33 Secondary

  if %evasion
	    menu Font BGColor Red
  else
      menu Font BGColor Teal
  menu Button evasion 0 72 117 33 Evasion

  if %lightning
	    menu Font BGColor Red
  else
      menu Font BGColor Teal
  menu Button Lightning 0 108 117 33 Lightning
return

sub setupMenu
	menu Clear
	menu Window Title Focus' Ability
	menu window transparent 100
	menu Window Color Teal
	menu Window Size 264 123
	menu Font Transparent #true
	menu Font Align Right
	menu Font Name Times New Roman
	menu Font Size 18
	menu Font Style b
	menu Font Color WindowText
	menu Font Transparent #false
	menu Font Align Left
	menu Font BGColor Teal
	menu Text EUOLabel1 44 4 Please click your
	menu Text ability 52 32 primary ability
	menu Text EUOLabel3 108 60 icon.
	menu Font Size 14
	if %2
	    menu Button next 188 92 65 29 Next
  if %1
      menu Button back 12 92 65 29 Back
return



;; -------------------------------------------------------- ;;
User avatar
debeza
Elder Scribe
Posts: 169
Joined: Mon May 31, 2010 8:11 am

Re: [EasyUO] Focus' Ability Spammer

Post by debeza »

Thank you! I love this script. So far, it's working very well.
Focus
Novice Scribe
Posts: 5
Joined: Sat Aug 28, 2010 6:06 pm

Re: [EasyUO] Focus' Ability Spammer

Post by Focus »

debeza wrote:Thank you! I love this script. So far, it's working very well.
Thanks, glad to hear you like it :)
Locked