EasyUO Scripts

Don't know how something works? Here you will find some useful links. And if you have a question, feel free to ask.
Locked
Mandown
Adept Scribe
Posts: 41
Joined: Fri Sep 10, 2010 10:38 am

EasyUO Scripts

Post by Mandown »

I remember someone mentioning they had a easy uo script for beehives. Can anyone post one if they do that works? Extracting honey kills my hands to much clicking. Also if anyone has a fishing script for just casting the reel in the direction i am facing that would be great too. Just trying cut down on clicking on the things that I do.
User avatar
Thorgal
Legendary Scribe
Posts: 238
Joined: Mon Aug 23, 2010 8:14 am

Re: EasyUO Scripts

Post by Thorgal »

It was me and sorry, never got around to it ( forgot )!

For this script you will need a water through, water pitcher, kegs of course, bee hive tools and empty bottles! All in a secured container, all but the water through! Hehe...obviously!

If you cant make it run or seet it just pm me i.g. i will give you a hand!

So there you go

Code: Select all

linespercycle 10000

set %knowncol _5911015_59367_3270631_13024701_15724502_6375_524288_59160__4340025_4337969_3748145_3746089_3221801_4342338_2695457_2171169_

set %fbp C_ , #backpackid

set %potion_xplant 220
set %potion_xbee 210

set %potion_yagilitybee 55
set %potion_msgagility Agilitying...
set %potion_msgcolagility 194
set %potion_typeagility YUF

set %potion_ypoisonplant 100
set %potion_ypoisonbee 80
set %potion_msgpoison Poisoning...
set %potion_msgcolpoison 70
set %potion_typepoison AVF

set %potion_ycureplant 124
set %potion_ycurebee 105
set %potion_msgcure Curing...
set %potion_msgcolcure 41
set %potion_typecure NUF

set %potion_yhealplant 148
set %potion_yhealbee 130
set %potion_msgheal Healing...
set %potion_msgcolheal 55
set %potion_typeheal UUF

set %potion_ystrengthplant 172
set %potion_ystrengthbee 155
set %potion_msgstrength Strengthening...
set %potion_msgcolstrength 0
set %potion_typestrength XUF

if *care_plantations <> N/A
{
  set %str *care_plantations
  loadvar:
  str pos %str |
  if #strres > 0
  {
    set %pos #strres - 1
    str left %str %pos
    set %vname #strres
    set %pos %pos + 2
    str pos %str | 2
    set %len #strres - %pos
    if %len > 0
    {
      str mid %str %pos %len
      set % . %vname #strres
    }
    else
    {
      set % . %vname
    }
    set %pos %pos + %len + 1
    str len %str
    str mid %str %pos #strres
    set %str #strres
    goto loadvar
  }
}
else
{
  set %plantation_count 0
  set %plantation_num 0
}

set %act_timer #systime

drawinterface:

menu clear
menu window size 420 340
menu window title Plant and beehive caring helper
menu font bgcolor btnface
menu text t1 15 10 Plantations
menu text t2 125 10 Plants/Beehives
menu text t2 235 10 Settings for plantation %plantation_num
menu button selectplantation 10 240 100 25 Select
menu button addplantation 10 270 100 25 Add
menu button delplantation 10 300 100 25 Remove
menu button showplant 120 240 100 25 Show
menu button addplant 120 270 100 25 Add
menu button delplant 120 300 100 25 Remove
menu button settoolcont 230 30 180 25 Set container with the tools
menu button setwaterthrough 230 60 180 25 Set water through
menu button disposetools 230 210 180 25 Put tools in container
menu button care 230 240 180 85 CARE ( plantation %plantation_num )
menu font bgcolor white
menu list create plantations 10 30 100 200
menu list create plants 120 30 100 200
menu show

gosub savevars

set %i 1
while %i <= %plantation_count
{
  menu list add plantations %i
  set %i %i + 1
}

if %plantation_num > 0 && %plantation_num <= %plantation_count
{
  set %i 1
  while %i <= %plant_count . %plantation_num
  {
    set %index %plantation_num , _ , %i
    menu list add plants %plant_id . %index
    set %i %i + 1
  }
}

set #menubutton 0

scanbuttons:

if #menubutton = closed
  halt

if #menubutton = selectplantation
{
  menu get plantations
  if #menures > 0 && #menures <= %plantation_count
  {
    set %plantation_num #menures
    goto drawinterface
  }
  else
  {
    display ok Select a plantation from the list first, or press Add to make a new plantation.
  }
  set #menubutton 0
}

if #menubutton = addplantation
{
  set %plantation_count %plantation_count + 1
  set %plant_count . %plantation_count 0
  set %toolcont_x . %plantation_count 0
  set %toolcont_y . %plantation_count 0
  set %toolcont_z . %plantation_count 0
  set %toolcont_id . %plantation_count 0
  set %waterthrough_x . %plantation_count 0
  set %waterthrough_y . %plantation_count 0
  set %waterthrough_z . %plantation_count 0
  set %waterthrough_id . %plantation_count 0
  set %plantation_num %plantation_count
  goto drawinterface
}

if #menubutton = delplantation
{
  menu list get plantations
  if #menures > 0 && #menures <= %plantation_count
  {
    display yesno Are you sure you want to remove plantation #menures with all its plants from the list?
    if #dispres = yes
    {
      goto drawinterface ;todo
    }
  }
  else
  {
    display ok Select a plantation from the list first.
  }
  set #menubutton 0
}

if #menubutton = showplant
{
  if %plantation_num > 0
  {
    menu get plants
    if #menures > 0 && #menures <= %plant_count . %plantation_num
    {
      set %index %plantation_num , _ , #menures
      set %plant_id %plant_id . %index
      set %plant_x %plant_x . %index
      set %plant_y %plant_y . %index
      set %plant_z %plant_z . %index
      event exmsg %plant_id 0 0 Here!
      gosub getto %plant_x %plant_y %plant_z
    }
    else
    {
      display ok Select a plant first.
    }
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = addplant
{
  if %plantation_num > 0
  {
    display ok Stand near the plant or a beehive, and target it. Press Esc to finish.
    targetplant:
    set #targcurs 1
    while #targcurs = 1
    {
      onhotkey Esc
        goto drawinterface
    }
    finditem #ltargetid
    if #findtype <> OOD
    {
      event property #ltargetid
      if bowl notin #property && plant notin #property
      {
        event exmsg #ltargetid 0 1199 Wrong object type
        goto targetplant
      }
    }
    if %plant_count . %plantation_num > 0
    {
      for %i 1 %plant_count . %plantation_num
      {
        set %index %plantation_num , _ , %i
        if %plant_id . %index = #ltargetid
        {
          set %plant_x . %index #charposx
          set %plant_y . %index #charposy
          set %plant_z . %index #charposz
          event exmsg #ltargetid 0 1199 New location stored
          goto targetplant
        }
      }
    }
    set %plant_count . %plantation_num %plant_count . %plantation_num + 1
    set %index %plantation_num , _ , %plant_count . %plantation_num
    set %plant_x . %index #charposx
    set %plant_y . %index #charposy
    set %plant_z . %index #charposz
    set %plant_id . %index #ltargetid
    event exmsg #ltargetid 0 0 ok
    goto targetplant
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = delplant
{
  if %plantation_num > 0
  {
    menu get plants
    if #menures > 0 && #menures <= %plant_count . %plantation_num
    {
      display yesno Are you sure you want to remove the plant from plantation list?
      if #dispres = yes
      {
        set %start #menures
        set %plant_count %plant_count . %plantation_num - 1
        if %start >= %plant_count
        {
          for %i %start %plant_count
          {
            set %index1 %plantation_num , _ , %i
            set %j %i + 1
            set %index2 %plantation_num , _ , %j
            set %plant_x . %index_1 %plant_x . %index_2
            set %plant_y . %index_1 %plant_y . %index_2
            set %plant_z . %index_1 %plant_z . %index_2
            set %plant_id . %index_1 %plant_id . %index_2
          }
        }
        set %plant_count . %plantation_num %plant_count
        goto drawinterface
      }
    }
    else
    {
      display ok Select a plant first.
    }
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = settoolcont
{
  if %plantation_num > 0
  {
    display ok Stand near the tool container, and target it. Press Esc to cancel.
    set #targcurs 1
    while #targcurs = 1
    {
      onhotkey Esc
        goto drawinterface
    }
    set %toolcont_x . %plantation_num #charposx
    set %toolcont_y . %plantation_num #charposy
    set %toolcont_z . %plantation_num #charposz
    set %toolcont_id . %plantation_num #ltargetid
    event exmsg #ltargetid 0 0 ok
    goto drawinterface
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = setwaterthrough
{
  if %plantation_num > 0
  {
    display ok Stand near the waterthrough, and target it. Press Esc to cancel.
    set #targcurs 1
    while #targcurs = 1
    {
      onhotkey Esc
        goto drawinterface
    }
    set %waterthrough_x . %plantation_num #charposx
    set %waterthrough_y . %plantation_num #charposy
    set %waterthrough_z . %plantation_num #charposz
    set %waterthrough_id . %plantation_num #ltargetid
    event exmsg #ltargetid 0 0 ok
    goto drawinterface
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = care
{
  if %plantation_num > 0
  {
    menu hide
    display ok Press OK to begin. Do NOT switch to another window or let any window cover the UO client. Hold Esc to interrupt the care.
    gosub care normal
    if #result = 1
    {
      display ok Care finished.
    }
    else
    {
      display ok Care interrupted.
    }
    menu show
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

if #menubutton = disposetools
{
  if %plantation_num > 0
  {
    gosub care disposetools
  }
  else
  {
    display ok Select a plantation first.
  }
  set #menubutton 0
}

goto scanbuttons

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub care ; mode

set %care_mode %1
set %plant_count %plant_count . %plantation_num
set %toolcont_x %toolcont_x . %plantation_num
set %toolcont_y %toolcont_y . %plantation_num
set %toolcont_z %toolcont_z . %plantation_num
set %toolcont_id %toolcont_id . %plantation_num
set %waterthrough_x %waterthrough_x . %plantation_num
set %waterthrough_y %waterthrough_y . %plantation_num
set %waterthrough_z %waterthrough_z . %plantation_num
set %waterthrough_id %waterthrough_id . %plantation_num

if %care_mode = disposetools
  goto care_disposetools

gosub gettools
if #result = 0
  return 0

set %plant_num 1
while %plant_num <= %plant_count
{
  set %index %plantation_num , _ , %plant_num
  set %plant_id %plant_id . %index
  set %plant_x %plant_x . %index
  set %plant_y %plant_y . %index
  set %plant_z %plant_z . %index
  gosub careitem
  if #result = 0
    return 0
  set %plant_num %plant_num + 1
}

care_disposetools:
gosub disposetools

return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub careitem

set #result 0
analyze_plant:
if #result = -1
  return 0

gosub getto %plant_x %plant_y %plant_z
if #result = 0
  return 0

event exmsg %plant_id 0 101 Scanning...

; close all plant gumps
while #contkind = GJZ && ( #contsize = 263_231 || #contsize = 255_231 || #contsize = 258_219 || #contsize = 250_219 )
{
  set %mx #contposx + 100
  set %my #contposy + 100
  click %mx %my r
}

useplant:
; use the plant
set #lobjectid %plant_id
gosub actwait
event macro 17 0

; wait for gump
set %timer #systime + 5000
while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 258_219 ) ) && #systime < %timer
{
  onhotkey Esc
    return 0
}

if #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 258_219 )
  goto useplant

set %contx #contposx
set %conty #contposy

set %plant_type 0
if #contsize = 263_231
{
  set %plant_type plant
}
else
{
  if #contsize = 258_219
  {
    set %plant_type bee
  }
  else
  {
    goto analyze_plant
  }
}

gosub actset 1000

; analyze plant health
event property %plant_id
if vibrant in #property || thriving in #property
  set %plant_health 4
if healthy in #property
  set %plant_health 3
if wilted in #property || sickly in #property
  set %plant_health 2
if dying in #property
  set %plant_health 1
if vibrant notin #property && healthy notin #property && wilted notin #property && sickly notin #property && dying notin #property && thriving notin #property
  set %plant_health 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

if %plant_type = plant ; PLANT CARE
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ; analyze plant water
  gosub analyze_plusminus 198 77
  set %plant_water #result
  if #result = error
    goto analyze_plant

  ; analyze plant infestation
  gosub analyze_plusminus 98 101
  set %plant_infestation #result
  if #result = error
    goto analyze_plant

  ; analyze plant fungi
  gosub analyze_plusminus 98 125
  set %plant_fungi #result
  if #result = error
    goto analyze_plant

  ; analyze plant poisoning
  gosub analyze_plusminus 98 149
  set %plant_poisoning #result
  if #result = error
    goto analyze_plant

  ; analyze plant desease
  gosub analyze_plusminus 98 153
  set %plant_desease #result
  if #result = error
    goto analyze_plant

  ; analyze poison potions
  gosub analyze_number 202 98
  set %plant_poison #result
  if #result = error
    goto analyze_plant

  ; analyze cure potions
  gosub analyze_number 202 122
  set %plant_cure #result
  if #result = error
    goto analyze_plant

  ; analyze heal potions
  gosub analyze_number 202 146
  set %plant_heal #result
  if #result = error
    goto analyze_plant

  ; analyze strength potions
  gosub analyze_number 202 170
  set %plant_strength #result
  if #result = error
    goto analyze_plant


 ; display ok %plant_water %plant_infestation %plant_fungi %plant_poisoning %plant_desease $ %plant_poison %plant_cure %plant_heal %plant_strength

  ; perform care
  while %plant_water < 0
  {
    gosub water
    if #result <= 0
      goto analyze_plant
    set %plant_water %plant_water + 1
  }
  
  if %plant_health = 0
    goto nohealth

  while %plant_poison < %plant_infestation
  {
    gosub potion poison
    if #result <= 0
      goto analyze_plant
    set %plant_poison %plant_poison + 1
  }

  while %plant_cure < %plant_fungi
  {
    gosub potion cure
    if #result <= 0
      goto analyze_plant
    set %plant_cure %plant_cure + 1
  }

  while %plant_heal < %plant_poisoning + %plant_desease + ( 4 - %plant_health )
  {
    gosub potion heal
    if #result <= 0
      goto analyze_plant
    set %plant_heal %plant_heal + 1
  }

  while %plant_strength < %plant_water
  {
    gosub potion strength
    if #result <= 0
      goto analyze_plant
    set %plant_strength %plant_strength + 1
  }
  ; wait for pending gumps
  set %timer #systime + 10000
  while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 255_231 && #contsize <> 258_219 && #contsize <> 250_219 ) ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  if ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 255_231 && #contsize <> 258_219 && #contsize <> 250_219 ) )
    goto analyze_plant
  ; go to the harvesting gump if neccessary
  set %mx %contx + 80
  set %my %conty + 75
  click %mx %my
  set %timer #systime + 5000
  while ( #contkind <> GJZ || #contsize <> 255_231 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }

  if ( #contkind <> GJZ || #contsize <> 255_231 )
    goto analyze_plant

  set %contx #contposx
  set %conty #contposy

  set %plant_resources 1
  set %mx %contx + 145
  set %my %conty + 170
  set %ji #jindex + 1
  getresources:
  click %mx %my
  set %timer #systime + 5000
  while ( #contkind <> GJZ || #contsize <> 255_231 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  if ( #contkind <> GJZ || #contsize <> 255_231 )
    goto analyze_plant
  while %ji <= #jindex
  {
    scanjournal %ji
    if this_plant_has_no_resources_to_gather in #journal
      set %plant_resources 0
    set %ji %ji + 1
  }
  if %plant_resources = 1
    goto getresources

  set %plant_seeds 1
  set %mx %contx + 225
  set %my %conty + 170
  set %ji #jindex + 1
  getseeds:
  click %mx %my
  set %timer #systime + 5000
  while ( #contkind <> GJZ || #contsize <> 255_231 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  if ( #contkind <> GJZ || #contsize <> 255_231 )
    goto analyze_plant
  while %ji <= #jindex
  {
    scanjournal %ji
    if this_plant_has_no_seeds_to_gather in #journal
      set %plant_seeds 0
    set %ji %ji + 1
  }
  if %plant_seeds = 1
    goto getseeds
  noharvest:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
else ; BEEHIVE CARE
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ; analyze beehive infestation
  gosub analyze_plusminus 84 80
  set %plant_infestation #result
  if #result = error
    goto analyze_plant

  ; analyze beehive desease
  gosub analyze_plusminus 84 105
  set %plant_desease #result
  if #result = error
    goto analyze_plant

  ; analyze beehive water
  gosub analyze_plusminus 84 130
  set %plant_water 0 ;todo #result
  if #result = error
    goto analyze_plant

  ; analyze beehive flowers
  gosub analyze_plusminus 84 154
  set %plant_flowers 0 ;todo #result
  if #result = error
    goto analyze_plant

  ; analyze agility potions
  gosub analyze_number 196 54
  set %plant_agility #result
  if #result = error
    goto analyze_plant

  ; analyze poison potions
  gosub analyze_number 196 80
  set %plant_poison #result
  if #result = error
    goto analyze_plant

  ; analyze cure potions
  gosub analyze_number 196 104
  set %plant_cure #result
  if #result = error
    goto analyze_plant

  ; analyze heal potions
  gosub analyze_number 196 130
  set %plant_heal #result
  if #result = error
    goto analyze_plant

  ; analyze strength potions
  gosub analyze_number 196 154
  set %plant_strength #result
  if #result = error
    goto analyze_plant

  ; display ok %plant_infestation %plant_desease %plant_water %plant_flowers $ %plant_agility %plant_poison %plant_cure %plant_heal %plant_strength
  ; perform care

  if %plant_health = 0
    goto nohealth

  while %plant_poison < 0 - %plant_infestation
  {
    gosub potion poison
    if #result <= 0
      goto analyze_plant
    set %plant_poison %plant_poison + 1
  }

  while %plant_cure < %plant_poison + %plant_infestation - %plant_desease
  {
    gosub potion cure
    if #result <= 0
      goto analyze_plant
    set %plant_cure %plant_cure + 1
  }

  while %plant_heal < ( 4 - %plant_health )
  {
    gosub potion heal
    if #result <= 0
      goto analyze_plant
    set %plant_heal %plant_heal + 1
  }

  while %plant_strength < 0 + %plant_water + %plant_flowers
  {
    gosub potion strength
    if #result <= 0
      goto analyze_plant
    set %plant_strength %plant_strength + 1
  }

  while %plant_agility < 2 + %plant_water - %plant_flowers
  {
    gosub potion agility
    if #result <= 0
      goto analyze_plant
    set %plant_agility %plant_agility + 1
  }
  
  event exmsg %plant_id 0 0 Harvesting...
  findbeetool:
  finditem RRD %fbp
  if #findcnt = 0
  {
    event exmsg #charid 0 1199 Getting beehive tool...
    gosub gettools
    if #result = 0
      return 0
    goto findbeetool
  }
  ; wait for pending gumps
  set %timer #systime + 10000
  while ( #contkind <> GJZ || #contsize <> 258_219 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  if ( #contkind <> GJZ || #contsize <> 258_219 )
    goto analyze_plant
  set %mx %contx + 65
  set %my %conty + 55
  click %mx %my

  set %timer #systime + 10000
  while ( #contkind <> GJZ || #contsize <> 250_219 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }

  set %ji #jindex + 1
  gethoney:
  if ( #contkind <> GJZ || #contsize <> 250_219 )
    goto analyze_plant
  set %mx %contx + 210
  set %my %conty + 160
  click %mx %my
  set %timer #systime + 10000
  while ( #contkind <> GJZ || #contsize <> 250_219 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  while %ji <= #jindex
  {
    scanjournal %ji
    if enough_honey_in_the_hive in #journal
      goto getwaxstart
    if you_need_a_bottle in #journal
    {
      event exmsg #charid 0 1199 Getting empty bottles...
      gosub gettools
      if #result = 0
        return 0
      goto analyze_plant
    }
    if you_need_a_hive_tool in #journal
    {
      event exmsg #charid 0 1199 Getting beehive tool...
      gosub gettools
      if #result = 0
        return 0
      goto analyze_plant
    }
    set %ji %ji + 1
  }
  goto gethoney
  
  getwaxstart:

  set %timer #systime + 10000
  while ( #contkind <> GJZ || #contsize <> 250_219 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  ;if ( #contkind <> GJZ || #contsize <> 250_219 )
  ;  goto analyze_plant
  ;set %mx %contx + 130
  ;set %my %conty + 105
  ; see if there's more than 99 wax, by searching the pixels around third digit position
  ;scanwaxnum:
  ;gosub scanpix %mx %my
  ;if #result = error
  ;  goto analyze_plant
  ;if #result = 15724502
  ;  goto getwax
  ;set %mx %mx + 1
  ;if %mx > %contx + 142
  ;  goto nowax
  ;goto scanwaxnum
  set %ji #jindex + 1
  getwax:
  if ( #contkind <> GJZ || #contsize <> 250_219 )
    goto analyze_plant
  set %mx %contx + 65
  set %my %conty + 160
  click %mx %my
  set %timer #systime + 10000
  while ( #contkind <> GJZ || #contsize <> 250_219 ) && #systime < %timer
  {
    onhotkey Esc
      return 0
    while %ji <= #jindex
    {
      scanjournal %ji
      if enough_excess_wax_in_the_hive in #journal
        goto hiveharvestcomplete
      if not_enough_room_in_your_backpack in #journal
      {
        event exmsg #charid 0 1199 Unloading resources...
        gosub gettools
        if #result = 0
          return 0
        goto analyze_plant
      }
      if you_need_a_hive_tool in #journal
      {
        event exmsg #charid 0 1199 Getting beehive tool...
        gosub gettools
        if #result = 0
          return 0
        goto analyze_plant
      }
      set %ji %ji + 1
    }
  }
  while %ji <= #jindex
  {
    scanjournal %ji
    if enough_excess_wax_in_the_hive in #journal
      goto hiveharvestcomplete
    if not_enough_room_in_your_backpack in #journal
    {
      event exmsg #charid 0 1199 Unloading resources...
      gosub gettools
      if #result = 0
        return 0
      goto analyze_plant
    }
    if you_need_a_hive_tool in #journal
    {
      event exmsg #charid 0 1199 Getting beehive tool...
      gosub gettools
      if #result = 0
        return 0
      goto analyze_plant
    }
    set %ji %ji + 1
  }
  goto getwax
  nowax:
}

nohealth:

; wait for pending gumps
set %timer #systime + 10000
while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 255_231 && #contsize <> 258_219 && #contsize <> 250_219 ) ) && #systime < %timer
{
  onhotkey Esc
    return 0
}

; the last wax harvested results in beehive gump closing, so no need to wait for it
hiveharvestcomplete:

; close all plant gumps
while #contkind = GJZ && ( #contsize = 263_231 || #contsize = 255_231 || #contsize = 258_219 || #contsize = 250_219 )
{
  set %mx #contposx + 100
  set %my #contposy + 100
  click %mx %my r
}


return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub water

event exmsg %plant_id 0 101 Watering...
findwaterpitcher:
finditem _VBM_WYF_ %fbp
if #findcnt = 0
{
  ; wait for pending gumps
  set %timer #systime + 10000
  while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 255_231 && #contsize <> 258_219 && #contsize <> 250_219 ) ) && #systime < %timer
  {
    onhotkey Esc
      return -1
  }
  ; close all plant gumps
  while #contkind = GJZ && ( #contsize = 263_231 || #contsize = 255_231 || #contsize = 258_219 || #contsize = 250_219 )
  {
    set %mx #contposx + 100
    set %my #contposy + 100
    click %mx %my r
  }
  event exmsg #charid 0 1199 Getting water pitcher...
  gosub gettools
  if #result = 0
    return -1
  goto findwaterpitcher
}
set %pitcher_id #findid
set %pitcher_type #findtype
if %pitcher_type = WYF
{
  event exmsg #charid 0 1199 Getting water...
  gotowaterthrough:
  gosub getto %waterthrough_x %waterthrough_y %waterthrough_z
  if #result = 0
    return -1
  set #lobjectid %pitcher_id
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #targcurs = 0 && #systime < %timer
  {
    onhotkey Esc
      return -1
  }
  if #targcurs = 0
    goto gotowaterthrough
  set #ltargetid %waterthrough_id
  set #ltargetkind 1
  event macro 22 0
  gosub actset 1000
  wait 5
  goto findwaterpitcher
}

gosub getto %plant_x %plant_y %plant_z
if #result = 0
  return -1

set %timer #systime + 1000
while ( #contkind <> GJZ || #contsize <> 263_231 ) && #systime < %timer
{
  onhotkey Esc
    return -1
}

if #contkind <> GJZ || #contsize <> 263_231
  return 0

set %mx %contx + 225
set %my %conty + 75
gosub actwait
click %mx %my
set %timer #systime + 5000
while #targcurs = 0 && #systime < %timer
{
  onhotkey Esc
    return -1
}
if #targcurs = 0
  return 0
set #ltargetid %pitcher_id
set #ltargetkind 1
set %ji #jindex + 1
event macro 22 0
set %timer #systime + 5000
while #systime < %timer
{
  while %ji <= #jindex
  {
    scanjournal %ji
    if water in #journal
    {
      gosub actset 1000
      return 1
    }
    set %ji %ji + 1
  }
}

return 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub potion ; type

set %potion %1
set %potion_msg %potion_msg . %potion
set %potion_msgcol %potion_msgcol . %potion
set %potion_type %potion_type . %potion
event exmsg %plant_id 0 %potion_msgcol %potion_msg
ignoreitem reset
findpotion:
finditem %potion_type %fbp
if #findcnt = 0
{
  ; wait for pending gumps
  set %timer #systime + 10000
  while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 255_231 && #contsize <> 258_219 && #contsize <> 250_219 ) ) && #systime < %timer
  {
    onhotkey Esc
      return -1
  }
  ; close all plant gumps
  while #contkind = GJZ && ( #contsize = 263_231 || #contsize = 255_231 || #contsize = 258_219 || #contsize = 250_219 )
  {
    set %mx #contposx + 100
    set %my #contposy + 100
    click %mx %my r
  }
  event exmsg %char_id 0 1199 Getting potions...
  gosub gettools
  if #result = 0
    return -1
  goto findpotion
}
event property #findid
if greater notin #property
{
  ignoreitem #findid
  goto findpotion
}
gosub getto %plant_x %plant_y %plant_z
if #result = 0
  return -1
set %timer #systime + 1000
while ( #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 258_219 ) ) && #systime < %timer
{
  onhotkey Esc
    return -1
}
if #contkind <> GJZ || ( #contsize <> 263_231 && #contsize <> 258_219 )
  return 0
set %mx %contx + %potion_x . %plant_type
set %index %potion , %plant_type
set %my %conty + %potion_y . %index
set %ji #jindex + 1

gosub actwait
click %mx %my
set %timer #systime + 5000
while #systime < %timer
{
  while %ji <= #jindex
  {
    scanjournal %ji
    if pour_the_potion in #journal || soaked in #journal
    {
      gosub actset 1000
      return 1
    }
    set %ji %ji + 1
  }
}

return 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub gettools
  set %eb_top 30
  set %wp_top 1
  set %bt_top 2
  set %agi_top 6
  set %poi_top 4
  set %cur_top 4
  set %hel_top 1
  set %str_top 0
  ; open the backpack
  openbp:
  set #lobjectid #backpackid
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #contid <> #backpackid && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  gosub actset 1000
  if #contid <> #backpackid
    goto openbp

  counttools:

  gosub cnt WUF %fbp
  set %eb_count #result
  gosub cnt _VBM_WYF_ %fbp
  set %wp_count #result
  gosub cnt RRD %fbp
  set %bt_count #result

  opentc:
  gosub getto %toolcont_x %toolcont_y %toolcont_z
  if #result = 0
    return 0
  set #lobjectid %toolcont_id
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #contid <> %toolcont_id && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  gosub actset 1000
  if #contid <> %toolcont_id
    goto opentc

  set %ftc C_ , %toolcont_id

  findmorespoils:
  finditem _KRD_ETH_ %fbp
  if #findcnt > 0
  {
    gosub actwait
    if #findstack > 0
    {
      exevent drag #findid #findstack
    }
    else
    {
      exevent drag #findid
    }
    gosub actset 800
    gosub actwait
    exevent dropc %toolcont_id
    gosub actset 800
    goto findmorespoils
  }

  if %wp_count >= %wp_top && %eb_count >= %eb_top && %bt_count >= %bt_top
    goto countpotions

  gosub cnt WUF %ftc
  set %eb_stock #result

  gosub cnt _VBM_WYF_ %ftc
  set %wp_stock #result

  gosub cnt RRD %ftc
  set %bt_stock #result

  if %wp_stock + %wp_count < %wp_top || %eb_stock + %eb_count < %eb_top || %bt_stock + %bt_count < %bt_top
  {
    event exmsg %toolcont_id 0 1199 Not enough tools. Please restock.
    return 0
  }

  gosub mov WUF %ftc #backpackid %eb_count %eb_top
  if #result = 1
    goto counttools
  gosub mov _VBM_WYF_ %ftc #backpackid %wp_count %wp_top
  if #result = 1
    goto counttools
  gosub mov RRD %ftc #backpackid %bt_count %bt_top
  if #result = 1
    goto counttools

  countpotions:
  gosub cnt YUF %fbp
  set %agi_cnt #result
  gosub cnt AVF %fbp
  set %poi_cnt #result
  gosub cnt NUF %fbp
  set %cur_cnt #result
  gosub cnt UUF %fbp
  set %hel_cnt #result
  gosub cnt XUF %fbp
  set %str_cnt #result
  
  if %agi_cnt < %agi_top || %poi_cnt < %poi_top || %cur_cnt < %cur_top || %hel_cnt < %hel_top || %str_cnt < %str_top
  {

    finditem QMJ %ftc
    if #findcnt > 0
    {
      for #findindex 1 #findcnt
      {
        event property #findid
        set #result 1
        while greater , #spc , agility in #property && %agi_cnt < %agi_top && #result = 1
        {
          gosub usekeg #findid
          set %agi_cnt %agi_cnt + 1
        }
        while greater , #spc , poison in #property && %poi_cnt < %poi_top && #result = 1
        {
          gosub usekeg #findid
          set %poi_cnt %poi_cnt + 1
        }
        while greater , #spc , cure in #property && %cur_cnt < %cur_top && #result = 1
        {
          gosub usekeg #findid
          set %cur_cnt %cur_cnt + 1
        }
        while greater , #spc , heal in #property && %hel_cnt < %hel_top && #result = 1
        {
          gosub usekeg #findid
          set %hel_cnt %hel_cnt + 1
        }
        while greater , #spc , strength in #property && %str_cnt < %str_top && #result = 1
        {
          gosub usekeg #findid
          set %str_cnt %str_cnt + 1
        }
        if #result = 0
          return 0
      }
    }
    goto counttools
  }

return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub disposetools

  ; open the backpack
  openbp:
  set #lobjectid #backpackid
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #contid <> #backpackid && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  gosub actset 1000
  if #contid <> #backpackid
    goto openbp

  opentc:
  gosub getto %toolcont_x %toolcont_y %toolcont_z
  if #result = 0
    return 0
  set #lobjectid %toolcont_id
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #contid <> %toolcont_id && #systime < %timer
  {
    onhotkey Esc
      return 0
  }
  gosub actset 1000
  if #contid <> %toolcont_id
    goto opentc

  set %ftc C_ , %toolcont_id
  
  gosub actwait
  set %potid
  findmorepotions:
  finditem _YUF_AVF_NUF_UUF_XUF_ %fbp
  if #findcnt > 0
  {
    set %potid #findid
    set %pottype #findtype
    if %pottype = YUF
      set %pottype agility
    if %pottype = AVF
      set %pottype poison
    if %pottype = NUF
      set %pottype cure
    if %pottype = UUF
      set %pottype heal
    if %pottype = XUF
      set %pottype strength

    finditem QMJ %ftc
    if #findcnt > 0
    {
      for #findindex 1 #findcnt
      {
        event property #findid
        if greater , #spc , %pottype in #property || empty in #property
        {
          gosub actwait
          exevent drag %potid
          gosub actset 800
          gosub actwait
          exevent dropc #findid
          gosub actset 800
        }
      }
    }
    ignoreitem %potid
    goto findmorepotions
  }

  findmoretools:
  finditem _VBM_WYF_WUF_RRD_KRD_ETH_PDF_ %fbp
  if #findcnt > 0
  {
    gosub actwait
    if #findstack > 0
    {
      exevent drag #findid #findstack
    }
    else
    {
      exevent drag #findid
    }
    gosub actset 800
    gosub actwait
    exevent dropc %toolcont_id
    gosub actset 800
    goto findmoretools
  }

return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub cnt ; type cont
  set %type %1
  set %fcnt %2
  set %cnt 0
  gosub actwait
  finditem %type %fcnt
  if #findcnt > 0
  {
    for #findindex 1 #findcnt
    {
      if #findstack > 0
        set %cnt %cnt + #findstack
      else
        set %cnt %cnt + 1
    }
  }
return %cnt

sub mov ; type fcont dcont curcnt topcnt
  set %type %1
  set %fcnt %2
  set %dcnt %3
  set %cnt %4
  set %tcnt %5
  if %cnt < %tcnt
  {
    gosub actwait
    finditem %type %fcnt
    if #findcnt > 0
    {
      set %drag %tcnt - %cnt
      gosub actwait
      if %drag > #findstack
      {
        if #findstack > 0
          exevent drag #findid #findstack
        else
          exevent drag #findid
      }
      else
      {
        exevent drag #findid %drag
      }
      gosub actset 800
      gosub actwait
      exevent dropc %dcnt
      gosub actset 800
    }
    return 1
  }
return 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub usekeg ; id
  set %kegid %1
  usekegagain:

  set #lobjectid %kegid
  set %ji #jindex + 1
  gosub actwait
  event macro 17 0
  set %timer #systime + 5000
  while #systime < %timer
  {
    while %ji <= #jindex
    {
      scanjournal %ji
      if keg_is_empty in #journal
      {
        gosub actset 1000
        return 0
      }
      if you_pour_some in #journal
      {
        gosub actset 1000
        return 1
      }
      onhotkey Esc
        return 0
      set %ji %ji + 1
    }
  }
  
  goto usekegagain

return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub scanpix ; x y
  set %bx %1
  set %by %2
  set %timer #systime + 5000
  repeat
    savepix %ax %ay 1
    ;if #pixcol = 5911015 || #pixcol = 59367 || #pixcol = 3270631 || #pixcol = 13024701 || #pixcol = 15724502
    ;  return #pixcol
    if _ , #pixcol , _ in %knowncol
      return #pixcol
  until #systime > %timer
  ;if _ , #pixcol , _ notin %knowncol
  ;  set %knowncol %knowncol , #pixcol , _
return error

sub analyze_plusminus ; x y

set %ax %1 + %contx
set %ay %2 + %conty
gosub scanpix %ax %ay
set %c1 #result
set %ay %ay - 2
gosub scanpix %ax %ay
set %c2 #result
if %c1 = error || %c2 = error
  return error
if %c1 = 59160 || %c2 = 59160
  return -2
if %c1 = 6375 && %c2 = 6375
  return -1
if %c2 = 5911015
  return 2
if %c2 = 59367 || %c2 = 3270631
  return 1
if %c1 = 59367 || %c1 = 3270631
  return -1
if %c1 = 5911015
  return -2
if %c1 = 6375
  return -2

return 0

sub analyze_number ; x y

set %ax %1 + %contx
set %ay %2 + %conty
gosub scanpix %ax %ay
set %c1 #result
set %ay %ay + 4
gosub scanpix %ax %ay
set %c2 #result
if %c1 = error || %c2 = error
  return error
if ( %c1 = 13024701 || %c1 = 15724502 ) && ( %c2 = 13024701 || %c2 = 15724502 )
  return 0
if ( %c1 = 13024701 || %c1 = 15724502 )
  return 2
return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub getto ; x y z

set %getto_x %1
set %getto_y %2
set %getto_z %3

set %timer #systime
while #charposx <> %getto_x || #charposy <> %getto_y || #charposz <> %getto_z
{
  if #systime >= %timer
  {
    event pathfind %getto_x %getto_y %getto_z
    set %timer #systime + 5000
  }
  onhotkey Esc
    return 0
}

return 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub actwait

while #systime < %act_timer
  wait 1

return

sub actset ; cooldown

set %act_timer #systime + %1

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sub savevars
  set *care_plantations
  set *care_plantations *care_plantations , plantation_count , | , %plantation_count , |
  set *care_plantations *care_plantations , plantation_num , | , %plantation_num , |
  if %plantation_count > 0
  {
    for %i 1 %plantation_count
    {
      set %plant_count %plant_count . %i
      set %toolcont_x %toolcont_x . %i
      set %toolcont_y %toolcont_y . %i
      set %toolcont_z %toolcont_z . %i
      set %toolcont_id %toolcont_id . %i
      set %waterthrough_x %waterthrough_x . %i
      set %waterthrough_y %waterthrough_y . %i
      set %waterthrough_z %waterthrough_z . %i
      set %waterthrough_id %waterthrough_id . %i
      set *care_plantations *care_plantations , plant_count , %i , | , %plant_count , |
      set *care_plantations *care_plantations , toolcont_x , %i , | , %toolcont_x , |
      set *care_plantations *care_plantations , toolcont_y , %i , | , %toolcont_y , |
      set *care_plantations *care_plantations , toolcont_z , %i , | , %toolcont_z , |
      set *care_plantations *care_plantations , toolcont_id , %i , | , %toolcont_id , |
      set *care_plantations *care_plantations , waterthrough_x , %i , | , %waterthrough_x , |
      set *care_plantations *care_plantations , waterthrough_y , %i , | , %waterthrough_y , |
      set *care_plantations *care_plantations , waterthrough_z , %i , | , %waterthrough_z , |
      set *care_plantations *care_plantations , waterthrough_id , %i , | , %waterthrough_id , |
      if %plant_count > 0
      {
        for %j 1 %plant_count
        {
          set %index %i , _ , %j
          set %plant_x %plant_x . %index
          set %plant_y %plant_y . %index
          set %plant_z %plant_z . %index
          set %plant_id %plant_id . %index
          set *care_plantations *care_plantations , plant_x , %index , | , %plant_x , |
          set *care_plantations *care_plantations , plant_y , %index , | , %plant_y , |
          set *care_plantations *care_plantations , plant_z , %index , | , %plant_z , |
          set *care_plantations *care_plantations , plant_id , %index , | , %plant_id , |
        }
      }
    }
  }
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Mandown
Adept Scribe
Posts: 41
Joined: Fri Sep 10, 2010 10:38 am

Re: EasyUO Scripts

Post by Mandown »

Thanks. I will test it when i get home today from work.
Locked