ScriptUO

Official ScriptUO EasyUO Scripts => Script Snippets => Topic started by: freddy on November 12, 2011, 12:31:06 AM

Title: Freddy Snippets
Post by: freddy on November 12, 2011, 12:31:06 AM
This thread will contain various snippets of code that I use regularly.  This is mainly so i don't lose them, but some of yall might find them useful too.

Each snippet will be a new post.
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 12:33:56 AM
Fill Plant bowls with dirt:

container 1 contains fertile dirt and plant bowls.

container 2 holds filled bowls.

Code: [Select]
set %bowl_container
set %filled_container


finditem dgi C_ , %bowl_container
if #findkind <> -1
{
  for #findindex 1 #findcnt
  {
    finditem DGI C_ , %bowl_container
    exevent drag #findid #findstack
    wait 12
    exevent dropc #backpackid
    wait 12
    set %no #findid
    finditem NZF C_ , %bowl_container
    exevent drag #findid 20
    wait 12
    exevent dropc #backpackid
    wait 12
    finditem NZF C_ , #backpackid
    set #ltargetid #findid
    set #lobjectid %no
    event macro 17 0
    wait 1s
    event macro 22 0
    wait 1s
    finditem QLI C_ , #backpackid
    exevent drag #findid #findstack
    wait 12
    exevent dropc %filled_container
    wait 12
  }
}
halt
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 12:34:51 AM
Find all guilds of everyone around you: (does not work with gargs)

Code: [Select]
set %finalguild #spc
repeat
  set #lpc 1000
loop:
  finditem AU_XU_IS_HS G_20
  if #findkind <> -1
  {
    if #findrep = 1
    {
      event property #findid
      if [ notin #property
      {
        ignoreitem #findid
        goto loop
      }
      set %string #property
      str len %string
      set !length #strres
      STR POS %String [
      set %guild #strres
      STR DEL %string 1 %guild
      set %guildname #strres
      str len %guildname
      set %end #strres
      str pos %guildname ]
      set %stringtodelete #strres
      str del %guildname %stringtodelete %end
      set %temp_store #strres
      if %temp_store notin %finalguild || %finalguild = N/A
        set %finalguild %finalguild , %temp_store , _ ,
    }
    ignoreitem #findid
  }
until #findid = x
if %finalguild = #spc
  set %finalguild No , #spc , Guild ,

display %finalguild
if %finalguild = #charname
  set %finalguild none
halt


Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 12:36:25 AM
Fill char with x amount of gold from gold stacks in bank < chosen number
Code: [Select]
finditem pof C_ , %bankid
      if #findkind <> -1
      {
        for #findindex 1 #findcnt
        {
          if #gold >= 5000
            return
          set %get 5000 - #gold
          if #findstack < %get
            set %dragthis #findstack
          else
            set %dragthis %get
          exevent drag #findid %dragthis
          wait 12
          exevent dropc #backpackid
          wait 12
        }
      }
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 12:49:16 AM
Scan durability of everything equipped on character. !dura_cur = current durability, !dura_max = max durability, %prop = name of current item

Code: [Select]
set %dura_warn 5
set %remove_armor_on_warn  #true
gosub scan_armor
halt

;--------------------------------------------------------------
;--------------------------------------------------------------
sub scan_armor
  set #lpc 1000
  finditem * C_ , #charid
  for #findindex 1 #findcnt
  {
    gosub scan_dura #findid
    if #result = #true && !dura_max <> N/A
    {
      event property #findid
      set %temp_sid #property
      str pos %temp_sid $
      set %del #strres - 1
      str left %temp_sid %del
      set %prop #strres
      set %slash /
     ; menu list add durabox %prop , #spc , !dura_cur , %slash , !dura_max
     display %prop !dura_cur %slash !dura_max
      if !dura_cur <= %dura_warn
      {
        if %remove_armor_on_warn = #true
        {
          wait 10
          exevent drag #findid #findstack
          wait 10
          exevent dropc #backpackid
          wait 10
        }
      }
    }
  }
  set #lpc 20
  set %problem 0
return
;--------------------------------------------------------------
;--------------------------------------------------------------
sub scan_dura
  namespace push
  namespace local dura_check
  set !item %1
  set !dura durability
  event property !item
  if !dura in #property
  {
    set !temp_string #property
    str pos !temp_string durability
    set !delete_this #strres + 10
    str del !temp_string 1 !delete_this
    set !temp_string #strres
    str len !temp_string
    set !delete_this #strres - 1
    str left !temp_string !delete_this
    set !temp_string #strres
    wait 1
    str pos !temp_string /
    set !delete_this #strres - 1
    str left !temp_string !delete_this
    set !dura_cur #strres
    wait 1
    str pos !temp_string /
    set !delete_this #strres - 1
    str right !temp_string !delete_this
    set !dura_max #strres
    namespace push
    return #true
  }
return #false
;--------------------------------------------------------------
;--------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 12:58:21 AM
Scan for specific skills on items:

Kind of not finished, but kinda is

Code: [Select]
set #lpc 1000
  gosub scan_skill IRVCDTD magery_
  if #result <> #true
  display #result
  pause
;--------------------------------------------------------------
;--------------------------------------------------------------
sub scan_skill
  set #lpc 1000
  set %jewel 1
  set %item %1
  set %skill %2
  gosub separate_string2 %2 _
  for %n 1 %t_num
  {
    finditem %item C_ , #charid
    if  #findkind <> -1
    {
      set %skill . %item
      set %skillLvl . %item
      for %n 1 %t_num
      {
        event property #findid
        if %return . %n in #property && %item <> %weapon
        {
          set !temp_string #property
          str pos !temp_string %return . %n
          set %dthis #strres - 1
          str del !temp_string 1 %dthis
          set !temp_string #strres
          str pos #strres $
          set %del_this #strres - 1
          str left !temp_string %del_this
          set !temp_string #strres
          str pos !temp_string +
          str del !temp_string 1 #strres
          set !temp_string #strres
          set %skilllvl . %item %skilllvl . %item , !temp_string , _
          set %skill . %item %skill . %item , %return . %n , _
          set %total %total + 1
          set %scan #true
        }
      }
      if %scan = #true
        return !temp_string
    }
  }
return #false
;--------------------------------------------------------------
;--------------------------------------------------------------
sub separate_string2
  set %i 0
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }

return
;-------------------------------------------------------------
;-------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 03:02:32 AM
Take  hard dirt from one container, make it soft with endless decanter, then move soft dirt to another container

Code: [Select]
set %hard_container GTEQGUD
set %soft_container     PKEQGUD

finditem QLI C_ , %hard_container
for %u 1 #findcnt
{
  finditem QLI C_ , %hard_container
  exevent drag #findid
  wait 12
  exevent dropc #backpackid
  wait 12
  set %no #findid
  finditem VBM C_ , #backpackid
  set #lobjectid #findid
  for %i 1 2
  {
    set #ltargetkind 1
    event macro 17 0
    wait 1s
    set #ltargetid %no
    event macro 22 0
    wait 30
  }
  exevent drag %no
  wait 12
  exevent dropc %soft_container
  wait 15
}
halt

Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 03:24:38 AM
grab bowl of soft dirt from container, grab seed from another container, place planed bowl in another container

Code: [Select]
set %bowl_container PKEQGUD
set %seed_container DALUGUD
set %plant_container GTEQGUD


finditem QLI C_ , %bowlcontainer
for %u 1 #findcnt
{
  finditem QLI C_ , %bowl_container
  exevent drag #findid #findstack
  wait 12
  exevent dropc #backpackid
  wait 12
  set %bowl #findid
  finditem PDF C_ , %seed_container
  if #findkind = -1
  {
    display out of seeds
    halt
  }
  exevent drag #findid 1
  wait 12
  exevent dropc #backpackid
  wait 12
  finditem pdf C_ , #backpackid
  set #lobjectid #findid
  wait 12
  event macro 17 0
  set #ltargetkind 1
  set #ltargetid %bowl
  wait 15
  event macro 22 0
  wait 12
  exevent drag %bowl
  wait 12
  exevent dropc %plant_container
  wait 12
}
halt
Title: Re: Freddy Snippets
Post by: freddy on November 12, 2011, 03:39:28 AM
lock planted bowls down after breaking crate
Code: [Select]
finditem QLI G_2
for #findindex 1 #findcnt
{
event property #findid
if locked notin #property
{
 event macro 3 0 i wish to secure this
 set #ltargetid #findid
 set #ltargetkind 1
 target
 wait 10
 event macro 22 0
}
}
halt
Title: Re: Freddy Snippets
Post by: freddy on November 19, 2011, 09:39:14 PM
Spam messages in gen chat and yelling and will display the journal entry of whoever says your name

You need to type your character name. #charname wont work since a lot of ppl use titles (i do) and your global chat tag. Those are the numbers that appear in the < > before your name

Code: [Select]
set %chat_tag 500000
set %charname freddy ;Type char name, #charname wont work if you use a title
set %msgdelay 75
;--------------------------------------------------------------
;--------------------------------------------------------------
set %comma , ;for gen chat
set %yell !  ;to yell
set %timer1 #scnt
set %car %charname , :
loop:
if #scnt >= %timer1
{
msg %yell , #spc ,  Selling blah $
wait 15
msg %comma , #spc , selling mace and sheild 10m $
set %timer1 #scnt + %msgdelay
wait 2s
}
gosub journal2 %charname %chat_tag %car
if #result <> #false
{
 display #result
}
goto loop
;--------------------------------------------------------------
;--------------------------------------------------------------
sub journal2
  set %timer #scnt
  While #true
  {
    set %_jindex #jindex
    if #jindex >= %_jindex
    {
      scanjournal %_jindex
      if %1 in #journal &&  %2 notin #journal && %3 notin #journal
        return #journal
      return #false
    }
  }
return ;should never get this far
;--------------------------------------------------------------
;--------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on November 20, 2011, 05:03:07 AM
Spam Watch

Displays the last 3 things in your journal in very big letters. Has a box where you can talk in game. I use this when i spam to sell stuff and want to watch movies or whatever


Code: [Select]
;update 26july2015
;removed underscores from chat window
menu Clear
menu Window Title Spam Watch
menu Window Color BtnFace
menu Window Size 977 71
menu Font Transparent #true
menu Font Align Right
menu Shape EUOShape1 -28 -4 1009 169 3 7 1 Black 7 White
menu Font Name MS Sans Serif
menu Font Size 16
menu Font Style
menu Font Transparent #false
menu Font Align Left
menu Font BGColor White
menu Edit jtalk 860 20 109
menu Button talk 860 44 109 21 o k
menu Show 421 270
set #menubutton n/a
set %newmsg
set %omsg
set  %omsg1

set %jindex #jindex
set %t 1
loop:
if #menubutton = talk
{
  menu get jtalk
  msg #menures $
  set #menubutton n/a
  menu delete jtalk
  menu Edit jtalk 860 20 109
}
if #jindex <> %jindex
{
  scanjournal #jindex
  if %msg = #journal
    goto loop
  if you_see in #journal
    goto loop
  if *yes = #true
    menu Font Color Red
  else
    menu Font Color black
    set %sep_smsg #journal , #spc , _
  gosub separate_string %sep_smsg _
  for %i 1 %t_num
  {
   set %newmsg %newmsg , #spc , %return . %i
  }

;  set %newMsg #journal
  menu delete journal3
  menu Text journal3 8 44  %newMSG
  menu Font Color black
  menu delete journal2
  menu Text journal2 8 20 %omsg
  menu delete journal1
  menu Text journal1 8 0 %omsg1
  set %omsg1 %omsg
  set %omsg %newmsg
  set %msg #journal
  set %newmsg
  if *yes = #true
    set *yes #false
}
goto loop
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------

Title: Re: Freddy Snippets
Post by: freddy on November 21, 2011, 04:55:59 PM
Claim bless deeds from cleanup officer

Code: [Select]
set %times 8
set %cleanup KMLPL
for %i 1 %times
{
   set #lobjectid %cleanup
   event macro 17 0
   wait 1s
   for %u 1 21
   {
    set %clickx #contposx + 302
    set %clicky #contposy + 343
    click %clickx %clicky
   }
   set %clickx #contposx + 41
   set %clicky #contposy + 206
   click %clickx %clicky
wait 20
   set %clickx #contposx + 300
   set %clicky #contposy + 234
   click %clickx %clicky
   wait 10
}
halt
Title: Re: Freddy Snippets
Post by: freddy on November 21, 2011, 09:09:47 PM
I  use a variation of this in nearly every script I write.

Purpose: Separates a string into multiple, separate strings.

Usage: gosub separate_string this^is^a^test^string^ ^
returns:
%return1 this
%return2 is
%return3 a
%return4 test
%return5 string
%t_num 5

 Example strings:

  gosub separate_string 1280x800x x ;string, divider
    returns %return1 (1280) and %return2 (800)

  gosub separate_string this^is^a^string^ ^ ;string, divider

    returns %return1 (this) %return2 (is) %return3 (a) %return4 (string)


The %t_num variable tells you how many strings were created

Code: [Select]
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on April 25, 2012, 06:14:05 AM
Title: Re: Freddy Snippets
Post by: freddy on April 25, 2012, 06:19:53 AM
Scan items in a container without opening it. (event property)

gosub scan_pack %containerid

returns number of items in container via #result
Code: [Select]
;Freddy winuo.net
sub scan_pack
  set #lpc 1000
  namespace push
  namespace local dura_check
  set !item %1
  set !dura contents:
  event property !item
  if !dura in #property
  {
    set !temp_string #property
    str pos !temp_string contents:
    set !delete_this #strres + 8
    str del !temp_string 1 !delete_this
    set !temp_string #strres
    str pos !temp_string /
    set !t_del #strres - 1
    str left !temp_string !t_del
    set !temp_string #strres
    str del !temp_string 1 1
    set !temp_string #strres
    namespace push
    set #lpc 10
    return !temp_string
  }
return #false
Title: Re: Freddy Snippets
Post by: freddy on April 25, 2012, 06:22:09 AM
open beetle pack to get contid

Code: [Select]
;Freddy winuo.net
sub setbeetle
  set #lobjectid #charid
  event macro 17 0
  wait 10
  finditem ZGB G_1
  if #findkind = -1
  {
    display Can't find your beetle!
    Halt
  }
  set %beetleid #findid
bloop:
  display Hover your cursor over your beetle and press esc.
  while #true
  {
    onhotkey esc
    {
      set %beetlex #CURSORX
      set %beetley #CURSORy
      break
    }
  }
  wait 10
  click %beetlex %beetley
  gosub wait_gump normal_gump 118_222 10 #false
  if #result = #false
    goto bloop
  set %clickx #contposx + 50
  set %clicky #contposy + 200
  click %clickx %clicky
  gosub wait_gump container_gump 230_204 3 #false
  wait 10
  set %beetlecont #contid
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if %4 = #true
    {
      finditem %toolid C_ , #backpackid
      if #findkind = -1
        return #false
    }
    if %2 = N/A
      set %check N/A
    else
      set %check #contsize
    if %check = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
  until #scnt >= %timer
  set %4 n/a
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on April 25, 2012, 06:28:48 AM
Get weight from an item/container

gosub scan_weight %item_to_scan

returns weight via #result

Code: [Select]
;freddy winuo.net
sub scan_weight
  namespace push
  namespace local weight_check
  set !item %1
  finditem !item
  event property !item
  if stone in #property
  {
    set !temp_string #property
    str pos !temp_string ht:
    set !delete_this #strres + 3
    str del !temp_string 1 !delete_this
    set !temp_string #strres
    str len !temp_string
    set !delete_this #strres - 1
    str left !temp_string !delete_this
    set !temp_string #strres
    wait 1
    str pos !temp_string stone
    set !delete_this #strres - 2
    str left !temp_string !delete_this
    set !weight_cur #strres
    namespace push
    return !weight_cur
  }
return #false
Title: Re: Freddy Snippets
Post by: freddy on May 06, 2012, 11:58:22 PM
Craft Library
This can be used for any craft skill. Tell the script what tool to use, the category, page, and item number of the item you want to craft.


tools category page number ml

gosub craft_item jtl 3 1 4 N/A
;jtl = tinker kit, 3 = category 1 = page number 4 = item number, n/a means tool will reopen

gosub craft_item jtl 3 1 4 ML
;jtl = tinker kit, 3 = category 1 = page number 4 = item number, ML = make last. Script will detect if craft menu is open and will make the last item

Code: [Select]
;Freddy winuo.net
;tools category page number ml
sub craft_item
  namespace push
  namespace local craft_item
  set %tools %1
  set !category %2
  set !page %3
  set %item %4
  set !makelast %5
  set !tool_location #backpackid
  if !makelast = n/a
  {
    finditem %tools C_ , !tool_location
    set #lobjectid #findid
    event macro 17 0
    set %reopen no
    wait 30
  }
  finditem %tools c_ , !tool_location
  if #findkind <> -1
  {
retry_loop:
    finditem %tools c_ , !tool_location
    if #findkind <> -1
    {
      set %toolid #findid
      gosub wait_gump generic_gump 530_497 3 #true
      if #result = #true
        wait 0
      else
      {
        set #lobjectid #findid
        event macro 17 0
      }
    }
    gosub wait_gump generic_gump 530_497 10 #true
    if #result <> #true
      goto retry_loop
    wait 5
  }
  else
  {
    display Can't find your tool. Please put on in your main pack and start the script again.
    halt
  }

  if !category <> smelt
  {
    if !makelast = N/A
    {
      gosub click_location category !category
      gosub click_button #result
      wait 8
      if !page > 1
      {
        gosub click_location page !page
        gosub click_button #result
      }
      wait 8
      gosub click_location item %item
      gosub click_button #result
    }
    else
    {
      gosub click_location ml
      gosub click_button #result
      set !makelast N/A
    }
  }
  else
  {
    gosub click_location smelt
    gosub click_button #result
  }
  wait 8
  nameSpace Pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_button
  set !parsestring %1 , _
  gosub separate_string !parsestring _
  set !clickx #contposx + !return1
  set !clicky #contposy + !return2
  click !clickx !clicky
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub kill_gump

  if %1 = #contsize
  {
close_loop:
    set %c_modex #contposx + 30
    set %c_modey #contposy + 30
    click %c_modex %c_modey r
    if #contsize = 530_497
    {
      set %cloop %cloop + 1
      if %cloop < 3
        goto close_loop
      else
        return #false
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_location
  namespace push
  namespace local click_location
  set !type %1
  set !offset %2
  if !type = category
  {
    set !clickx 30
    set %base 90
  }
  if !type = page
    return 380_270
  if !type = ml
    return 280_455
  if !type = item
  {
    set !clickx 230
    set %base 70
  }
  if !type = smelt
    return 30_355
  if !type = context
    return 61_40
  if !offset >= 2 || %2 > 2
  {
    set !offset !offset - 1
    for %i 1 !offset
      set %base %base + 20
  }
  set %return !clickx , _ , %base
  namespace clear click_location
  namespace pop
return %return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub separate_string
  nameSpace Push
  namespace local separate
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set !return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
  }
  nameSpace Pop
  nameSpace Copy ret* From Local separate
  nameSpace Push
  nameSpace Local separate
  nameSpace Clear separate
  nameSpace Pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if %4 = #true
    {
      if %sbag = #true
        finditem %toolid C_ , %sbagid
      else
        finditem %toolid C_ , #backpackid
      if #findkind = -1
        return #false
    }
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
  until #scnt >= %timer
  set %4 n/a
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Title: Re: Freddy Snippets
Post by: freddy on May 12, 2012, 04:18:18 PM
Auto buy all items of the same type from a player vendor:
I use this when people split stacked items into smaller quantities. This will buy all the items of a particular type from the vendor, so if you only want to buy a set limit, you'll have to edit the snippet.

Code: [Select]
;freddy winuo.net
set %vendorCONTid XXX; the vendor's contid
set %itemtype ;the item type of the item you want to buy
set %itemcolor 0 ;the findcol of the item you want to buy
;--------------------------------------------------------
set #lpc 100
finditem %itemtype C_ , %vendorCONTid
for #findindex 1 #findcnt
{
  if #findcol = %itemcolor
  {
  exevent popup #findid
    gosub wait_gump normal_gump 44_42 3
    if #result = #false
    {
     event macro 31 0
     break
    }
    contpos 10 10
    set %click #contposx + 20
    set %click2 #contposy + 20
    click %click %click2
gosub wait_gump generic_gump 400_160 3
    set %clickx #contposx + 139
set %clicky   #contposy + 139
wait 10
click %clickx %clicky
wait 5
  }
}
sub wait_gump
  set %timer #scnt + %3
  repeat
    if #contsize = %2 && #contname = %1
      return #true
  until #scnt >= %timer
return #false
Title: Automatic Plant Maker
Post by: freddy on July 22, 2012, 06:11:10 PM
How to use:
edit the first line %secure with the itemid of your secure container.
You need a secure container with fertile dirt and seeds inside.
All plant bowls must be inside regular backpacks.
Need crates within 2 tiles of your char. (doesn't matter if they are all on one tile)

What this does:
Will automatically fill all crates with assembled plants based on how many crates or plant bowls you have (whichever is less).

Code: [Select]
;freddy winuo.net
set %secure OHIRXSD
set #lpc 1000
set %loop %crate_count
gosub initialize
set #lpc 50
for %lo 1 %loop
{
  set %crate %crate . %lo
  set #lobjectid %crate
  event macro 17 0
  wait 20
  set %bowl_bag %bowl . %lo
  set #lobjectid %bowl_bag
  event macro 17 0
  wait 20
  gosub set_vars
  for %i 1 %ploop
  {
    gosub grab_items
    gosub add_dirt
    gosub water_bowl
    gosub add_seed
    gosub drop_plant
  }
}
halt
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub drop_plant
  exevent drag %bowlid
  wait 15
  exevent dropc %crate
  wait 20
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub add_seed
  wait 15
  set #lobjectid %seedid
  event macro 17 0
  target 3s
  set #ltargetid %bowlid
  event macro 22 0
  wait 22
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub water_bowl
  for %u 1 2
  {
    set #lobjectid %pitcher
    event macro 17 0
    wait 15
    target 3s
    set #ltargetid %bowlid
    event macro 22
    wait 15
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub add_dirt
  set #lobjectid %bowlid
  event macro 17 0
  wait 15
  target 3s
  set #ltargetid %dirtid
  event macro 22 0
  wait 20
  finditem QLI C_ , #backpackid
  set %bowlid #findid
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub grab_items
  finditem DGI C_ , %bowl_bag
  exevent drag #findid #findstack
  wait 12
  exevent dropc #backpackid
  set %bowlid #findid
  wait 12
  finditem PDF C_ , #backpackid
  if #findstack <= 1
  {
    finditem PDF C_ , %secure
    exevent drag #findid 10
    wait 12
    exevent dropc #backpackid
    wait 12
  }
  finditem PDF C_ , #backpackid
  set %seedid #findid
  finditem NZF C_ , #backpackid
  if #findstack <= 19
  {
    finditem NZF C_ , %secure
    exevent drag #findid 200
    wait 12
    exevent dropc #backpackid
    wait 12
  }
  finditem NZF C_ , #backpackid
  set %dirtid #findid
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub set_vars
  set #lpc 1000
  finditem PDF C_ , %secure
  if #findkind <> -1
  {
    for #findindex 1 #findcnt
      set %seedct %seedct + #findstack
  }
  else
  {
    display Can't find seeds!
    halt
  }
  finditem DGI C_ , %bowl_bag
  if #findkind <> -1
  {
    if #findcnt < %seedct
      set %ploop #findcnt
    else
      set %ploop 125
  }
  else
  {
    display Can't find bowls
    halt
  }
  finditem NZF C_ , %secure
  if #findkind <> -1
  {
    set %dneeded %ploop * 20
    if #findstack < %dneeded
    {
      set %ploop #findstack / 20
    }
  }
  else
  {
    display Can't Find Fertile Dirt.
    halt
  }
  finditem VBM C_ , #backpackid
  if #findkind <> -1
  {
    event property #findid
    if unlinked in #property
    {
      display You do not have a linked endless decanter of water
      halt
    }
    set %pitcher #findid
  }
  else
  {
    display You do not have a endless decanter of water!
    halt
  }
  set #lpc 20
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub initialize
  namespace push
  namespace local initialize
try_again:
  event macro 8 1
  gosub wait_gump paperdoll_gump 262_324 10
  if #result <> #true
    goto try_again
  contpos !pd_pos 10
  wait 20
try_again2:
  event macro 8 7
  gosub wait_gump container_gump 230_204 10
  if #result <> #true
    goto try_again2
  wait 20
try_again4:
  event macro 8 2
  gosub wait_gump status_gump 432_184 10
  if #result <> #true
    goto try_again4
  wait 20
try_again3:
  finditem %secure g_3
  if #findkind = -1
  {
    display can't find secure!
    halt
  }
  else
  {
    set #lobjectid #findid
    wait 5
    event macro 17 0
    wait 30
  }
  finditem zjf G_2
  for #findindex 1 #findcnt
    set %bowl_bag #findid , _ , %bowl_bag
  set %bowl_bag %bowl_bag , _
  gosub separate_string %bowl_bag _
  set %bowl_count %t_num
  for %o 1 %bowl_count
    set %bowl . %o !return . %o
  finditem UMF G_2
  for #findindex 1 #findcnt
    set %crate #findid , _ , %crate
  set %crate %crate , _
  gosub separate_string %crate _
  set %crate_count %t_num
  for %p 1 %crate_count
    set %crate . %p !return . %p
  if %crate_count >= %bowl_count
    set %loop %bowl_count
  else
    set %loop %crate_count
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if %4 = #true
    {
      if %sbag = #true
        finditem %toolid C_ , %sbagid
      else
        finditem %toolid C_ , #backpackid
      if #findkind = -1
        return #false
    }
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
  until #scnt >= %timer
  set %4 n/a
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub separate_string
  set %t_num 0
  nameSpace Push
  namespace local separate
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set !return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
  nameSpace Pop
  nameSpace Copy ret* From Local separate
  nameSpace Push
  nameSpace Local separate
  nameSpace Clear separate
  nameSpace Pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Title: Simple Item Mover
Post by: freddy on August 12, 2012, 03:22:32 AM
This moves multiple items of the same type between containers.


Code: [Select]
;Freddy
display Target source container
wait 1
set #targcurs 1
target
loop:
if #targcurs = 1
{
  goto loop
}
set %firstcontainer #ltargetid
set #lobjectid %firstcontainer
event macro 17 0
wait 1s
display Target last container
wait 1
set #targcurs 1
target
loop2:
if #targcurs = 1
{
  goto loop2
}
set %secondcontainer #ltargetid
display Target item to move
wait 1
set #targcurs 1
target
loop3:
if #targcurs = 1
{
  goto loop3
}
finditem #ltargetid *
set %item_to_move #findtype

finditem %item_to_move C_ , %firstcontainer
for #findindex 1 #findcnt
{
  exevent drag #findid #findstack
  wait 12
  exevent dropc %secondcontainer
  wait 12
}
halt
Title: Redeem multiple items from Cleanup Officer
Post by: freddy on August 12, 2012, 03:28:46 AM
This script can redeem bless deeds, and each of the 4 pigments only.
the variables are a little confusing to setup, so you will have problems if you don't set correctly.

the %items var can be set to any, all, or a combination of these items: bless ,pig1 ,pig2 ,pig3 , or pig4.

the %times variable correlates to the position of the items you want to redeem in the %items variable.

so lets say you want 5 bless deeds and 7 of the third pigment, your variables would look like this:

set %items bless_pig3_
set %times 5_7_

Note: Both variables MUST have a trailing underscore.

It's a little slow because I haven't really tested it, but once I get a few more points, i'll update it.

Code: [Select]
;Freddy
;8/4/2012
;thx to soulweaver for the coords
set %items bless_pig1_pig2_pig3_
set %times 6_5_4_3_
;----------------------do not edit below-----------------------
set #lpc 1000
gosub separate_string %items _
for %u 1 %t_num
  set %item . %u %return . %u
gosub separate_string %times _
for %u 1 %t_num
  set %time . %u %return . %u
set %loops %t_num
set %page_coord 302_343
finditem XU G_4
for #findindex 1 #findcnt
{
  event property #findid
  if cleanup in #property
    set %cleanup #findid
}
set #lpc 20
mainloop:
for %p 1 %loops
{
  set %l %time . %p
  for %s 1 %l
  {
    set #lobjectid %cleanup
    event macro 17 0
    gosub wait_gump generic_gump 345_359 3
    gosub find_coord %item . %p
    for %q 1 %page
    {
      wait 7
      gosub click_button %page_coord
    }
    gosub click_button %coord
    gosub wait_gump generic_gump 348_262
    if #result = #false
    {
      display You are either out of points or the script messed up!
      halt
    }
    gosub click_button 290_232
    wait 10
  }
}
goto mainloop
;-------------------------------------------------------------
;-------------------------------------------------------------
sub find_coord
  if %1 = bless
  {
    set %coord 41_206
    set %page 21
  }
  if %1 = pig1
  {
    set %coord 40_250
    set %page  21
  }
  if %1 = pig2
  {
    set %coord 40_300
    set %page  21
  }
  if %1 = pig3
  {
    set %coord 40_132
    set %page 22
  }
  if %1 = pig4
  {
    set %coord 40_181
    set %page 22
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if #contsize = %2 && #contname = %1
      return #true
  until #scnt >= %timer
return #false
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_button
  set !parsestring %1 , _
  gosub separate_string !parsestring _
  set !clickx #contposx + %return1
  set !clicky #contposy + %return2
  click !clickx !clicky
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
Title: inscription trainer
Post by: freddy on March 14, 2013, 11:13:17 PM
Inscription trainer
have 30-40k blank scrolls, lots of regs. use in your house. have at least 32.5 skill. be near a trash can. have a full spellbook in your pack when you start. make sure that is the only spellbook in your pack

Code: [Select]
;==================================
; Script Name: Inscription Express
; Author: Freddy
; Version: 1
; Client Tested with: 7. Something
; EUO version tested with: 1.5 (Build 0199)
; Shard OSI
; Revision Date: 6/22/2012
; Public Release Beta: 6/22/2012
; Purpose: Trains inscription FAST!!!
;==================================
;---------------Do Not Edit Below--------------------------------------
set %beginning #systime
set %min 2
set %max 3
set %version 1.0
;set #lpc 50
set %trash KAG_CGG_NWH_NYD_ZVH
set %tools PBG
set %init #true
set %bottle_list WTL_YUL_PUL_VUL_
set %slayertype repond_undead_elemental_demon_arachnid_reptile_
gosub separate_string %slayertype _
for %o 1 %num
  set %slayer . %o !return . %o
chooseskill insc
if #skill < 325
{
  display You need at least 32.5 skill points to run this script.
  halt
}
finditem MPF C_ , #backpackid
if #findkind <> -1
{
  event property #findid
  if 64 notin #property
  {
    display you need a spellbook with all 64 spells.
    halt
  }
  ignoreitem #findid
}
else
{
  display You need a full spellbook
  halt
}
finditem BKF G_3
if #findkind <> -1
  set %trashcan #findid
else
{
  display You must be near a trash barrel
  halt
}
gosub menu_
gosub initialize
wait 1s
set %skill inscription
gosub setskilltable
set %old_sk %current
gosub inscription
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub check_mana
  set #lpc 1000
  set %med #false
  if #mana <= %mana
  {
    while #mana < #maxmana
    {
      chooseskill medi
      if #skill > 0 && %med = #false
      {
        wait 2s
        event macro 13 46
        set %_jindex #jindex
        gosub journal2 trance 10
        if #result = #false
        {
          wait 11s
        }
        else
          set %med #true
      }
      wait 0
    }
  }
  set #lpc 20
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub journal2
  set %timer #scnt + %2
  While %timer > #scnt
  {
    set %_jindex #jindex
    if #jindex >= %_jindex
    {
      scanjournal %_jindex
      if %1 in #journal
        return #true
    }
  }
  return #false
return ;should never get this far
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub crap
  while #true
  {
    if #findkind <> -1
    {
      finditem %bottle_list C_ , #backpackid
      wait 12
      exevent drag #findid #findstack
      wait 12
      exevent dropc %secure
    }
    else
      break
  }
  finditem PBG C_ , #backpackid
  set #lobjectid #findid
  event macro 17 0
  gosub setskilltable
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub find_tongs
bloop:
  set %t_location #backpackid
  gosub find_tinker
  finditem PBG C_ , %t_location
  if #findcnt <  %min
  {
    gosub kill_gump 530_497
    wait 20
    set %var1 %max - #findcnt
    finditem jtl C_ , %t_location
    if #findkind <> -1
    {
      set #lobjectid  #findid
      event macro 17 0
      wait 10
    }
    else
    {
      display You do not currently have any tinker kits! Get one and restart.
      halt
    }
    finditem jtl c_ , %t_location
    {
      wait 1s
      set #lobjectid #findid
      event macro 17 0
      wait 10
    }
    for %q 1 %var1
      gosub craft_item jtl 3 3 3 N/A
    gosub wait_gump generic_gump 530_497 5
    wait 10
    finditem PBG C_ , %t_location
    if #findcnt <  %min
      goto bloop
    finditem PBG C_ , %t_location
    set #lobjectid #findid
    event macro 17 0
    gosub setskilltable
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub find_tinker
tloop:
  if %sbag = #true
    set %t_location %sbagid
  else
    set %t_location #backpackid
  finditem jtl C_ , %t_location
  if #findcnt <  2
  {
    gosub kill_gump 530_497
    wait 20
    set %var1 3 - #findcnt
    finditem jtl C_ , %t_location
    if #findkind <> -1
    {
      set #lobjectid  #findid
      event macro 17 0
      wait 10
    }
    else
    {
      display You do not currently have any tinker kits! Get one and restart.
      halt
    }
    for %q 1 %var1
      gosub craft_item jtl 3 1 4 N/A
    gosub wait_gump generic_gump 530_497 5
    wait 15
    finditem jtl C_ , %t_location
    if #findcnt < 1
      goto tloop
    finditem RQK C_ , %t_location
    set #lobjectid #findid
    event macro 17 0
    gosub setskilltable
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub check_pack_items
  set #lpc 1000
  namespace push
  namespace local dura_check
  set !item %1
  set !dura contents:
  event property !item
  if !dura in #property
  {
    set !temp_string #property
    str pos !temp_string contents:
    set !delete_this #strres + 8
    str del !temp_string 1 !delete_this
    set !temp_string #strres
    str pos !temp_string /
    set !t_del #strres - 1
    str left !temp_string !t_del
    set !temp_string #strres
    str del !temp_string 1 1
    set !temp_string #strres
    namespace push
    set #lpc 10
    return !temp_string
  }
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub checkresources
  finditem %2 C_ , %1
  if #findkind <> -1
  {
    gosub count_stack %1 %2
    if #result > %3
      return #true
  }
  if #findkind = -1 || #findcnt < %3
  return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub count_stack
  finditem %2 C_ , %1
return #findstack
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub fix_maxweight
  finditem #charid *
  if #findtype notin XU_AV
  {
    set %sWeight #maxweight + 60
    if %sWeight > 550
      return 550
    else
      return %sWeight - #weight
  }
  else
  return #maxweight - #weight
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub setskilltable
  chooseskill %skill
  if %skill = inscription
  {
    set %tools PBG
    if #skill >= 325 && #skill <= 600 ;recall
    {
      set %current Recall
      set %mana 11
      set %category 2
      set %page 2
      set %item 6
      set %resources JUF_KUF_MZF_ ;bloodmoss mandrake root black pearl
    }
    if #skill >= 601 && #skill <= 700 ;Mark
    {
      set %current Mark
      set %mana 20
      set %category 3
      set %page 2
      set %item 3
      set %resources JUF_KUF_MZF_ ;bloodmoss mandrake root black pearl
    }
    if #skill >= 701 && #skill <= 850 ;Gate
    {
      set %current Gate
      set %mana 40
      set %category 4
      set %page 1
      set %item 4
      set %resources KUF_SZF_MZF_ ;blackpearl bloodmoss s.ash
    }
    if #skill >= 851 && #skill <= 900  ;Resurrection
    {
      set %current Resurrection
      set %mana 50
      set %category 4
      set %page 2
      set %item 1
      set %resources JUF_JZF_KZF_  ;mandrakeroot
    }
    if #skill >= 901 && #skill <= 1000 ;Spell Books
    {
      set %current SpellBooks
      set %category 6
      set %page 1
      set %item 5
      set %resources null ;ginseng
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;tools category page number ml
sub craft_item
  namespace push
  namespace local craft_item
  set %tools %1
  set !category %2
  set !page %3
  set %item %4
  set !makelast %5
  set !tool_location #backpackid
  if !makelast = n/a
  {
    finditem %tools C_ , !tool_location
    set #lobjectid #findid
    event macro 17 0
    set %reopen no
    wait 30
  }
  finditem %tools c_ , !tool_location
  if #findkind <> -1
  {
retry_loop:
    finditem %tools c_ , !tool_location
    if #findkind <> -1
    {
      set %toolid #findid
      gosub wait_gump generic_gump 530_497 3 #true
      if #result = #true
        wait 0
      else
      {
        set #lobjectid #findid
        event macro 17 0
      }
    }
    gosub wait_gump generic_gump 530_497 10 #true
    if #result <> #true
      goto retry_loop
    wait 5
  }
  else
  {
    display Can't find your tool. Please put on in your main pack and start the script again.
    halt
  }

  if !category <> smelt
  {
    if !makelast = N/A
    {
      gosub click_location category !category
      gosub click_button #result
      wait 8
      if !page > 1
      {
        set %hey !page - 1
        for %p 1 %hey
        {
          gosub click_location page !page
          gosub click_button #result
        }
      }
      wait 8
      gosub click_location item %item
      gosub click_button #result
    }
    else
    {
      gosub click_location ml
      gosub click_button #result
      set !makelast N/A
    }
  }
  else
  {
    gosub click_location smelt
    gosub click_button #result
  }
  wait 8
  nameSpace Pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_button
  set !parsestring %1 , _
  gosub separate_string !parsestring _
  set !clickx #contposx + !return1
  set !clicky #contposy + !return2
  click !clickx !clicky
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub kill_gump
  if %1 = #contsize
  {
close_loop:
    set %c_modex #contposx + 30
    set %c_modey #contposy + 30
    click %c_modex %c_modey r
    if #contsize = 530_497
    {
      set %cloop %cloop + 1
      if %cloop < 3
        goto close_loop
      else
        return #false
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_location
  namespace push
  namespace local click_location
  set !type %1
  set !offset %2
  if !type = category
  {
    set !clickx 30
    set %base 90
  }
  if !type = page
    return 380_270
  if !type = ml
    return 280_455
  if !type = item
  {
    set !clickx 230
    set %base 70
  }
  if !type = smelt
    return 30_355
  if !type = context
    return 61_40
  if !offset >= 2 || %2 > 2
  {
    set !offset !offset - 1
    for %i 1 !offset
      set %base %base + 20
  }
  set %return !clickx , _ , %base
  namespace clear click_location
  namespace pop
return %return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub separate_string
  nameSpace Push
  namespace local separate
  set %num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set !return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %num %num + 1
  }
  nameSpace Pop
  nameSpace Copy ret* From Local separate
  nameSpace Push
  nameSpace Local separate
  nameSpace Clear separate
  nameSpace Pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if %4 = #true
    {
      if %sbag = #true
        finditem %toolid C_ , %sbagid
      else
        finditem %toolid C_ , #backpackid
      if #findkind = -1
        return #false
    }
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
  until #scnt >= %timer
  set %4 n/a
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub initialize
  namespace push
  namespace local initialize
  gosub separate_string %resolution x
  set !resx !return1
  set !resy !return2
  set !pd_pos ( !resx - 280 )
try_again:
  event macro 8 1
  gosub wait_gump paperdoll_gump 262_324 10
  if #result <> #true
    goto try_again
  contpos !pd_pos 10
  wait 20
try_again2:
  set !bp_pos ( !resy - 450 )
  event macro 8 7
  gosub wait_gump container_gump 230_204 10
  if #result <> #true
    goto try_again2
  contpos !pd_pos !bp_pos
  wait 20
try_again4:
  set !sb_pos ( !pd_pos - 150 )
  set !sb_pos2 ( !resy - 220 )
  event macro 8 2
  gosub wait_gump status_gump 432_184 10
  if #result <> #true
    goto try_again4
  contpos !sb_pos !sb_pos2
  wait 20
try_again3:
  set !rs_pos 50
  set !rs_pos2 ( !resy - 250 )
  finditem %secure g_3
  if #findkind = -1
  {
    display can't find secure!
    halt
  }
  else
  {
    set #lobjectid #findid
    wait 5
    event macro 17 0
    wait 30
    contpos !rs_pos !rs_pos2
    finditem %resource C_ , %secure
    if #findkind <> -1
    {
      set #lobjectid #findid
      event macro 17 0
      wait 20
      set !pos !rs_pos + 210
      contpos !pos !rs_pos2
      set %resource #contid
    }
    else
    {
      display Can't find your resource container!
      halt
    }
  }
  if %sbag = #true
  {
    finditem CKF C_ , #backpackid
    for %i 1 #findindex
    {
      event property #findid
      if salvage in #property
        set %sbagid #findid
    }
    if %sbagid = n/a
    {
      display You do not have a salvage bag! Pleae get one and restart
      halt
    }
    finditem %sbagid C_ , #backpackid
    if #findkind <> -1
    {
      set #lobjectid #findid
      event macro 17 0
      wait 20
      set !pos !rs_pos + 420
      contpos !pos !rs_pos2
    }
    else
    {
      display Can't find your Salvage Bag!
      halt
    }
  }
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub checkskill
  chooseskill %skill
  set %currentskill #skill
  if %cskill = N/A || %cskill <> %currentskill
  {
    menu Font Style b
    menu Font Color $00990066
    set %cskill %currentskill
    menu delete currentskill
    str len %currentskill
    str ins %currentskill #dot #strRes
    menu Text currentskill 72 108 #strres
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub totalskill
  chooseskill %skill
  set %totalskillgained 0
  set %totalskillgained %currentskill - %startingskill
  if %tskill = N/A || %tskill <> %totalskillgained
  {
    menu Font Style b
    menu Font Color $00990066
    menu delete totalskill
    set %totalskillgained 0
    set %totalskillgained %currentskill - %startingskill
    set %tskill %totalskillgained
    str len %totalskillgained
    str ins %totalskillgained #dot #strRes
    menu Text current 72 128 #strres
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub time
  menu Font Style b
  menu Font Color $00990066
  set %time #systime - %beginning
  gosub timeformat
  menu delete time
  menu Text time 72 148 %outtime
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;==================================
; Script Name: Lion's Timer Formatting Subs
; Author: Lion
; Version: 1.1
; Client Tested with: 4.0.0p/q
; EUO version tested with: 1.41 build 0075
; Shard OSI / FS: Any
; Revision Date: 5th March 2004
; Public Release: 4th March 2003
; Purpose: Time in ms to standard MM:DD:HH:MM:SS
;==================================
;==================================
;Simple (hours:mins:secs)
;==================================
sub timeformat
  str len %time
  set %timelenght  #strres - 3
  str left %time %timelenght
  set %t1 #strres / 3600
  set %t2 #strres % 3600 / 60
  set %t3 #strres % 3600 % 60
  set %outtime %t1
  for %i 2 3
  {
    str len %t . %i
    if #strres = 1
      set %outtime %outtime , : , 0 , %t . %i
    if #strres <> 1
      set %outtime %outtime , : , %t . %i
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub checkskillcap
  chooseskill %skill
  if #skill = #skillcap
  {
    return #true
  }
return #false
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub menu_
mloop:
  menu Clear
  menu Window Title Freddy's High-Velocity Trainers
  menu Window Color White
  menu Window Size 236 261
  menu Font Transparent #true
  menu Font Align Right
  menu Shape EUOShape1 0 0 241 297 3 7 1 Black 1 Maroon
  menu Shape EUOShape2 8 8 221 33 3 7 1 Black 7 White
  menu Font Name MS Sans Serif
  menu Font Size 12
  menu Font Style
  menu Font Color $00990066
  menu Font Transparent #false
  menu Font Align Left
  menu Font BGColor White
  menu Text EUOLabel1 64 16 Inscription Express
  menu Shape EUOShape3 8 40 221 213 3 7 1 Black 7 $00990066
  menu Shape EUOShape4 16 52 205 189 3 7 1 Black 7 White
  menu Font Size 8
  menu Font Color Green
  menu Text EUOLabel4 24 224 Version %version
  menu Text EUOLabel5 184 224 Freddy
  menu Font Size 10
  menu Font Color Black
  menu Text EUOLabel6 20 88 Resolution
  menu Font Size 12
  menu Font Style b
  menu Font Color $00990066
  menu Text EUOLabel2 56 60 Inscription Setup
  menu Font Size 8
  menu Font Style
  menu Font Color WindowText
  menu Text EUOLabel9 136 92 by
  menu Font Style b
  menu Text EUOLabel3 20 116 Container Setup:
  menu Font Style
  menu Text EUOLabel7 28 134 Secure:
  menu Text EUOLabel8 28 162 Resource:
  menu Font Color White
  menu Font BGColor $00990066
  menu Button continue 36 188 161 29 Continue
  menu Font Color WindowText
  menu Font BGColor Window
  menu Edit rbox1 88 88 45 *r1
  menu Edit rbox2 152 88 45 *r2
  menu Edit sbox 88 132 93 *sec
  menu Edit rebox 88 160 93 *res
  menu Font BGColor BtnFace
  menu Button secureid 184 132 25 21 ID
  menu Button resourceid 184 160 25 21 ID
  menu Show 0 0

  set #menubutton n/a
buttonloop2:
  if #menubutton = secureid
  {
    display Target your secure container!
    wait 1
    set #targcurs 1
    target
    menu hideeuo
uloop:
    if #targcurs = 1
    {
      goto uloop
    }
    Set #lobjectid #ltargetid
    set *sec #ltargetid
    event macro 17 0
    goto mloop
  }

  if #menubutton = resourceid
  {
    display Target your resource container!
    wait 1
    set #targcurs 1
    target
    menu hideeuo
loop1:
    if #targcurs = 1
    {
      goto loop1
    }
    Set #lobjectid #ltargetid
    set *res #ltargetid
    event macro 17 0
    goto mloop
  }
  if #menubutton = tcanid
  {
    display Target your trashcan!
    wait 1
    set #targcurs 1
    target
    menu hideeuo
loop3:
    if #targcurs = 1
    {
      goto loop3
    }
    Set #lobjectid #ltargetid
    set *tcan #ltargetid
    event macro 17 0
    goto mloop
  }

  if #menubutton <> continue
  {
    goto buttonloop2
  }
  menu get rbox1
  set *r1 #menures
  set %r1 #menures , x
  menu get rbox2
  set *r2 #menures
  set %r2 #menures , x
  set  %resolution %r1 , %r2
  menu get sbox
  set %secure #menures
  set *sec %secure
  menu get rebox
  set %resource #menures
  set *res %resource
  set %skill Inscription
  set %skill1 Inscription

  menu Clear
  menu Window Title Freddy's high-velocity Trainer
  menu Window Color White
  menu Window Size 159 213
  menu Font Transparent #true
  menu Font Align Right
  menu Shape EUOShape1 0 -180 165 397 3 7 1 Black 1 Maroon
  menu Shape EUOShape2 8 8 145 33 3 7 1 Black 7 White
  menu Font Name MS Sans Serif
  menu Font Size 12
  menu Font Style
  menu Font Color $00990066
  menu Font Transparent #false
  menu Font Align Left
  menu Font BGColor White
  menu Text EUOLabel1 16 16 Inscription Express
  menu Shape EUOShape3 8 40 145 165 3 7 1 Black 7 $00990066
  menu Shape EUOShape4 16 48 129 145 3 7 1 Black 7 White
  menu Font Size 8
  menu Font Color Green
  menu Text EUOLabel4 20 176 Version %version
  menu Text EUOLabel5 108 176 Freddy
  menu Font Size 12
  menu Font Style b
  menu Font Color $00990066
  menu Text EUOLabel2 28 60 %skill1
  menu Shape EUOShape5 24 84 113 81 3 7 1 Black 7 White
  menu Shape EUOShape6 24 84 113 21 3 7 1 Black 7 White
  menu Shape EUOShape7 24 104 113 21 3 7 1 Black 7 White
  menu Shape EUOShape8 24 124 113 21 3 7 1 Black 7 White
  menu Shape EUOShape9 24 144 113 21 3 7 1 Black 7 White
  menu Font Size 8
  menu Font Style
  menu Font Color WindowText
  menu Text EUOLabel3 28 88 Start:
  menu Text EUOLabel6 28 108 Current:
  menu Text EUOLabel7 28 128 Total:
  menu Text EUOLabel8 28 148 Time:
  menu Shape EUOShape10 68 84 1 81 3 7 1 Black 7 White
  menu Font Style b
  menu Font Color $00990066
  chooseskill %skill
  set %startingskill #skill
  set %currentskill #skill
  set %totalskill %currentskill - %startingskill
  str len %startingskill
  str ins %startingskill #dot #strRes
  menu Text startskill 72 88 #strres
  menu Text totalskill 72 128 %totalskill
  menu Text currentskill 72 108 %currentskill
  menu Text time 72 148 %total_time
  menu Show 0 0
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub check_resources
  finditem DPF C_ , #backpackid
  if #findstack <= 10
  {
    finditem DPF C_ , %resource
    if #findkind = -1
    {
      display You don't have any blank scrolls!
      halt
    }
    exevent drag #findid 100
    wait 16
    exevent dropc #backpackid
    wait 16
  }
  finditem ENK C_ , #backpackid
  if #findstack <= 10
  {
    finditem ENK C_ , %resource
    if #findkind = -1
    {
      display You don't have any ingots
      halt
    }
    exevent drag #findid 100
    wait 16
    exevent dropc #backpackid
    wait 16
  }
  if %current <> spellbooks
  {
    gosub separate_string %resources _
    for %i 1 %num
    {
      set %look !return . %i
      finditem %look C_ , #backpackid
      if #findstack <= 10
      {
        finditem %look C_ , %resource
        if #findkind = -1
        {
          display You don't have any reagents
          halt
        }
        exevent drag #findid 100
        wait 16
        exevent dropc #backpackid
        wait 16
      }
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub drop_resources
  set %newstr %bottle_list , %resources
  gosub separate_string %newstr _
  for %i 1 %num
  {
    set %look !return . %i
    finditem %look C_ , #backpackid
    exevent drag #findid 100
    wait 16
    exevent dropc %resource
    wait 16
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub crap_books
  set #lpc 1000
  finditem MPF C_ , #backpackid
  for #findindex 1 #findcnt
  {
    event property #findid
    for %slo 1 6
    {
      if %slayer . %slo in #property
      {
        exevent  drag #findid
        wait 12
        exevent dropc %secure
        wait 12
        set %s_y #true
      }
    }
    if %s_y <> #true
    {
      exevent drag #findid
      wait 12
      exevent dropc %trashcan
      wait 12
    }
    set %s_y #false
  }
  set #lpc 20
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub inscription
  while #true
  {
    gosub checkskill
    gosub totalskill
    gosub checkskillcap
    if #result = #true
    {
      gosub drop_resources
      wait 1s
      gosub crap_books
      display You have reached your skill cap!
      halt
    }
    gosub time
    finditem %bottle_list C_ , #backpackid
    for #findindex 1 #findcnt
    {
      if #findstack >= 75
      {
        gosub crap
        break
      }
    }
    set #lpc 1000
    set %temp_resource %resources
    gosub setskilltable
    gosub checkresources %resource ENK 200
    if #result <> #true
    {
      display You don't have enough resources! Get some and restart.
      halt

    }
    gosub checkresources %resource DPF 200
    if #result <> #true
    {
      display You don't have enough resources! Get some and restart.
      halt
    }
    gosub check_resources
    gosub find_tongs
    gosub fix_maxweight
    if #result <= 15
      gosub crap
    gosub check_pack_items #backpackid
    if #result >= 120 && %current = spellbooks
    gosub crap_books
    if #result >= 120 && %current <> spellbooks
    gosub crap
    if %temp_resource <> %resources
    {
      finditem %temp_resource C_ , #backpackid
      if #findkind <> -1
      {
        exevent drag #findid #findstack
        wait 12
        exevent dropc %resource
        wait 12
      }
      gosub crap
      wait 5
      gosub check_resources
      wait 10
      set %init #true
    }
    gosub check_mana
    if %current <> %old_sk
    {
      set %old_sk %current
      set %init #true
      gosub drop_resources
    }
    if %init = #true
      gosub craft_item %tools %category %page %item n/a
    if %init <> #true
      gosub craft_item %tools %category %page %item ml reopen
    set %init #false
    set %look n/a
    gosub check_mana
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------


Title: Dex Farmer / Leather Farmer
Post by: freddy on April 21, 2013, 07:03:02 PM
The classic

Setup should be pretty self explanatory, just follow the menu. As far as I know sampires still work (which this script was designed for) because this script does not heal other than confidence.
 
(http://i.imgur.com/d2oB3fv.png)

(http://i.imgur.com/UIt4IGb.png)
Title: Re: Freddy Snippets
Post by: freddy on September 26, 2013, 01:38:51 PM
updated leather farmer
Title: Re: inscription trainer
Post by: noobus on November 07, 2013, 04:57:28 AM
the inscription trainer starts up, but doesn't do anything else

on OSI with latest client.
Title: Re: Freddy Snippets
Post by: freddy on November 07, 2013, 09:01:09 PM
You need at least 32.5 skill points to run this script
be near a trash barrel

you need a container secured on the ground in a house you own. inside that container you need another container that holds your resources. follow the menu on how to set up the variables. if you need extra help, send me an icq, 319699419
Title: Re: Freddy Snippets
Post by: noobus on November 08, 2013, 05:28:35 AM
You need at least 32.5 skill points to run this script
be near a trash barrel

you need a container secured on the ground in a house you own. inside that container you need another container that holds your resources. follow the menu on how to set up the variables. if you need extra help, send me an icq, 319699419

I had all those requirements done.  I was trying to use it from the low 80s.  I've gm'd already though so can't test any more
Title: Re: Freddy Snippets
Post by: freddy on July 26, 2015, 11:00:00 AM
updated chat spam watch,.

http://www.scriptuo.com/index.php?topic=8886.msg77310#msg77310

Update july 26th 2015 - removed underscores from chat window
Title: Re: Freddy Snippets
Post by: freddy on May 07, 2018, 03:33:12 PM
The dex farmer still works really well. Imbuing messed with the durability function, though it seems like it is just an issue with it displaying on the menu. There's a bug when scanning for a monster where it might ignore a monster close-by that I'm working on fixing. I'm still using a sampire that I built in 2010 maybe that works well. I'm going to be posting an update in the next few days.
Title: Re: Freddy Snippets
Post by: bendel on May 07, 2018, 04:11:35 PM
Nice one freddy!
looking forward :)
Title: Re: Freddy Snippets
Post by: freddy on May 08, 2018, 09:12:55 PM
I also realized the script will only use one BoS. If the bag becomes saturated the script will halt even if you have multiple BoS in your pack. This will be fixed shortly. 
Title: Re: Freddy Snippets
Post by: freddy on May 25, 2019, 01:37:20 PM
;==================================
; Script Name: Freddy's Cdeed Maker
; Author: Freddy
; Version: 1.0
; Client Tested with: 7.0.16
; EUO version tested with: 1.5 (Build 0199)
; Shard OSI
; Revision Date: 10-16-2011
; Revision Date: 10-16-2011
; Purpose: Uses a commodity deed box to fill commodity deeds with the amount of your choice
;==================================

Code: [Select]
;==================================
; Script Name: Freddy's Cdeed Maker
; Author: Freddy
; Version: 1.0
; Client Tested with: 7.0.16
; EUO version tested with: 1.5 (Build 0199)
; Shard OSI
; Revision Date: 10-16-2011
; Revision Date: 10-16-2011
; Purpose: Uses a commodity deed box to fill commodity deeds with the amount of your choice
;==================================
set %comdeed_box OQXBLSD ;The item id of your commodity deed box
set %resource_box LBDUGOD ;Item id of your container that holds the items to deed
set %deed_container PXDUGOD ;Item id of the container holding blank deeds
set %deed_storage MSIPERD ;Item id of the container to hold filled deeds. You can use #backpackid or any container in your pack
set %resource_type jjg  ;the item type of the resource to deed
set %color 2129 ; set to 0 if default. the #findcol of the resource
set %amount_to_deed 5000 ;number of items to put in the deed
set %amount_to_make 12 ;number of deeds to make
;==================================
gosub set_containers
wait 1s
for %u 1 %amount_to_make
{
event sysMessage making deed %u of %amount_to_make
gosub drag_item %resource_box %resource_type %color %amount_to_deed %comdeed_box  Finished
gosub drag_item %deed_container EWH 71 1 %comdeed_box commodity_deed
gosub deed_item
wait 10
gosub drag_item %comdeed_box EWH 1426 1 %deed_storage commodity_deed
wait 10
}
Display Finished
halt
;-------------------------------------------------------------
;-------------------------------------------------------------
sub deed_item
finditem EWH C_ , %comdeed_box
set #lobjectid #findid
event macro 17 0
target 2s
finditem %resource_type C_ , %comdeed_box
set #ltargetid #findid
event macro 22
wait 10
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub drag_item
finditem %2 C_ , %1
for #findindex 1 #findcnt
{
if #findcol = %3
{
 if #findstack < %4
 set %drag_this #findstack
 else
 set %drag_this %4
 exevent drag #findid %drag_this
 wait 10
 exevent dropc %5
 wait 10
 break
 }
  }
  if #findkind = -1
  {
   display You are out of %6
   halt
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub set_containers
  finditem  %comdeed_box g_2
  if #findkind <> -1
  {
    set #lobjectid #findid
    event macro 17 0
    wait 1s
    contpos 215 0
  }
  finditem %resource_box g_2
  if #findkind <> -1
  {
    set #lobjectid #findid
    event macro 17 0
    wait 1s
    contpos 430 0
  }
  finditem %deed_container g_2
  if #findkind <> -1
  {
    set #lobjectid #findid
    event macro 17 0
    wait 1s
    contpos 645 0
  }
  finditem %deed_storage g_2
  if #findkind <> -1
  {
    set #lobjectid #findid
    event macro 17 0
    wait 1s
    contpos 860 0
  }
return
Title: Re: Freddy Snippets
Post by: freddy on May 25, 2019, 01:46:18 PM
;==================================
; Script Name: Freddy's Luna Buyer
; Author: Freddy
; Version: 1.0
; Client Tested with: 5. Something
; EUO version tested with: 1.5 (Build 0064)
; Shard: ALL
; Revision Date 11 May 2018
; Creation Date: 11/07/2011
; Uses Neo's buy subs. Thanks neo
;==================================

Luna Reg Buyer:

This script will stand in the corner of the mage shop and buy regs from the mages/alchemists while hidden. It's been updated to reflect the changes made to the bank system.

Will not work with EJ accounts (if that's still a thing)

Code: [Select]
;==================================
; Script Name: Freddy's Luna Buyer
; Author: Freddy
; Version: 1.0
; Client Tested with: 5. Something
; EUO version tested with: 1.5 (Build 0064)
; Shard: ALL
; Revision Date 11 May 2018
; Creation Date: 11/07/2011
; Uses Neo's buy subs. Thanks neo
;==================================
set %vendor ; Item ID of the mage reg vendors separated with an underscore like xxxxx_xxxxx_xxxxx_
set %item_type_buy DPF_JUF_KZF_WZF_SZF_JZF_KUF_RZF_MZF_ ;these are all the mage regs ID, you can change it to buy whatever they sell. wont work with potions or spell scrolls tho blank scrolls work just fine
set %bank_container ; item id of a container in your bank to place the regs
set %keep_hidden #true ;set to false if you don't want to hide
set %delay_between_loops 60 ;in seconds the amount of time to wait after scanning every vendor
;-----------------------Don't edit below----------------------
;-------------------------------------------------------------
set #lpc 1000
gosub separate_string %item_type_buy _
for %u 1 %t_num
{
  set %item . %u %return . %u
}
set %itemcnt %t_num
set %t_num 0
gosub separate_string %vendor _
for %u 1 %t_num
{
  set %vendor . %u %return . %u
}
set %vendcnt %t_num
set %t_num 0
event macro 3 0 bank
wait 15
set %bankid #contid
mainloop:
for %vendor_buy 1 %vendcnt
{
  wait 15
  set %vendor %vendor . %vendor_buy
  for %itm 1 %itemcnt
  {
    wait 15
    if %keep_hidden = #true
    {
      while H notin #charstatus
      {
        event macro 13 21
        wait 12s
      }
    }
    gosub get_gold
    wait 10
    while #result <> #false
    {
      set %num 999
      set %buy_this %item . %itm
      if %buy_this in wuf_dpf
      {
        set %num #maxweight - #weight
      }
      if #gold < 2
        gosub get_gold
      event property %vendor
      if alchemist in #property
        set %position 5
      else
        set %position 2
      gosub buy %vendor %buy_this %num %position
      if #result = #true
      {
sto_loop:
        finditem %bank_container *
        if #findkind = -1
        {
          event macro 3 0 bank
          wait 1s
          set #lobjectid %bank_container
          wait 10
          event macro 17 0
          wait 1s
          goto sto_loop
        }
        finditem %buy_this C_ , #backpackid
        if #findkind <> -1
        {
          wait 20
          exevent drag #findid #findstack
          wait 12
          exevent dropc %bank_container
          wait 12
        }
      }
    }
  }
}
wait %delay_between_loops , s
goto mainloop
;-------------------------------------------------------------
;-------------------------------------------------------------
sub buy
  gosub buy_books %1 %2 %3 %4
  if #result = #true
    return #true
  else
  return #false
;-------------------------------------------------------------
;-------------------------------------------------------------
sub buy_books ;neo
  namespace push
  namespace local neobuy
  set !vendor %1
  set !buy %2
  set !amount %3
  set !buyposition %4
  set !shopyes #false
  finditem !vendor G_8
  repeat
    exevent popup #findid
    gosub gumpwait normal_gump null
    wait 5
    set !x #contposx + 30
    set !y #contposy + ( 20 * !buyposition )
    click !x !y f dmc
    gosub gumpwait bill_gump null
  until #result
  set !item_x #CONTPOSX + 11
  set !item_y #CONTPOSY - 150
  set !next_x #CONTPOSX + 71
  set !next_y #CONTPOSY - 15
  set !accept_x #CONTPOSX + 42
  set !accept_y #CONTPOSY + 205
  getshopinfo
  wait 5
  for !i 1 #shopcnt
  {
    getshopinfo
    set !shopid #shopitemid
    if #shopitemtype in !buy
    {
      set !shopyes #true
      for %x 1 3
        click !item_x !item_y f dmc
      getshopinfo
      wait 10
      if #shopItemMax < !amount
      {
        set !amount #shopItemMax
      }
      setShopItem #shopitemid !amount
      break
    }
    set %timer3 #scnt + 5
    repeat
      if #scnt > %timer3
        return #false
      click !next_x !next_y f dmc
      getshopinfo
      if #shopcnt = 0
        return #false
    until #shopitemid <> !shopid || !i = #shopcnt
  }
  click !accept_x !accept_y f dmc
  wait 20
  if !shopyes <> #true
    set #result #false
  if !shopyes
    set #result #true
  namespace pop
return #result
;-------------------------------------------------------------
;-------------------------------------------------------------
sub get_gold
  return
gloop:
  if #gold <= 4999
  {
    finditem POF C_ , %bankid
    for #findindex 1 #findcnt
    {
      if #findstack > 5000
      {
        set %get 5000 - #gold
        exevent drag #findid %get
        wait 12
        exevent dropc #backpackid
        wait 12
        return
      }
    }
    if #gold < 2000
    {
      finditem EWH C_ , %bankid
      if #findkind <> -1
      {
        for #findindex 1 #findcnt
        {
          event property #findid
          str len #property
          if #findcol = 52 && #strres >= 52
          {
            set #lobjectid #findid
            wait 10
            event macro 17 0
            wait 30
            goto gloop
          }
        }
      }
    }
    if #gold < 2000
    {
      set %get 5000 - #gold
      event macro 3 0 withdraw %get
      wait 15
    }
    if #gold < 2000
    {
      display You don't have any gold!
      halt
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;======= Gumpwait Sub ======= ;neo
sub gumpwait
  namespace push
  namespace local gumpwait
  set !contname %1
  set !contsize %2
  set !timeout #SCNT + 5
  if !contsize = null
  {
    repeat
    until #contname = !contname || #scnt >= !timeout
    {
      if #contname = !contname
      {
        namespace pop
        return #true
      }
      namespace pop
      return #false
    }
  }
  repeat
  until ( #contname = !contname && #contsize = !contsize ) || #scnt >= !timeout
  if #contname = !contname && #contsize = !contsize
  {
    namespace pop
    return #true
  }
  namespace pop
return #false
;======= End Sub =======