[EasyUO] Animal taming macro (Full automated)

If you make a Client-side script you can publish it here for other players to use
Post Reply
magusfva
Passer by
Posts: 1
Joined: Tue Jul 23, 2019 5:29 pm

[EasyUO] Animal taming macro (Full automated)

Post by magusfva »

I'm posting my animal taming macro. It's fully automated, as it finds the most suitable animal types for current skill level, tames it, rename, release and kill it (melee only, no spells).
It's based off Uncle Dave's Tamer Plus from EasyUO library, but highly modified for compatibility with Excelsior Shard.

How to use it?
  • Copy the full code, paste in a notepad file and save it
    Run EasyUO and open the macro you saved
    Press Start
    The Configuration window will open (it will remain open as long as the macro is running)
Options:
  • Auto Tame Creatures = will find best mobs for taming based on current skill level
    Pickup Reagents = will move to and pick up reagents from the ground
Release options:
  • Context Menu = will click 'yes' on release context gump
    Rename = will rename tamed pets to "KillMe"
    Kill after release = will engage released pets in melee combat
Hope you find it useful. :D

Code: Select all

;=========================================
; Script Name: Melius Excelsior Tamer
; Original Author: Uncle Dave
; Modified by Melius for Excelsior Shard 07/23/2019
; Version: 4.2
; Client Tested with: 5.0.0
; EUO version tested with: 1.6.0.334
; Shard: UO Excelsior (www.uoex.net)
; Revision Date: 07/23/2019
; Purpose: Finds animals that will give
; you the best gains and tames the closest
; animal to your current location.
; Rename, release, kill for respawn
;=========================================
;
; The following table was generated from data gathered off the UO Stratics
; taming page. Analysing their results produces a success rate calculation
; based upon the character's Animal Taming skill only. Modifying the Animal
; Lore did not produce any noticable changes in the success rates.
;
; The formula determined for calculating success rate is R = (S - B) * 2 where
; R is the success rate, S is the character's taming skill, and B is the
; minumum skill required to tame minus 0.1 (this is the base skill
; requirement). Using basic algebra and solving for S provides a formula that
; can can be used calculate the skill required to achieve a specific success
; rate (S = R / 2 + B). This formula is used in the table below to determine
; which creatures will provide the best chances to recieve a gain while
; taming.
;
; Column descriptions:
;
; ANIMAL    The name of the animal to tame
; REQ SKILL The minimum skill required to tame
; MIN GAIN  The skill level that has a 10% success rate
; MAX GAIN  The skill level that has an 90% success rate
; C/M       Monster (Yes/No)
; TYPE      EasyUO FindItem type for animal
;
;                      REQ    MIN    MAX
; ANIMAL             SKILL   GAIN   GAIN  C/M  TYPE
; -----------------  -----  -----  -----  ---  ----
; Dog                -21.3    -17     23   N   HG
; Gorilla            -18.9    -14     26   N   RD
; Jack Rabbit        -18.9    -14     26   N   NF
; Mongbat            -18.9    -14     26   Y   BE
; Rabbit             -18.9    -14     26   N   NF
; Skittering Hopper  -12.9     -8     32   N   GO
; Bird                -6.9     -2     38   N   WC
; Cat                 -0.9      4     44   N   RF
; Chicken             -0.9      4     44   N   AG
; Mountain Goat       -0.9      4     44   N   KB
; Rat                 -0.9      4     44   N   WG
; Sewer Rat           -0.9      4     44   N   WG
; Cow                 11.1     16     56   N   IG_NG
; Goat                11.1     16     56   N   ZF
; Pig                 11.1     16     56   N   JF
; Sheep               11.1     16     56   N   TF_PF
; Eagle               17.1     22     62   N   TC
; Bullfrog            23.1     28     68   N   BB
; Hind                23.1     28     68   N   TG
; Slime               23.1     28     68   Y   VE
; Timber Wolf         23.1     28     68   N   PG
; Boar                29.1     34     74   N   CO
; Desert Ostard       29.1     34     74   N   CG
; Forest Ostard       29.1     34     74   N   JG
; Giant Beetle        29.1     34     74   Y   ZGB
; Giant Rat           29.1     34     74   N   XF
; Horse               29.1     34     74   N   SF_MG_SG_OF
; Pack Horse          29.1     34     74   N   BO
; Pack Llama          29.1     34     74   N   WN
; Rideable Llama      29.1     34     74   N   EG
; War Horse           29.1     34     74   N   QC
; Black Bear          35.1     40     80   N   BG
; Llama               35.1     40     80   N   EG
; Polar Bear          35.1     40     80   N   VF
; Walrus              35.1     40     80   N   DG
; Brown Bear          41.1     46     86   N   ZI
; Cougar              41.1     46     86   N   ZE
; Deathwatch Beetle   41.1     46     86   Y   IH
; Alligator           47.1     52     92   N   UF
; Scorpion            47.1     52     92   Y   UE
; Grey Wolf           53.1     58     98   N   VD
; Panther             53.1     58     98   N   YF
; Snow Leopard        53.1     58     98   N   L_M
; Giant Spider        59.1     64    104   Y   SD
; Great Hart          59.1     64    104   N   AH
; Grizzly Bear        59.1     64    104   N   WF
; Snake               59.1     64    104   N   QE
; White Wolf          65.1     70    110   N   GE_ZD_PG
; Gaman               68.7     73    113   N   OH
; Bull                71.1     76    116   N   YG_XG
; Giant Ice Worm      71.1     76    116   N   
; Hellcat (Small)     71.1     76    116   Y   RF
; Mongbat (Strong)    71.1     76    116   Y   
; Frost Spider        74.7     79    119   Y   KD
; Frenzied Ostard     77.1     82    122   N   KG
; Giant Toad          77.1     82    122   N   CB
; Bake Kitsune        80.7     85    125   Y   EH
; Lava Lizard         80.7     85    125   Y   QF
; Dire Wolf           83.1     88    128   N   LD
; Imp                 83.1     88    128   Y   W
; Ridgeback           83.1     88    128   N   WJ
; Savage Ridgeback    83.1     88    128   N   
; Drake               84.3     89    129   Y   YE_XE
; Hell Hound          85.5     90    130   Y   UB
; Hellcat (Large)     89.1     94    134   Y   NC
; Dragon              93.9     98    138   Y   CD_DF
; Fire Beetle         93.9     98    138   Y   JJ
; Rune Beetle         93.9     98    138   Y   CH
; Swamp Dragon        93.9     98    138   Y   MHB
; Ki-Rin              95.1    100    140   Y   SH
; Nightmare           95.1    100    140   Y   TJ
; Unicorn             95.1    100    140   Y   SC
; White Wyrm          96.3    101    141   Y   TE
; Hiryu               98.7    103    143   Y   HH
; Lesser Hiryu        98.7    103    143   Y   HH
; Fire Steed           106    110    150   Y   YJ
;
; TAMING MESSAGES
; It's too far away.
; You can't see that.
; You can't tame that!
; That animal looks tame already.
; That creature cannot be tamed.
; Someone else is already taming that creature.
; You have too many followers to tame that creature.
; You have no chance of taming this creature.
; You seem to anger the beast.
; *You start to tame the creature.*
; You fail to tame the creature.
; You are too far away to continue taming.
; You do not have a clear path to the animal you are taming, and must cease your attempt.
; The animal is too angry to continue taming.
; The animal has been distracted, and you cannot continue taming.
; It seems to accept you as master.
; <petname> appears to have decided that it is better off without a master!
;
initevents
gosub InitMenu
gosub InitAnimalTaming
gosub InitPickupRegs

loop:
gosub Dispatch
goto loop

sub InitMenu
    menu clear
    menu window title Melius Excelsior Tamer
    menu window size 320 190
    menu window color $E0E0E0
    menu font bgcolor $E0E0E0
    menu font name MS Sans Serif
    menu font size 8
    menu font style b
    menu text lblmovement 10 5 Features
    menu font style n
    menu check autotame 10 20 130 15 #false Auto Tame Creatures
    menu check pickupregs 10 35 130 15 #false Pickup Reagents
    menu font style b
    menu text lblrelease 10 55 Release Option
    menu font style n
    menu check releasecontext 10 70 130 15 #false Context Menu
    menu check releaserename 10 85 130 15 #false Rename
    menu check releasekill 10 100 130 15 #false Kill after release
    menu font style b
    menu text lblmisc 10 120 Character Movement
    menu font style n
    menu check dontmove 10 135 130 15 #false Don't Move Character
    menu check returnstart 10 150 130 15 #false Return To Start
    menu font style b
    menu text lblstatistics 150 5 Statistics
    menu font style n
    menu text lbltameskill 150 20 Animal Taming:
    menu text lblloreskill 150 35 Animal Lore:
    menu text lbltameid 150 50 Animal Id:
    menu text lbltamecount 150 65 Attempts:
    menu font align right
    menu text tameskill 310 20 0/0
    menu text loreskill 310 35 0/0
    menu text tameid 310 50 N/A
    menu text tamecount 310 65 0
    menu font align left
    menu button manualtame 150 90 80 25 Manual Tame
    menu button resetstart 150 115 80 25 Reset Start
    menu button ignorecurrent 230 90 80 25 Ignore Current
    menu button resetignore 230 115 80 25 Reset Ignore
    menu button setregcont 150 140 160 25 Set Reagent Container
    menu shape bgstatus 0 173 320 17 3 7 1 $999999 7 $E0E0E0
    menu font color $666666
    menu text lblstatus 5 175 Status:
    menu text status 40 175 Initializing
    gosub MenuUpdateStats
    menu show
    menu HideEUO
    set #menubutton N/A
return

sub InitAnimalTaming
    event macro 8 2 ; open status
    wait 1s
    set %statusposx #contposx
    set %statusposy #contposy
    set %charstartx #charposx
    set %charstarty #charposy
    set %charstartz #charposz
    set %tameskill -1
    set %tameigtimer 0
    set %tamecount 0
    set %tameid N/A
return

sub InitPickupRegs
    set %reagents KUF_JUF_MZF_JZF_KZF_WZF_RZF_SZF
    event macro 8 7 ; open backpack
    wait 1s
return

sub Dispatch
    menu set status Idle
    gosub ScriptIdletime
    gosub TamingCheckSkill
    set %finditems N/A
    menu get autotame
    if #menures = #true
    {
        gosub TamingIgnore reset
        set %finditems %tameable
    }
    menu get pickupregs
    if #menures = #true
    {
        if %finditems = N/A
            set %finditems %reagents
        else
            set %finditems %finditems , _ , %reagents
    }
    gosub FindClosestItem %finditems
    if %finddist = N/A
    {
        menu get returnstart
        if #menures = #true
        {
            gosub PathfindWait %charstartx %charstarty %charstartz
            if %moveres = error
                menu set returnstart #false
        }
    }
    if %finddist <> N/A
    {
        if %findtype in %tameable
            gosub Taming %findid
        if %findtype in %reagents
            gosub PickupRegs %findid
    }
return

sub ScriptIdletime
    if #menubutton = manualtame 2
        set #menubutton N/A
        gosub TamingManual
    if #menubutton = resetignore 2
        set #menubutton N/A
        ignoreitem reset
    if #menubutton = resetstart 4
        set #menubutton N/A
        set %charstartx #charposx
        set %charstarty #charposy
        set %charstartz #charposz
    if #menubutton = setregcont 2
        set #menubutton N/A
        gosub SetReagentContainer
    gosub MenuUpdateStats
    gosub PickupRegsNearby
return

sub MenuUpdateStats
    chooseskill anim
    str right #skill 1
    set %_skilldec #strres
    set %_skill #skill / 10
    set %_skillcap #skillcap / 10
    menu set tameskill %_skill , #dot , %_skilldec , / , %_skillcap
    chooseskill anil
    str right #skill 1
    set %_skilldec #strres
    set %_skill #skill / 10
    set %_skillcap #skillcap / 10
    menu set loreskill %_skill , #dot , %_skilldec , / , %_skillcap
    menu set tameid %tameid
    menu set tamecount %tamecount
return

sub Taming
    if #followers >= #maxfol
    {
        display ok You have too many followers
        menu set autotame #false
        return
    }
    finditem %1 G_16
    if #findkind = -1
        return
    set %tameid #findid
    set %tametype #findtype
    set %tamedist #finddist
    set #LTARGETID %tameid
    GoSub GetPetName #LTARGETID
    If KillMe in #result
    {
       gosub TamingIgnore name %tameid
       event exmsg %tameid 3 30 Ignored pet named KillMe.
       set %tameid N/A
       return
    }
    if %tameid <> #ltargetid
        event exmsg %tameid 3 30 Pick me!
    set %tamecount 0
    gosub MenuUpdateStats
    gosub TameAnimal
    set %tameid N/A
return

SUB GetPetName
;*************************************************************
;Params: %1 is the ID of the Item to get the name of
;*************************************************************
        ;Gets the Item ID's Property
        event Property #LTARGETID

        ;Gets the location of the first split in the item's property
        str pos #property $

        ;Gets the items name
        set %InStr #StrRes - 1
        str left #property %InStr
RETURN #StrRes

sub TamingManual
    if %tameid <> N/A
    {
        event sysmessage You are already taming something.
        return
    }
    menu set status Waiting For Target
    gosub GetTargetId
    gosub Taming #ltargetid
return

sub TamingCheckSkill
    menu get autotame
    if #menures = #false
        return
    chooseskill anim
    if #skill = #skillcap
    {
        display ok Taming skillcap reached
        menu set autotame #false
        return
    }
    if %tameskill = #skill
        return
    set %tameskill #skill
    ; ---------------------------------------------------
    ; this chart was auto-generated using TamingChart.xls
    ; ---------------------------------------------------
    if %tameskill >= 0 && %tameskill < 40
        set %tameable HG_RD_NF_BE_NF_GO_WC
    if %tameskill >= 40 && %tameskill < 160
        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG
    if %tameskill >= 160 && %tameskill < 220
        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF
    if %tameskill >= 220 && %tameskill < 280
        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC
    if %tameskill >= 280 && %tameskill < 340
        set %tameable GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG
    if %tameskill >= 340 && %tameskill < 400
        set %tameable WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC
    if %tameskill >= 400 && %tameskill < 460
        set %tameable RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG
    if %tameskill >= 460 && %tameskill < 520
        set %tameable IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH
    if %tameskill >= 520 && %tameskill < 580
        set %tameable IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE
    if %tameskill >= 580 && %tameskill < 640
        set %tameable TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M
    if %tameskill >= 640 && %tameskill < 700
        set %tameable BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE
    if %tameskill >= 700 && %tameskill < 736
        set %tameable CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_PG
    if %tameskill >= 736 && %tameskill < 760
        set %tameable CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_PG
    if %tameskill >= 760 && %tameskill < 796
        set %tameable BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_PG
    if %tameskill >= 796 && %tameskill < 820
        set %tameable BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_PG
    if %tameskill >= 820 && %tameskill < 856
        set %tameable ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_PG
    if %tameskill >= 856 && %tameskill < 880
        set %tameable ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_PG
    if %tameskill >= 880 && %tameskill < 892
        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_PG
    if %tameskill >= 892 && %tameskill < 904
        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_PG
    if %tameskill >= 904 && %tameskill < 940
        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_PG
    if %tameskill >= 940 && %tameskill < 988
        set %tameable VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_PG
    if %tameskill >= 988 && %tameskill < 1000
        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_PG
    if %tameskill >= 1000 && %tameskill < 1012
        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC_PG
    if %tameskill >= 1012 && %tameskill < 1036
        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC_TE_PG
    if %tameskill >= 1036
        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC_TE_HH_HH_PG
    gosub TamingIgnore gain
return

sub TamingIgnore
    if %1 = perm
    {
        ignoreitem %2
        return
    }
    if %1 = temp
    {
        ignoreitem %2 1
        set %tameigtimer #systime + 60000
        return
    }
    if %1 = reset && #systime > %tameigtimer
    {
        ignoreitem reset 1
        return
    }
    if %1 = skill
    {
        ignoreitem %2 2
        return
    }
    if %1 = gain
    {
        ignoreitem reset 2
        return
    }
    if %1 = name
    {
        ignoreitem %2
        return
    }
return

sub TameAnimal
    menu set status Starting To Tame
    TamingLoop:
    finditem %tameid G_16
    if #findkind = -1
        return
    if #finddist > 3
    {
        menu set status Too Far Away
        gosub PathfindWait #findx #findy #findz
        if %moveres = error
        {
            gosub TamingIgnore temp %tameid
            return
        }
        if #menubutton = ignorecurrent
        {
            set #menubutton N/A
            gosub TamingIgnore perm %tameid
            return
        }
        gosub ScriptIdletime
        goto TamingLoop
    }
    set %tamecount %tamecount + 1
    set %tamejournal #jindex + 1
    set %tamefollow #followers
    set #ltargetid %tameid
    set #ltargetkind 1
    event macro 13 35 ; animal taming
    target 2s
    event macro 22 0 ; last target
    gosub TamingMonitor
    if #result = success
    {
        gosub TamingRelease
        gosub TamingIgnore perm %tameid
        return
    }
    if #result = retry
    {
        gosub ScriptIdletime
        goto TamingLoop
    }
    if #result = retrylater
    {
        gosub TamingIgnore temp %tameid
        return
    }
    if #result = ignore
    {
        gosub TamingIgnore perm %tameid
        return
    }
    if #result = cancel
    {
        menu set autotame #false
        return
    }
    if #result = skill
    {
        gosub TamingIgnore skill %tameid
        return
    }
    gosub ScriptIdletime
    goto TamingLoop
return

sub TamingMonitor
    set %movetimer 0
    set %tametimer #systime + 15000
    TamingMonitorLoop:
    if #jindex >= %tamejournal
    {
        scanjournal %tamejournal
        set %tamejournal %tamejournal + 1
        if start_to_tame in #journal
            menu set status Taming Animal
        if seems_to_accept in #journal
            return success
        if anger_the_beast in #journal
            return retry
        if fail_to_tame in #journal
            return retry
        if too_far in #journal
            return retry
        if clear_path in #journal
            return retry
        if too_many_followers in #journal
            return cancel
        if can't_see_that in #journal
            return retrylater
        if too_angry in #journal
            return retrylater
        if distracted in #journal
            return retrylater
        if someone_else in #journal
            return retrylater
        if tame_already in #journal
            return ignore
        if cannot_be_tamed in #journal
            return ignore
        if can't_tame_that in #journal
            return ignore
        if no_chance in #journal
            return skill
    }
    if #followers > %tamefollow
        return success
    if #menubutton = ignorecurrent
        return ignore
    if #systime > %tametimer
        return retry
    finditem %tameid G_16
    if #findkind = -1
        return retry
    if #finddist > 3 && #systime > %movetimer
    {
        menu get dontmove
        if #menures = #false
            event pathfind #findx #findy #findz
        set %movetimer #systime + 1500
    }
    gosub ScriptIdletime
    goto TamingMonitorLoop
return

sub TamingRelease
    menu get releasecontext
    if #menures = #false
    {
        menu get releaserename
        if #menures = #false
        {
            event macro 1 0 All Follow Me
            return
        }
    }
    menu set status Releasing Animal
    set %attempt 0
    set %adjust #false
    set %tamefollow #followers
    event macro 1 0 All Stay
    wait 10
    gosub TamingRename
    TamingReleaseLoop:                          ; TAMING RELEASE LOOP QUE TA DANDO MERDA!!!
    event macro 1 0 KillMe release
    wait 10
    if #contid = #charid
    {
        event macro 8 2
        wait 10
        contpos %statusposx %statusposy
        wait 10
    }
    if #contname = generic_gump
    {
            if #contsize = 270_120
            {
                set %xx #contposx + 35
                set %yy #contposy + 90
                click %xx %yy F
                wait 15
            }
            else
            {
                event macro 1 0 KillMe release
                wait 10
            }
    }
    if #followers < %tamefollow
    {
        menu get releasekill
        if #menures = #true
            gosub TamingKill
        return
    }
    set %attempt ( %attempt % 5 ) + 1
    finditem %tameid
    if #findkind = -1
        return
    if %attempt > 1 && #finddist > 3
    {
        event macro 1 0 All Stay
        event pathfind #findx #findy #findz
        wait 2s
        set %attempt 0
        goto TamingReleaseLoop
    }
    if #finddist = 0
        set %adjust #true
    if #finddist = 1
    {
        set %deltax #findx - #charposx
        set %deltay #findy - #charposy
        if %deltay < 0 && %deltax = 0
            set %adjust #true
        if %deltay < 0 && %deltax < 0
            set %adjust #true
        if %deltay = 0 && %deltax < 0
            set %adjust #true
    }
    if %adjust = #true
    {
        if %attempt = 1
        {
            event macro 5 7 ; walk west
            event macro 5 7 ; walk west
            wait 1s
        }
        if %attempt = 2
        {
            event macro 5 2 ; walk north east
            event macro 5 2 ; walk north east
            event macro 5 2 ; walk north east
            wait 1s
        }
        if %attempt = 3
        {
            event macro 5 6 ; walk south west
            event macro 5 6 ; walk south west
            event macro 5 6 ; walk south west
            wait 1s
        }
        if %attempt = 4
        {
            event macro 5 1 ; walk north
            event macro 5 1 ; walk north
            event macro 5 1 ; walk north
            wait 1s
        }
        if %attempt = 5
        {
            event macro 5 4 ; walk south east
            event macro 5 4 ; walk south east
            event macro 5 4 ; walk south east
            event macro 5 4 ; walk south east
            wait 1s
        }
        set %adjust #false
        gosub TamingRename
        goto TamingReleaseLoop
    }
    finditem %tameid
    if #findkind = -1
        return
    gosub GetScreenXY #findx #findy #findz 0 %screenydisp
    menu get releaserename
    if #menures = #true
    {
        goto TamingReleaseLoop
    }
    event macro 1 0 All Follow Me
return

sub TamingRename
    menu set status Ranaming Animal
    exevent RenamePet %tameid KillMe   ; extra modificado felipe
    event sysmessage Renaming pet to KillMe
    wait 10                            ; extra
return                             ; extra


sub TamingKill
    menu set status Killing Animal
    TamingKillLoop:
    finditem %tameid
    if #findkind = -1
        return
    gosub KillPet
return

SUB KillPet
SET !_creature %tameid
SET !_AutoMoveToTarget #TRUE ;#TRUE or #FALSE
SET !_lowHits 55
SET !_maxRange 10
; =====================================
IGNOREITEM reset
SET #LTARGETID %tameid
enemyloop:
FOR !_range 1 !_maxrange
{
   FINDITEM !_creature G_ , !_range
   IF #FINDKIND <> -1
   {
     SET #LTARGETID #FINDID
     SET !_enemy #FINDID
     GOSUB attack
   }
   WAIT 10
}
SET !_range 0
return
goto enemyLoop

; ================
SUB attack
attack_loop:
EVENT macro 27
FINDITEM !_enemy G_
IF #FINDKIND = 1
{
   IF #HITS > !_lowHits && !_AutoMoveToTarget = #TRUE && #FINDDIST > 1
      MOVE #FINDX #FINDY a
   WAIT 20
         GOTO attack_loop
}
RETURN
; ================

AttackLoop:
FINDITEM %tameid
IF #FINDKIND = 1
   GOTO AttackLoop
RETURN

; clickScreenXYZ by ScriptFellow modded by Roadkill
; Mods by UncleDave
sub GetScreenXY
    set %1 ( %1 - #charposx ) * 22  ; world x-coordinate
    set %2 ( #charposy - %2 ) * 22  ; world y-coordinate
    set %3 ( %3 - #charposz ) * 4   ; world z-coordinate
    if %0 < 4 || %4 = N/A
        set %4 0                    ; x displacement, added to screen coordinate
    if %0 < 5 || %5 = N/A
        set %5 35                   ; y displacement, added to screen coordinate
    set %screenx #clileft + #clixres / 2 + %1 + %2 + %4
    set %screeny #clitop + #cliyres / 2 + %1 - %2 - %3 + %5
    set %offscreen #true
    if %screenx > #clileft &&
        + %screeny > #clitop &&
        + %screenx < ( #clileft + #clixres ) &&
        + %screeny < ( #clitop + #cliyres )
    {
        set %offscreen #false
        ;click %screenx %screeny F
    }
return

; GetYDisplacementForAnimType by Roadkill
; Mods by UncleDave
sub GetAnimalDisplacement
    set %screenydisp -32
    if %tametype in GE_ZD_L_M_TF__IG_NG__ZF_PF_EG_CO_TG_PG_VD
        set %screenydisp -25
    if %tametype in AH
        set %screenydisp -45
    if %tametype in DG_AG_WC_RF_WG_TC
        set %screenydisp -15
return

sub SetReagentContainer
    if %tameid <> N/A
    {
        event sysmessage You must wait until you are finished taming.
        return
    }
    event sysmessage Target the container to drop reagents.
    gosub GetTargetId
    set %regcont #ltargetid
return

sub PickupRegs
    finditem %1 G_16
    if #findkind = -1
        return
    menu set status Picking Up Reagents
    set %regsid #findid
    set %regsdist #finddist
    if %regsdist > 2
    {
        gosub PathfindWait #findx #findy #findz
        if %moveres = error
        {
            ignoreitem %regsid
            return
        }
    }
    gosub GetContainerPos %regcont
    if #result = #false
    {
        event sysmessage Unable to find reagent container.
        menu set pickupregs #false
        return
    }
    set %js #jindex
    event drag %regsid
    wait 10
    if #contname = stack_gump
        key ENTER
    set %je #jindex
    for %ji %js %je
    {
        scanjournal %ji
        if can_not_pick in #journal 2
            ignoreitem %regsid
            return
    }
    click %contdropx %contdropy
    wait 10
return

sub PickupRegsNearby
    menu get pickupregs
    if #menures = #false
        return
    finditem %reagents G_2
    if #findkind <> -1
        gosub PickupRegs #findid
return

sub FindClosestItem
    finditem %1 G_16
    set %findid #findid
    set %findtype #findtype
    set %finddist #finddist
    if #findcnt > 1
    {
        for %i 1 #findcnt
        {
            finditem %1 %i G_16
            if #findkind <> -1 && #finddist < %finddist
            {
                set %findid #findid
                set %findtype #findtype
                set %finddist #finddist
            }
        }
    }
return

sub GetTargetId
    set #ltargetid N/A
    set #targcurs 1
    GetTargetIdLoop:
    if #targcurs = 1
        goto GetTargetIdLoop
return

sub PathfindWait
    set %moveres unknown
    menu get dontmove
    if #menures = #true
        return
    if #charposx = %1 && #charposy = %2
    {
        set %moveres success
        return
    }
    set %js #jindex
    event pathfind %1 %2 %3
    wait 10
    set %je #jindex
    for %ji %js %je
    {
        scanjournal %ji
        if pathfinding in #journal
        {
            set %movex #charposx
            set %movey #charposy
            set %movetimer #systime + 500
            PathfindWaitLoop:
            if #systime < %movetimer
                goto PathfindWaitLoop
            if %movex = %1 && %movey = %2
            {
                set %moveres success
                return
            }
            if %movex = #charposx && %movey = #charposy
            {
                set %moveres stopped
                return
            }
            set %movex #charposx
            set %movey #charposy
            set %movetimer #systime + 500
            goto PathfindWaitLoop
        }
        if can't_get_there in #journal
        {
            set %moveres error
            return
        }
    }
return

sub GetContainerPos
    finditem %1 C
    if #findkind = -1
        return #false
    if #findtype = ZJF 5 ; backpack
        set %contposx #findx + 22
        set %contposy #findy + 16
        set %contdropx #findx + 22
        set %contdropy #findy + 12
        return #true
    if #findtype = CKF 5 ; bag
        set %contposx #findx + 22
        set %contposy #findy + 15
        set %contdropx #findx + 21
        set %contdropy #findy + 10
        return #true
    if #findtype = LKF 5 ; pouch
        set %contposx #findx + 22
        set %contposy #findy + 13
        set %contdropx #findx + 25
        set %contdropy #findy + 7
        return #true
return #false
User avatar
Alamiester
Legendary Scribe
Posts: 279
Joined: Wed Jan 04, 2017 8:49 pm

Re: [EasyUO] Animal taming macro (Full automated)

Post by Alamiester »

nice. i havnt seen a decent easyuo tamer. ill havto try this one out. thanks for the share.
User avatar
Alamiester
Legendary Scribe
Posts: 279
Joined: Wed Jan 04, 2017 8:49 pm

Re: [EasyUO] Animal taming macro (Full automated)

Post by Alamiester »

btw who are you ingame? so if i have problems or otherwise i can contact you. pther wise message me in forum email, ill see it eventually.
Post Reply