Author Topic: Freddy Snippets  (Read 21178 times)

0 Members and 1 Guest are viewing this topic.

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Freddy Snippets
« on: November 12, 2011, 12:31:06 AM »
+1
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.


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #1 on: November 12, 2011, 12:33:56 AM »
+1
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


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #2 on: November 12, 2011, 12:34:51 AM »
+1
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




   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #3 on: November 12, 2011, 12:36:25 AM »
+1
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
        }
      }


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #4 on: November 12, 2011, 12:49:16 AM »
+1
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
;--------------------------------------------------------------
;--------------------------------------------------------------


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #5 on: November 12, 2011, 12:58:21 AM »
+1
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
;-------------------------------------------------------------
;-------------------------------------------------------------


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #6 on: November 12, 2011, 03:02:32 AM »
+1
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

« Last Edit: November 12, 2011, 12:50:42 PM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #7 on: November 12, 2011, 03:24:38 AM »
+1
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
« Last Edit: November 12, 2011, 12:50:23 PM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #8 on: November 12, 2011, 03:39:28 AM »
+1
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
« Last Edit: November 19, 2011, 09:40:46 PM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #9 on: November 19, 2011, 09:39:14 PM »
+1
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
;--------------------------------------------------------------
;--------------------------------------------------------------
« Last Edit: November 19, 2011, 10:11:24 PM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #10 on: November 20, 2011, 05:03:07 AM »
+1
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
;----------------------------------------------------------------------
;----------------------------------------------------------------------

« Last Edit: July 26, 2015, 10:59:01 AM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #11 on: November 21, 2011, 04:55:59 PM »
+1
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


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #12 on: November 21, 2011, 09:09:47 PM »
+1
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
;----------------------------------------------------------------------
;----------------------------------------------------------------------
« Last Edit: November 16, 2012, 06:04:11 PM by freddy »


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #13 on: April 25, 2012, 06:14:05 AM »
+1
Bug your beetle

This is a quick (aka ghetto) sub to bug your beetle so you can carry 60k boards. YOU NEED 2 ACCOUNTS TO BUG YOUR BEETLE

 

Setup:

Account 1 places fresh boards on the beetle. 2 vars need to be set for this to work. Var 1 is the item id of the container that holds your wood. Var 2 is the cont id of your beetle’s pack. This is not your beetles item id.   After vars are set, press play

Account 2 lifts the boards from the beetle pack and places it back once it detects boards have been dropped. You need to make sure EasyUO is set on the correct client. To do that, go to UOXL > swap to next client until you see the charname of the account you are using for account 2. Only 1 var needs to be set and that is the beetles pack cont id.

Press play.

 

These subs are pretty crude (as in i wrote them in 2 minutes), so they may not work for you

Account 1 - I realize the loop is messed up, but it kinda works right.
Code: [Select]
;Freddy winuo.net
set %beetleid XXXXXXXX ;beetle pack cont id NOT BEETLE ID
set %wood_container XXXXX ;container id for wood

while #true
{
  finditem TLK C_ , %wood_container
  if #findkind <> -1
  {
    for #findindex 1 #findcnt
    {
      if #findcol = 0
      {
        exevent drag #findid 1600
        wait 12
        exevent dropc %beetleid
        while #true
        {
          finditem TLK C_ , %beetleid
          if #findkind = -1
          {
            wait 5
            break
          }
        }
        break
      }
    }
  }
}
halt

Account 2
Code: [Select]
;freddy WinUO.net
set %beetleid XXXXXXXX ;beetle pack cont id NOT BEETLE ID

finditem TLK C_ , %beetleid
if #findkind <> -1
{
  exevent drag #findid #findstack
  wait 12
  while #true
  {
    finditem TLK C_ , %beetleid
    if #findkind <> -1
    {
      exevent dropc %beetleid
      wait 10
      break
    }
  }
}


   
   
My Scripts

Offline freddyTopic starter

  • Sr. Member
  • *
  • Posts: 259
  • Activity:
    0%
  • Reputation Power: 3
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Freddy Snippets
« Reply #14 on: April 25, 2012, 06:19:53 AM »
+1
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


   
   
My Scripts

Tags: