Author Topic: B@ndito's tamer assistant  (Read 4832 times)

0 Members and 1 Guest are viewing this topic.

Offline b@nditoTopic starter

  • Jr. Member
  • **
  • Posts: 48
  • Activity:
    0%
  • Reputation Power: 0
  • b@ndito has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
B@ndito's tamer assistant
« on: December 09, 2010, 09:06:18 AM »
0
Another script of mine i made it 1 year ago and never changed, it still works pretty well to me.
Again, it was designed for a freeshard but bandages type ID should be the same on OSI, sorry for poor english.

Description and explanations contained into the script (note for scripters: variable naming in italian).
I'm currently supporting this and available to questions/requests.

Code: [Select]
;-#=#=#=#=#=#=#=#=#=#=#=#-
;Name: B@ndito's Tamer Assistant
;Made by: B@ndito
;Published for: ScriptUO.com
;Released on: 12/9/10
;-#=#=#=#=#=#=#=#=#=#=#=#-

;   ,,,,,,,,,,,,,,
;    IMPORTANT !
;   ''''''''''''''
;    1. Keep your backpack always opened.
;    2. Pet's health bar have NOT TO BE MOVED after running the setup
;        never cover it with other gumps .
;
;
;    Description:
;    ------------
;    # This script is meant to support my other scripts, so it's possible to use it along other scripts.
;      Keep in mind that even if it has been designed to work along other scripts, drag&drop can't be
;     checked when running parallel scripts and this could mess up something without proper checks.
;    # It can be easily used anyway as a standalone to heal a single pet
;      It mainly uses OCR to calculate percentile/quantity of pet's HP and heal it, using both bandages
;       and spells if choosen though not breaking any other cast
;

;=============================== S E T T I N G S ==================================

;--- AUTO-PATHFIND ---
;    choose if you want the script to pathfind to the pet if you are too distant for bandaging.
;    script will temporary control character movements to reach the pet

set %autopathfind #false   ;(#TRUE or #FALSE)

;--- HALING VARIABLES ---
;    choose HP % to start healings
;    NB: HP calculations may have a 3% error calculation
set %percentuale 75       ;suggested values for total hp (5 - 95%)
                          ;85: between 400 - 500 hp
                          ;75:between 300 - 400 hp

;    to heal poisoned pet ignoring HP%
set %curapoison #TRUE   ;(#TRUE o #FALSE)


; _ _ _ _ _ _OPTIONAL _ _ _ _ _ _ _

;    le seguenti variabili sono per le funzioni opzionali,
;    lasciale come di default se usi lo script insieme al Leather Farmer.

;---SPELL CASTING ---
;    Set #TRUE to cast spells along bandages
set  %Healwithspell #true ; DEFAULT: #FALSE

;    if %healwithspell #TRUE, choose the heal method (just type a number): 1 magery, 2 chivalry, 3 spellweaving
set  %healmethod 1

;--- PAUSE KEY ---
;    Set the pause key, you can leave it empty if not interested
;    Press again to begin again...
set %haltkey p

;--- RAZOR ---
;    if you want to use a razor macro tu heal, set to #true and type macro name
;    Useful if you use this script in parallel with other scripts.
set %razor #false
set %macrorazor macro1

;   END OF MANUAL SETUP

;=========================================================================================

;-----Script begins here don't modify further-----

;--------------|
gosub autosetup
;--------------|

  mainloop:
  gosub HealthbarScan %contposX %contposY %PetHP
  if %HP < %percentuale || %stato = 3 && %curapoison = #true || %stato = 1
      {
      gosub checkaids
      if #result = #true
          {
          if #targcurs = 1
             gosub waitcurs 0
          gosub pathfind
          gosub curapet
          }
      }
  onhotkey %haltkey
      {
      event SysMessage BTA script: paused
      wait 20
      pausa:
      onhotkey %haltkey
               {
               event SysMessage BTA script: playing
               goto mainloop
               }
      goto pausa
      }
  goto mainloop
;=============================================================================
sub curapet
cura:
  if %razor = #true
  {
  msg -macro , #spc , %macrorazor $
  wait 45
  return
  }
  namespace push
  namespace global action
  ;event sysmessage Pet health: %HP , %
  set !bendaPet #true
  if #targcurs = 1
     gosub waitcurs 0
  set #lObjectID %aids
  event Macro 17
  target 5s
  set #ltargetid %petid
  event macro 22

  if %Healwithspell = #true
     {
     gosub curespell
     goto ritorna
     }
  wait 45
  ritorna:
  namespace pop
return

;=======================================================
sub curespell

  if #targcurs = 1
     gosub waitcurs 0
  if %stato = 3
     goto trypoison
  if %healmethod = 1
          {
           event macro 15 28
           target
           set #ltargetid %petid
           event macro 22
          }
  if %healmethod = 2
          {
           event macro 15 202
           target
           set #ltargetid %petid
           event macro 22
          }
  if %healmethod = 3
          {
           event macro 15 602
           target
           set #ltargetid %petid
           event macro 22
          }
  trypoison:
  if %healmethod = 2
          {
           event macro 15 201
           target
           set #ltargetid %petid
           event macro 22
          }
  if %healmethod = 1
          {
           event macro 15 10
           target
           set #ltargetid %petid
           event macro 22
          }
return

;================================================
;wait for cursor not targeting, and returns a boolean
  sub waitcurs

  if %0 = 2
      set %waitTimeout #scnt2 + %2
  else
      set %waitTimeout #scnt2 + 500 ;valore in decimi di secondo (50s)
  while #targcurs <> %1
  {
  if #scnt2 > %waitTimeout
     return #false
  sleep 3
  }
  if %1 = 0
     wait 2

  return #true
;================================================
  sub HealthbarScan
  namespace push
  namespace local HealthbarScan , #SYSTIME
  set !lpc #lpc
  set #lpc 500
  set !a %1 + 37
  set %2 %2 + 43
  savepix !a %2 1
  set %1 n/a
  str pos 16229962\16229706\6502655\\6502911\\4894463\\4894207\\4390763 #pixcol
  if #strres <> 0
     set %stato #strres / 18
  set !mod 24
  repeat
  {
  set !mod ( !mod + 1 ) / 2
  set !sec !sec + !mod
  set !x ( 100 * ( !sec - 1 ) / 23 + 3 ) * 98 / 100 + !a
  savepix !x %2 1
  if #pixcol in 3746303\3221908\2695589\2695539\3741902\3744181\3217556\3217564\1579156\2173299\1052746\1579140\1577059\2166924\2166916\2691220\2166907\2166965\1054819\1577034\1579131\1577050\2168931
     set !sec !sec - !mod
  }
  until !mod = 1
  set %HP 100 * !sec / 24
  set #lpc !lpc
  namespace clear
  namespace pop
  return #result
;================================================
sub pathfind
  riprova:
  finditem %petid G_
  if #findkind = 1 && #finddist > 2
         {
         if %autopathfind = #true
            {
            set %pathTimeout #scnt2 + 60 ;6s
            event pathfind #findx #findy
            wait 3
            if You_are_frozen in #sysmsg
               {
               wait 2s
               goto riprova
               }
            while #charposx <> #findx || #charposy <> #findy
                  {
                  if #scnt2 > %pathTimeout
                     goto riprova
                  sleep 5
                  }
            }
         else
            {
              event sysmessage BTA Script: Too distant from the pet! Script waiting you move further...
              set %pathTimeout #scnt2 + 500 ;50s
              finditem %petid G_
              while #finddist > 2
                  {
                  if #scnt2 > %pathTimeout
                     return
                  sleep 5
                  finditem %petid G_
                  }
            }
         }
return
;================================================
  sub checkaids

  finditem ZLF C_ , #backpackid
  if #findstack = 0
    {
    event ExMsg #charID 2 38 Nessuna benda trovata!
    wait 3s
    return #false
    }
   if #findstack < 25 && #findcnt < 2
   event sysmessage BTA Script: WARNING! You have just #findstack bandages!
   set %aids #findid

  return #true

;================================================
  sub autosetup

  gosub checkaids
  if #result = #false
      {
       display ok you need bandages in your backpack $ restock and play again the script.
       halt
      }
  retarget:
  display ok Drag the pet's healthbar where you prefer, $
          + Remember NOT TO MOVE healthbar while executing $
          + $ You have 6 seconds.
  for %i 1 6
  {
  wait 1s
  event exmsg #charid 3 50 %i
  }

  if #contname <> status_gump
     {
     display ok Can't recognize health bar! $
             + If you are sure you had dragged the right bar $
             + close it to reset EUO's varables.
             + $ $ Click ok to repeat  $
     goto retarget
     }
     event exmsg #charid 3 73 Setup complete!
  set %petid #contid
  set %contposx #contposx
  set %contposy #contposy
  ;set %aidtime ( ( 11 - ( #dex / 20 ) ) * 10 )
  set #LPC 100

  return

Note: uses HealthbarScan sub by Laradel
« Last Edit: December 09, 2010, 09:10:26 AM by b@ndito »

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: B@ndito's tamer assistant
« Reply #1 on: December 09, 2010, 09:19:53 AM »
0
Looks well written. Thanks for your contribution.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: B@ndito's tamer assistant
« Reply #2 on: December 09, 2010, 09:42:41 AM »
0
Looks good.I will check it over later tonight after the game. Also i was reading the notations and comments and I can understand 90% of it and I dont speak italian but i do speak spanish and alot of the words are similar. Just thought I would throw that in.   8)

Offline b@nditoTopic starter

  • Jr. Member
  • **
  • Posts: 48
  • Activity:
    0%
  • Reputation Power: 0
  • b@ndito has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: B@ndito's tamer assistant
« Reply #3 on: December 12, 2010, 07:11:13 PM »
0
Looks well written. Thanks for your contribution.

thank you very much, i really enjoyed your taming appraiser :D

this script has been my first attempt using global namespaces in a script, if someone wants to use this as external healing for another script should be aware of.
« Last Edit: December 12, 2010, 07:16:21 PM by b@ndito »

Offline seexplosioN

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 1
  • seexplosioN has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: B@ndito's tamer assistant
« Reply #4 on: July 14, 2011, 10:29:10 AM »
0
It looks pretty, nice job :) Thing is; it bandaging pets too slow, its because of OCR I guess. If you can make it faster, it will be excellent :)

Tags: