Reply To: animal taming macro

General Macro Help animal taming macro Reply To: animal taming macro

#2862
sharnthor
Member
  • Topics - 21
  • Replies - 90
  • Total - 111
  • Expert
  • ★★★★★

So, mappy gave me this script – mappi, so sorry if you you didnt’ want this on here, but it’s an awesome script 🙂

;---------------------------------------------------------------------;
;--program------------------------------------------------------------;
;---------------------------------------------------------------------;

gosub thesetup

start:
gosub findanimal %animaltype
gosub tameanimal
gosub killanimal
gosub ressanimal #result
if %timerz < #scnt
   {
   gosub rescount
   set %timerz ( #scnt + %zdelay )
   }
goto start

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

sub thesetup

set %spectre HIM
set %zdelay 200  ;change this to change how many secs delay it spams the resource count
set %lootcorpses 0   ;set to 1 for animals with loot
set %killangry 1    ;set to 1 to save time by killing angered animals

finditem RWF C_ , #backpackid       ;checks for arrows in your backpack
if #findcnt > 0
   {
   for #findindex 1 #findcnt
       {
       set %arrowsn ( %arrowsn + #findstack )
       }
   set %arrows #findid
   event sysmessage Arrows: %arrowsn
   }
else
    {
    set %display no_arrows
    gosub stop %display
    }
wait 10
finditem LNK C_ , #backpackid       ;checks for bolts in your backpack
if #findcnt > 0
   {
   set %bolts #findid
   event sysmessage Bolts: #findstack
   }
else
    {
    set %display no_bolts
    gosub stop %display
    }
wait 10
finditem ZLF C_ , #backpackid       ;checks for bandages in your backpack
if #findcnt > 0
   {
   set %bandages #findid
   event sysmessage Bandages: #findstack
   }
else
    {
    set %display no_bandages
    gosub stop %display
    }
wait 10
finditem WOH_JSF C_ , #charid        ;checks for bows and/or crossbows in your backpack and disarms
if #findcnt > 0
   {
   msg .disarm $
   wait 10
   }
wait 10
finditem WOH_JSF C_ , #backpackid     ;checks for bows and crossbows in your backpack to count
if #findcnt > 0
   {
   set %numbows #findcnt
   for #findindex 1 #findcnt
       {
       set %bow . #findindex #findid
       }
   event sysmessage Bows: %numbows
   }
else
    {
    set %error No , #spc , Bows , #spc , Found , #spc , at , #spc , backpack
    gosub stop %error
    }
if %numbows > 5
   {
   set %numbows 5
   }
display yesnocancel Setup .Arm Commands? No to Proceed. Cancel to quit.
if #dispres = yes
   {
   gosub setupbows
   }
if #dispres = cancel
   {
   event sysmessage stopping script!
   halt
   }
set #dispres nothing
event sysmessage Target the trapped animal   ;target the animal you'll be training on
set #targcurs 1
while #targcurs = 1
      {
      wait 2
      }
set %tempvar #ltargetid
wait 10
finditem %tempvar G_5
if #findcnt > 0
   {
   set %animaltype #findtype
   event ExMsg #findid 0 33 I am type: #findtype
   }
else
    {
    set %error no_animal_found
    gosub stop %error
    }
finditem FQD c_ , #backpackid         ;checks if you have raw fish in your backpack (food ofcourse)
if #findcnt > 0
   {
   set %fisk #findid
   event sysmessage #findstack fishs
   }
else
    {
    event sysmessage No fishs
    }
finditem PEF_SEF c_ , #backpackid      ;checks if you have kindling in your backpack
if #findcnt > 0
   {
   set %kindling #findid
   event sysmessage #findstack kindlings
   }
else
    {
    event sysmessage No Kindling!
    }
set %display 0
set %timerz ( #scnt + %zdelay )
set %moveawayx 1273
set %moveawayy 1287
skippast:
return

;---------------Set Up Your Bows Arm/Disarm-------------------------------------;

sub setupbows
set %xbutton 75
set %ybutton 330
set %x 45

finditem WOH_JSF C_ , #charid
if #findcnt > 0
   {
   msg .disarm $
   wait 10
   }
wait 10
finditem WOH_JSF C_ , #backpackid
if #findcnt > 0
   {
   set %numbows #findcnt
   for #findindex 1 #findcnt
       {
       set %bow . #findindex #findid
       }
   event sysmessage Bows: %numbows
   }
else
    {
    set %error ( No , #spc , Bows , #spc , Found , #spc , within , #spc , your , #spc , backpack )
    gosub stop %error
    }
if %numbows > 5
   {
   set %numbows 5
   }
event sysmessage Setting Arm commands
msg .arm$
set %bii 1
for %bii 1 %numbows
    {
    event sysmessage Arming bow %bii DontCrash
    ExEvent drag %bow . %bii
    wait 25
    ExEvent droppd
    wait 25
    finditem WOH C_ , #charid
    if #findcnt > 0
       {
       set %yy ( ( 50 * %bii ) + 25 )
       click %x %yy
       wait 18
       click %xbutton %ybutton
       wait 18
       msg .disarm$
       wait 18
       }
    }
click %xbutton %ybutton r
event sysmessage All your bows are set up
return

;----------------Find Your Animal------------------------------------------------;

sub findanimal
refind:
wait 10
finditem %1 G_4   ; YG = bull
if #findcnt > 0
   {
   set %liveanimal #findid
   wait 6
   }
else
    {
    event sysmessage No animals detected
    }
return

;------------------Tame The Animal -----------------------------------------------;

sub tameanimal
set #ltargetid %spectre
event macro 27 0
retame:
event macro 13 35
set #ltargetkind 1
set #ltargetid %liveanimal
set %jstart #jindex
target 2s
event macro 22 0
wait 1s
scanjournal
if does_not_seem in #journal
   {
   return
   }
if tamed_already in #journal
   {
   return
   }
if has_angered in #journal
   {
   event sysmessage Animal is angry
   if %killangry = 0
      {
      wait 14s
      goto retame
      }
   return
   }
else
    {
    wait 10s
    set %jend #jindex
    event sysmessage scanning...
    for %ji %jstart %jend
        {
        scanjournal %ji
        if tamed_already in #journal
           {
           return
           }
        if successfully_tame in #journal
           {
           event sysmessage success
           return
           }
        if failed_to_tame in #journal
           {
           set %ji %ji + 1
           scanjournal %ji
           if unresponsive in #journal
              {
              event sysmessage One loop of tracking to reset cd
              wait 4s
              gosub trackingonce
              goto retame
              }
           event sysmessage Not successfull will retry in 4s
           wait 4s
           goto retame
           }
        }
    event sysmessage retrying because no recognised journal entry
    wait 4s
    goto retame
    }
return

;---------------------Kill the animal---------------------------------------------;

sub killanimal
msg all release$
set %liveanimal #ltargetid
event macro 27 0
gosub rearm
set %timera ( #scnt + 68 )
set %timerc ( #scnt + 10 )
set #lobjectid %fisk
repeat
      {
      if %timera < #scnt
         {
         finditem %liveanimal G_3
         if #findcnt > 0
            {
            event sysmessage Timed out but animal is alive
            gosub killanimal
            }
         }
      if %timerc < #scnt
         {
;         event macro 13 38
;         wait 1s
;SET %clickX #CONTPOSX + %1
;SET %clickY #CONTPOSY + %2
;CLICK %clickX %clickY
;         wait 5s
;         set %timerc ( #scnt + 10 )
         }
      event macro 17 0   ;does a fisk
      wait 3s
           ignoreitem reset 1
           ignoreitem MXNVNMD 1
           ignoreitem JRNMGOD   1  ;corspes
           ignoreitem HAOMGOD   1   ;ignore player corpses
      finditem YFM G_3
      wait 5
      }
until #findcnt > 0

set #ltargetid %spectre
event macro 27 0
return #findid
;------------------------------------------------------------------
sub rearm
event sysmessage arming
msg $
msg .arm 1$
wait 2
msg .arm 2$
wait 2
msg .arm 3$
;msg .arm 4$
;msg .arm 5$
return
;-------------------------------------------------------------------
sub trackingonce
;event macro 13 13
;wait 1s
;SET %clickX #CONTPOSX + %1
;SET %clickY #CONTPOSY + %2
;CLICK %clickX %clickY
wait 10s
return
;--------------------------------------------------------------------
sub ressanimal
;event pathfind #findx #findy
;wait 8
;set #lobjectid %dagger      ;comment out to remove skinning
;event macro 17 0            ;
;target 2s                   ;
;set #ltargetid #contid      ;
;event macro 22 0            ;
wait 5                       ;end
if G in #charstatus
   {
   event macro 6
   }
if %lootcorpses = 1
   {
   gosub loot %1
   }
reress:
set %jstart #jindex
set #lobjectid %bandages
event macro 17 0
target 2s
set #ltargetid %1
event macro 22 0
wait 1s
scanjournal
if does_not_seem in #journal
   {
   return
   }
wait 11s
set %jend #jindex
for %jii %jstart %jend
    {
    scanjournal %jii
    if resurrected_a in #journal
       {
       return
       }
    if fail_to_ress in #journal
       {
       goto reress
       }
    }
goto reress
return
;-------------------------------------------------------------------------;
sub loot
if #finddist > 1
   {
   event pathfind #findx #findy #findz
   wait 12
   }
set #lobjectid %1
event macro 17 0
wait 20
finditem RWF_LNK_POF_WZF_OWI_RVH_DAG_QZF_HUF_VUF_MWF_WOH C_ , %1
event sysmessage Looting #findcnt items...
for #findindex 1 #findcnt
    {
    exevent drag #findid #findstack
    wait 12
    exevent dropc #backpackid
    wait 12
    }
return
;-------------------------------------------------------------------------;
sub rescount
set %arrowsn 0
finditem WOH C_ , #backpackid
         {
         set %numbows #findcnt
         }
wait 1
finditem RWF C_ , #backpackid
if #findcnt > 0
   {
   for #findindex 1 #findcnt
       {
       set %arrowsn ( %arrowsn + #findstack )
       }
   }
finditem %bandages C_ , #backpackid
         {
         set %nbandages #findstack
         }
finditem %fisk C_ , #backpackid
         {
         set %nfisk #findstack
         }
event sysmessage Bows: %numbows / Arrows: %arrowsn / Bandages: %nbandages / Fish: %nfisk
wait 1
return
;-------------------------------------------------------------------------;
sub stop
display ok %1
return
;-------------------------------------------------------------------------;