[EasyUO] Nunja Armer

If you make a Client-side script you can publish it here for other players to use
Locked
Nunja
Grandmaster Scribe
Posts: 79
Joined: Mon Feb 21, 2011 9:27 pm

[EasyUO] Nunja Armer

Post by Nunja »

Hello Excelsiorians,

I've been working on a little helper script that re-arms weapon special abilities and a couple of other skills that I use.
A few people have been asking for something like this so I thought I might share.

It was designed to be as minimalistic as possible.
Currently it uses Primary, Secondary, Counter Attack, Momentum Strike, and Chivalry spells Consecrate Weapon and Divine Fury.
[P] [S] [C] [M] [V]

It works by doing a pixel colour match on the skill icons, so you need to set up the ability icons and then not move them.
If you do move them by a pixel or two, the top mini button on the right will restore the pixel colour.
If you move the icon by more than a few pixels, the bottom mini button will re do the setup procedure (which should start the first time it is run)
Subsequent runs don't require the setup to run.

Chivalry:
when [V] is activated, it casts consecrate weapon every 10 seconds, and also casts Divine Fury when your stamina drops below 50% (50% is configurable at the top of the script)

Known issues:
If one of your skills is active when the script runs it will get the wrong pixel colour for the skill and not work correctly.
(similarly if you do the setup with a skill active)
to fix: wait for skill to be inactive and click top mini button to reinitialise.

if you click the wrong skills during the setup, it wont detect when the skill is active
to fix: click the bottom mini button to re do the setup.

if you don't have high enough mana that 30% is enough to cast the spells, it will try enable it over and over.
to fix: tweak the percent at the top of the script (or get more mana)


Thanks to everyone who answered my questions on [c

Let me know how it goes for you.

edit:
version 1.1 - fixed bug where was using counter attack regardless of whether it was turned on
version 1.2 - fixed bug where turning off Primary arming, then enabling Counter was still turning primary on.
version 1.3 - added Chivalry spells, removed Death Strike (maxed now :) )

Code: Select all

;--------------------------------------------------------------
; Nunja Armer                                                  |
; Re-arms weapon skills whenever they are used.                |
; version 1.3                                                  |
; 12th Sep 2011                                                |
;---------------------------------------------------------------

;http://wiki.easyuo.com/index.php/Event_Macro

set %sleepytime 20 ;
set %min_weap_mana_perc 30 ;script will not activate skill if mana below 30%
set %min_chiv_mana_perc 20 ;script will not activate skill if mana below 30%
set %min_stam_perc 50 ; below this will cast divine fury
set %consecrate_time 10 ; 10sec between conc
;---------------------------------------------------------------
; don't edit past here unless you know what you are doing       |
;---------------------------------------------------------------

set %mode 0
set %use_counter #false
set %use_chiv #false
set %last_conc 0

if *PrimaryIconX = 0
{
  gosub DoSetup
}
gosub DoInit

stateOFF:
set #menubutton null
gosub showMenu

while ( #true )
{
  gosub HandleButtons
  wait %sleepytime
}


stateON:
set #menubutton null
gosub showMenu

while ( #true )
{
  gosub HandleButtons
  if ( %mode <> 0 )
  {
    if ( ( #mana * 100 ) / #maxmana > %min_weap_mana_perc ) ;can change to:  if ( #mana > 22 )
    {
      savePix %iconX %iconY 1
  
      if ( #pixcol = %colour_test )
      {
        ;it is not active... turn it on
        event macro %event_macro_param1 %event_macro_param2
      }
    }
  }
  if ( ( #mana * 100 ) / #maxmana > %min_weap_mana_perc ) && ( H notin #charstatus ) && %use_counter
  {
    savePix *CounterIconX *CounterIconY 1

    if ( #pixcol = %CounterColour )
    {
      ;it is not active... turn it on
      event macro 15 148 ;counter strike
    }
  }
  if ( ( #mana * 100 ) / #maxmana > %min_chiv_mana_perc ) && ( H notin #charstatus ) && %use_chiv
  {
    if ( #time > ( %last_conc + %consecrate_time ) )
    {
      set %last_conc #time
      event macro 15 203
    }
    if ( ( ( #stamina * 100 ) / #maxstam ) < %min_stam_perc ) && ( #time > %last_conc )
    {
      event macro 15 205
    }
  }
  
  wait %sleepytime
}

SetStopped:
set %mode 0
set %use_counter #false
set %use_chiv #false
goto stateOFF
  
SetPrimary:
set %mode 1
set %iconX *PrimaryIconX
set %iconY *PrimaryIconY
set %colour_test %PrimaryColour
set %event_macro_param1 35
set %event_macro_param2 0
goto stateON

SetSecondary:
set %mode 2
set %iconX *SecondaryIconX
set %iconY *SecondaryIconY
set %colour_test %SecondaryColour
set %event_macro_param1 36
set %event_macro_param2 0
goto stateON

SetMomentum:
set %mode 3
set %iconX *MomentumIconX
set %iconY *MomentumIconY
set %colour_test %MomentumColour
set %event_macro_param1 15
set %event_macro_param2 150
goto stateON

SetChiv:
if %use_chiv
{
  set %use_chiv #false
  if %mode = 0
  {
    goto stateOFF
  }
}
else
{
  set %use_chiv #true
}
set %last_conc ( #time - %consecrate_time )
goto stateON

SetCounter:
if %use_counter
{
  set %use_counter #false
  if %mode = 0
  {
    goto stateOFF
  }
}
else
{
  set %use_counter #true
}
goto stateON

;--------------------------------------------------------------
; subs                                                         |
;--------------------------------------------------------------

sub ShowMenu
  menu Clear
  menu Window Size 120 60
  menu window title Nunja Armer
  menu Font Size 11
  menu Show
  gosub SetupMenuForNonActive

  if %mode = 1
  {
    gosub SetupMenuForActive
    menu Button primarybutton 4 4 20 20 P
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button primarybutton 4 4 20 20 P
  }
  
  if %mode = 2
  {
    gosub SetupMenuForActive
    menu Button secondarybutton 28 4 20 20 S
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button secondarybutton 28 4 20 20 S
  }
  if %mode = 3
  {
    gosub SetupMenuForActive
    menu Button momentumbutton 76 4 20 20 M
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button momentumbutton 76 4 20 20 M
  }

  if %use_counter
  {
    gosub SetupMenuForActive
    menu Button counterbutton 52 4 20 20 C
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button counterbutton 52 4 20 20 C
  }
  if %use_chiv
  {
    gosub SetupMenuForActive
    menu Button chivbutton 100 4 20 20 V
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button chivbutton 100 4 20 20 V
  }
  
  if ( %mode > 0 ) || %use_counter || %use_chiv
  {
    menu Button stopbutton 16 28 92 30 [ STOP ]
  }
  
  menu Button initbutton 112 32 10 10
  menu Button setupbutton 112 46 10 10
  
return

sub SetupMenuForActive
  menu Window Color red
  menu Font BGColor red
  menu Font Color $02CFFD
return

sub SetupMenuForNonActive
  menu Window Color black
  menu Font BGColor black
  menu Font Color $02CFFD
return

sub HandleButtons
  if ( #menubutton = stopbutton )
    goto SetStopped
  if ( #menubutton = primarybutton )
    goto SetPrimary
  if ( #menubutton = secondarybutton )
    goto SetSecondary
  if ( #menubutton = counterbutton )
    goto SetCounter
  if ( #menubutton = momentumbutton )
    goto SetMomentum
  if ( #menubutton = chivbutton )
    goto SetChiv
  if ( #menubutton = initbutton )
    gosub DoInit
  if ( #menubutton = setupbutton )
  {
    gosub DoSetup
    gosub DoInit
  }
    
return

sub DoSetup
set #menubutton null

  ;primary
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Primary weapon ability icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> abilityicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *PrimaryIconX %lIconX + 20
  set *PrimaryIconY %lIconY + 20
  
  ;secondary
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Secondary weapon ability icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> abilityicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *SecondaryIconX %lIconX + 20
  set *SecondaryIconY %lIconY + 20
  
  ;counter
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Counter Attack icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> spellicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *CounterIconX %lIconX + 20
  set *CounterIconY %lIconY + 20
  
  ;momentum
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Momentum Strike icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> spellicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *MomentumIconX %lIconX + 20
  set *MomentumIconY %lIconY + 20
  
return

sub DoInit
set #menubutton null

  savepix *PrimaryIconX *PrimaryIconY 1
  set %PrimaryColour #pixcol
  
  savepix *SecondaryIconX *SecondaryIconY 1
  set %SecondaryColour #pixcol
  
  savepix *CounterIconX *CounterIconY 1
  set %CounterColour #pixcol
  
  savepix *MomentumIconX *MomentumIconY 1
  set %MomentumColour #pixcol

return

Nunja
Grandmaster Scribe
Posts: 79
Joined: Mon Feb 21, 2011 9:27 pm

Re: [EasyUO] Nunja Armer

Post by Nunja »

I'm back after a extended stint away from UO...

I was going to spend a bit of time improving this script.

My suggestions:
* Improving interface so it is more obvious to others (maybe having 2 modes, normal and minimal)
* Adding some new abilities, maybe making abilities customisable so it can be used as a skill trainer
* Automatic Primary/Secondary Icon re-initialise when changing weapon types (currently single button press)

Anyone use this and have any more suggestions?
Nunja
Grandmaster Scribe
Posts: 79
Joined: Mon Feb 21, 2011 9:27 pm

Re: [EasyUO] Nunja Armer

Post by Nunja »

New Version!

Changes:

Automatic reloading when changing weapon
* Script now detects when your weapon type changes and resets pixel colours and continues to work

Added ability to use more skills:
* Added Death Strike, Lightning Strike, Focus Strike, Evasion, Confidence

Added ability to turn off skills
* Disabled skills will allow GUI to shrink and take minimal space

Changed Interface
* takes up more space but is clearer what each button does.
* Reload and Setup buttons are now named rather than blank
* flag for Large or Small interface with Full or Short names for buttons
* Abilities with different Exclusiveness are separated

Tweaked default values for Divine Fury
* By default it now casts when stamina drops to 90%

Default values: All skills ON, Large GUI
to change, change #true to #false for the values at the top of the script

NOTE: You should redo the setup when upgrading from previous versions of this script

Enjoy :mrgreen:

oh and nobody look at the code that writes the GUI, I meant to optimise it before release but forgot and now I can't be bothered. It is shameful.

Code: Select all

;--------------------------------------------------------------
; Nunja Armer                                                  |
; Re-arms weapon skills whenever they are used.                |
; version 2.0                                                  |
; 22 Jan 2013                                                |
;---------------------------------------------------------------

;http://wiki.easyuo.com/index.php/Event_Macro

;---------------
;   Edit these values to configure script
;---------------
set %min_weap_mana_perc 30 ;don't activate skill if mana below 30%
set %min_chiv_mana_perc 20 ;don't use Chivalry spells if mana below 20%
set %min_stam_perc 90 ; below this will cast divine fury

set %use_momentum #true
set %use_death #true
set %use_lightning #true
set %use_focus #true
set %use_counter #true
set %use_evasion #true
set %use_confidence #true
set %use_chiv #true

set %small_gui #false

;---------------------------------------------------------------
; don't edit past here unless you know what you are doing       |
;---------------------------------------------------------------

set %consecrate_time 10 ; 10sec between conc
set %sleepytime 20 ;

set %attackmode 0
set %skillmode 0
set %chiv_on #false
set %last_conc 0

set %primaryOnColour 0
set %secondaryOnColour 0


if *PrimaryIconX = 0
{
  gosub DoSetup
}
gosub DoInit

stateOFF:
set #menubutton null
gosub showMenu

while ( #true )
{
  gosub HandleButtons
  wait %sleepytime
}


stateON:
set #menubutton null
gosub showMenu

while ( #true )
{
  gosub HandleButtons
  if ( %attackmode <> 0 )
  {
    if ( ( #mana * 100 ) / #maxmana > %min_weap_mana_perc ) ;can change to:  if ( #mana > 22 )
    {
      savePix %attack_iconX %attack_iconY 1
      
      if ( #pixcol = %attack_colour_test )
      {
        ;it is not active... turn it on
        event macro %attack_event_macro_param1 %attack_event_macro_param2

        if %attackmode = 1
        {
          savePix %attack_iconX %attack_iconY 1
          if ( #pixcol <> %attack_colour_test )
            set %primaryOnColour #pixcol
        }
        if %attackmode = 2
        {
          savePix %attack_iconX %attack_iconY 1
          if ( #pixcol <> %attack_colour_test )
            set %secondaryOnColour #pixcol
        }
      }
      else
      {
        if ( %attackmode = 1 ) && ( #pixcol <> %primaryOnColour )
        {
          savepix *PrimaryIconX *PrimaryIconY 1
          set %PrimaryColour #pixcol
          set %attack_colour_test %PrimaryColour
        }
        if ( %attackmode = 2 ) && ( #pixcol <> %secondaryOnColour )
        {
          savepix *SecondaryIconX *SecondaryIconY 1
          set %SecondaryColour #pixcol
          set %attack_colour_test %SecondaryColour
        }
      }
    }
  }
  if ( %skillmode <> 0 )
  {
    if ( ( #mana * 100 ) / #maxmana > %min_weap_mana_perc ) && ( H notin #charstatus )
    {
      savePix %skill_iconX %skill_iconY 1

      if ( #pixcol = %skill_colour_test )
      {
        ;it is not active... turn it on
        event macro %skill_event_macro_param1 %skill_event_macro_param2
      }
    }
  }
  if ( ( #mana * 100 ) / #maxmana > %min_chiv_mana_perc ) && ( H notin #charstatus ) && %chiv_on
  {
    if ( #time > ( %last_conc + %consecrate_time ) )
    {
      set %last_conc #time
      event macro 15 203
    }
    if ( ( ( #stamina * 100 ) / #maxstam ) < %min_stam_perc ) && ( #time > %last_conc )
    {
      event macro 15 205
    }
  }
  
  wait %sleepytime
}

SetStopped:
set %attackmode 0
set %skillmode 0
set %chiv_on #false
goto stateOFF
  
SetPrimary:
if %attackmode = 1
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 1
  set %attack_iconX *PrimaryIconX
  set %attack_iconY *PrimaryIconY
  set %attack_colour_test %PrimaryColour
  set %attack_event_macro_param1 35
  set %attack_event_macro_param2 0
}
goto stateON

SetSecondary:
if %attackmode = 2
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 2
  set %attack_iconX *SecondaryIconX
  set %attack_iconY *SecondaryIconY
  set %attack_colour_test %SecondaryColour
  set %attack_event_macro_param1 36
  set %attack_event_macro_param2 0
}
goto stateON

SetMomentum:
if %attackmode = 3
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 3
  set %attack_iconX *MomentumIconX
  set %attack_iconY *MomentumIconY
  set %attack_colour_test %MomentumColour
  set %attack_event_macro_param1 15
  set %attack_event_macro_param2 150
}
goto stateON

SetDeath:
if %attackmode = 4
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 4
  set %attack_iconX *DeathIconX
  set %attack_iconY *DeathIconY
  set %attack_colour_test %DeathColour
  set %attack_event_macro_param1 15
  set %attack_event_macro_param2 246
}
goto stateON

SetLightning:
if %attackmode = 5
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 5
  set %attack_iconX *LightningIconX
  set %attack_iconY *LightningIconY
  set %attack_colour_test %LightningColour
  set %attack_event_macro_param1 15
  set %attack_event_macro_param2 149
}
goto stateON

SetFocus:
if %attackmode = 6
{
  set %attackmode 0
  if ( %skillmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %attackmode 6
  set %attack_iconX *FocusIconX
  set %attack_iconY *FocusIconY
  set %attack_colour_test %FocusColour
  set %attack_event_macro_param1 15
  set %attack_event_macro_param2 245
}
goto stateON

SetCounter:
if %skillmode = 1
{
  set %skillmode 0
  if ( %attackmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %skillmode 1
  set %skill_iconX *CounterIconX
  set %skill_iconY *CounterIconY
  set %skill_colour_test %CounterColour
  set %skill_event_macro_param1 15
  set %skill_event_macro_param2 148
}
goto stateON

SetEvasion:
if %skillmode = 2
{
  set %skillmode 0
  if ( %attackmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %skillmode 2
  set %skill_iconX *EvasionIconX
  set %skill_iconY *EvasionIconY
  set %skill_colour_test %EvasionColour
  set %skill_event_macro_param1 15
  set %skill_event_macro_param2 147
}
goto stateON

SetConfidence:
if %skillmode = 3
{
  set %skillmode 0
  if ( %attackmode > 0 ) || %chiv_on
  {
    goto stateON
  }
  goto stateOFF
}
else
{
  set %skillmode 3
  set %skill_iconX *ConfidenceIconX
  set %skill_iconY *ConfidenceIconY
  set %skill_colour_test %ConfidenceColour
  set %skill_event_macro_param1 15
  set %skill_event_macro_param2 146
}
goto stateON

SetChiv:
if %chiv_on
{
  set %chiv_on #false
  if ( %attackmode = 0 ) && ( %skillmode = 0 )
  {
    goto stateOFF
  }
}
else
{
  set %chiv_on #true
}
set %last_conc ( #time - %consecrate_time )
goto stateON



;--------------------------------------------------------------
; subs                                                         |
;--------------------------------------------------------------

sub ShowMenu

  menu Clear
  menu Window Size %windowWidth %windowHeight
  menu window title Nunja Armer
  menu Font Size 11
  menu Show
  gosub SetupMenuForNonActive
  
  set %buttonY 4
  
  ;primary
  if %attackmode = 1
  {
    gosub SetupMenuForActive
    menu Button primarybutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %primary_text
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button primarybutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %primary_text
  }
  set %buttonY ( %buttonY + %buttonHeight + 4 )
  
  ;secondary
  if %attackmode = 2
  {
    gosub SetupMenuForActive
    menu Button secondarybutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %secondary_text
    gosub SetupMenuForNonActive
  }
  else
  {
    menu Button secondarybutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %secondary_text
  }
  set %buttonY ( %buttonY + %buttonHeight + 4 )
  
  if %use_momentum
  {
    if %attackmode = 3
    {
      gosub SetupMenuForActive
      menu Button momentumbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %momentum_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button momentumbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %momentum_text
    }
    set %buttonY ( %buttonY + %buttonHeight + 4 )
  }
  
  if %use_death
  {
    if %attackmode = 4
    {
      gosub SetupMenuForActive
      menu Button deathbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %death_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button deathbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %death_text
    }
    set %buttonY ( %buttonY + %buttonHeight + 4 )
  }

  if %use_lightning
  {
    if %attackmode = 5
    {
      gosub SetupMenuForActive
      menu Button lightningbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %lightning_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button lightningbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %lightning_text
    }
    set %buttonY ( %buttonY + %buttonHeight + 4 )
  }
  
  if %use_focus
  {
    if %attackmode = 6
    {
      gosub SetupMenuForActive
      menu Button focusbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %focus_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button focusbutton %attackbuttonX %buttonY %buttonWidth %buttonHeight %focus_text
    }
    set %buttonY ( %buttonY + %buttonHeight + 4 )
  }

  set %skillbuttonY 4

  if %use_counter
  {
    if %skillmode = 1
    {
      gosub SetupMenuForActive
      menu Button counterbutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %counter_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button counterbutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %counter_text
    }
    set %skillbuttonY ( %skillbuttonY + %buttonHeight + 4 )
  }
  
  if %use_evasion
  {
    if %skillmode = 2
    {
      gosub SetupMenuForActive
      menu Button evasionbutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %evasion_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button evasionbutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %evasion_text
    }
    set %skillbuttonY ( %skillbuttonY + %buttonHeight + 4 )
  }
  
  if %use_confidence
  {
    if %skillmode = 3
    {
      gosub SetupMenuForActive
      menu Button confidencebutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %confidence_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button confidencebutton %skillbuttonX %skillbuttonY %buttonWidth %buttonHeight %confidence_text
    }
    set %skillbuttonY ( %skillbuttonY + %buttonHeight + 4 )
  }
  
  if ( %skillButtonY > %buttonY )
  {
    set %buttonY %skillButtonY
  }
  
  if %use_chiv
  {
    if %chiv_on
    {
      gosub SetupMenuForActive
      menu Button chivbutton %chivbuttonX %buttonY %buttonWidth %buttonHeight %chiv_text
      gosub SetupMenuForNonActive
    }
    else
    {
      menu Button chivbutton %chivbuttonX %buttonY %buttonWidth %buttonHeight %chiv_text
    }
    set %buttonY ( %buttonY + %buttonHeight + 4 )
  }
  
  if ( %attackmode > 0 ) || ( %skillmode > 0 ) || %chiv_on
  {
    menu Button stopbutton %stopButtonX %buttonY 92 30 >> STOP <<
  }
  set %buttonY ( %buttonY + 30 + 4 )
  
  menu Button initbutton %initButtonX %buttonY %buttonSetupWidth %buttonHeight %reload_text
  menu Button setupbutton %setupButtonX %buttonY %buttonSetupWidth %buttonHeight %setup_text
  
return

sub SetupMenuForActive
  menu Window Color red
  menu Font BGColor red
  menu Font Color $02CFFD
return

sub SetupMenuForNonActive
  menu Window Color black
  menu Font BGColor black
  menu Font Color $02CFFD
return

sub HandleButtons
  if ( #menubutton = stopbutton )
    goto SetStopped
  if ( #menubutton = primarybutton )
    goto SetPrimary
  if ( #menubutton = secondarybutton )
    goto SetSecondary
  if ( #menubutton = momentumbutton )
    goto SetMomentum
  if ( #menubutton = deathbutton )
    goto SetDeath
  if ( #menubutton = lightningbutton )
    goto SetLightning
  if ( #menubutton = focusbutton )
    goto SetFocus
  if ( #menubutton = counterbutton )
    goto SetCounter
  if ( #menubutton = evasionbutton )
    goto SetEvasion
  if ( #menubutton = confidencebutton )
    goto SetConfidence
  if ( #menubutton = chivbutton )
    goto SetChiv
  if ( #menubutton = initbutton )
    gosub DoInit
  if ( #menubutton = setupbutton )
  {
    gosub DoSetup
    gosub DoInit
  }
    
return

sub DoSetup
set #menubutton null

  ;primary
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Primary weapon ability icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> abilityicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *PrimaryIconX %lIconX + 20
  set *PrimaryIconY %lIconY + 20
  
  ;secondary
  wait 10
  event macro 8 1
  while #CONTNAME <> paperdoll_gump
  {
    sleep 10
  }
  DISPLAY OK Please left click your Secondary weapon ability icon. It must be inactive. $
  set %posing #true
  while %posing
  {
    while #contname <> abilityicon_gump
    {
      sleep 10
    }
    set %lIconX #CONTPOSX
    set %lIconY #CONTPOSY
    wait 10
    if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
      set %posing #false
  }
  set *SecondaryIconX %lIconX + 20
  set *SecondaryIconY %lIconY + 20
  
  if %use_momentum
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Momentum Strike icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *MomentumIconX %lIconX + 20
    set *MomentumIconY %lIconY + 20
  }
  
  if %use_death
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Death Strike icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *DeathIconX %lIconX + 20
    set *DeathIconY %lIconY + 20
  }
  
  if %use_lightning
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Lightning Strike icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *LightningIconX %lIconX + 20
    set *LightningIconY %lIconY + 20
  }
  
  if %use_focus
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Focus Strike icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *FocusIconX %lIconX + 20
    set *FocusIconY %lIconY + 20
  }
  
  if %use_counter
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Counter Attack icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *CounterIconX %lIconX + 20
    set *CounterIconY %lIconY + 20
  }

  if %use_evasion
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Evasion icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *EvasionIconX %lIconX + 20
    set *EvasionIconY %lIconY + 20
  }
  
  if %use_confidence
  {
    wait 10
    event macro 8 1
    while #CONTNAME <> paperdoll_gump
    {
      sleep 10
    }
    DISPLAY OK Please left click your Confidence icon. It must be inactive. $
    set %posing #true
    while %posing
    {
      while #contname <> spellicon_gump
      {
        sleep 10
      }
      set %lIconX #CONTPOSX
      set %lIconY #CONTPOSY
      wait 10
      if #CONTPOSX = %lIconX && #CONTPOSY = %lIconY
        set %posing #false
    }
    set *ConfidenceIconX %lIconX + 20
    set *ConfidenceIconY %lIconY + 20
  }

  DISPLAY OK Setup Finished

return

sub DoInit

  if %small_gui
  {
    gosub SetupSmallGUI
  }
  else
  {
    gosub setupLargeGUI
  }
  
  set #menubutton null
  
  ;primary
  savepix *PrimaryIconX *PrimaryIconY 1
  set %PrimaryColour #pixcol
  
  ;secondary
  savepix *SecondaryIconX *SecondaryIconY 1
  set %SecondaryColour #pixcol

  if %use_momentum
  {
    savepix *MomentumIconX *MomentumIconY 1
    set %MomentumColour #pixcol
  }

  if %use_death
  {
    savepix *DeathIconX *DeathIconY 1
    set %DeathColour #pixcol
  }
  
  if %use_lightning
  {
    savepix *LightningIconX *LightningIconY 1
    set %LightningColour #pixcol
  }
  
  if %use_focus
  {
    savepix *FocusIconX *FocusIconY 1
    set %FocusColour #pixcol
  }
  
  if %use_counter
  {
  savepix *CounterIconX *CounterIconY 1
  set %CounterColour #pixcol
  }
  
  if %use_evasion
  {
    savepix *EvasionIconX *EvasionIconY 1
    set %EvasionColour #pixcol
  }
  
  if %use_confidence
  {
    savepix *ConfidenceIconX *ConfidenceIconY 1
    set %ConfidenceColour #pixcol
  }

return

sub SetupSmallGUI

  set %primary_text Pri
  set %secondary_text Sec
  set %momentum_text Mom
  set %death_text Dea
  set %lightning_text Lig
  set %focus_text Foc
  set %counter_text Cou
  set %evasion_text Eva
  set %confidence_text Cnf
  set %chiv_text Chiv
  set %reload_text Reload
  set %setup_text Setup

  set %buttonY 4
  set %buttonWidth 56
  set %buttonHeight 22
  set %buttonSetupWidth 56
  set %initButtonX 4
  set %setupButtonX ( %initButtonX + %buttonSetupWidth + 4 )
  set %stopButtonX ( %buttonWidth - 40 )

  set %attackbuttonX 4
  set %skillbuttonX ( 8 + %buttonWidth )
  

  gosub SetupWindowGUI
  
  set %chivbuttonX ( ( %windowWidth / 2 ) - ( %buttonWidth / 2 ) )
return

sub SetupLargeGUI

  set %primary_text Primary
  set %secondary_text Secondary
  set %momentum_text Momentum
  set %death_text Death
  set %lightning_text Lightning
  set %focus_text Focus
  set %counter_text Counter
  set %evasion_text Evasion
  set %confidence_text Confidence
  set %chiv_text Chivalry
  set %reload_text Reload
  set %setup_text Setup

  set %buttonY 4
  set %buttonWidth 118
  set %buttonHeight 22
  set %buttonSetupWidth 56
  set %initButtonX ( ( 4 + %buttonWidth ) - %buttonSetupWidth )
  set %setupButtonX ( %initButtonX + %buttonSetupWidth + 4 )
  set %stopButtonX ( %buttonWidth - 40 )
  
  set %attackbuttonX 4
  set %skillbuttonX ( 8 + %buttonWidth )

  gosub SetupWindowGUI
  
  set %chivbuttonX ( ( %windowWidth / 2 ) - ( %buttonWidth / 2 ) )
return

sub SetupWindowGUI

  set %windowWidth ( %skillbuttonX + %buttonWidth + 2 )
  set %windowHeight 4
  
  set %attackHeight 0
  set %skillHeight 0
  
  ;primary
  set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  
  ;secondary
  set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  
  if %use_momentum
  {
    set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  }
  if %use_death
  {
    set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  }
  if %use_lightning
  {
    set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  }
  if %use_focus
  {
    set %attackHeight ( %attackHeight + %buttonHeight + 4 )
  }
  if %use_counter
    set %skillHeight ( %skillHeight + %buttonHeight + 4 )
  }
  if %use_evasion
  {
    set %skillHeight ( %skillHeight + %buttonHeight + 4 )
  }
  if %use_confidence
  {
    set %skillHeight ( %skillHeight + %buttonHeight + 4 )
  }

  ;Take maximum of the heights for window size
  if %attackHeight > %skillHeight
  {
    set %windowHeight ( %windowHeight + %attackHeight )
  }
  else
  {
    set %windowHeight ( %windowHeight + %skillHeight )
  }

  if %use_chiv
  {
    set %windowHeight ( %windowHeight + %buttonHeight + 4 )
  }
  
  ;stop
  set %windowHeight ( %windowHeight + 30 + 4 )
  
  ;config buttons
  set %windowHeight ( %windowHeight + %buttonHeight + 4 )
  
return
aaron
Grandmaster Scribe
Posts: 79
Joined: Wed Jul 18, 2012 2:28 pm

Re: [EasyUO] Nunja Armer

Post by aaron »

Thanks Nunja, this version works great and seemed to clear up the little issues I had with the previous versions. Also very helpful that you added the new skills. I can now easily train Ninjitsu up to 120.
Locked