Official ScriptUO EasyUO Scripts > Script Snippets

Bag of Sending subs

(1/1)

TrailMyx:
What these do:
1) Hunts for a BOS with charges in your main pack (you may have more than one)
2) Sends whatever items you have in your send list (may have more than one ITEM type)

Now that the bag of sending is back, here's a sub to manipulate it:


--- Code: easyuo ---gosub SendItems POF_UJGstop;-----------------------------------; %1 - items to send; uses %weightwarn = #TRUE to indicate an overweight warning has been issued.;                    set to #FALSE to enable another warning.; Works on OSI & RunUO;; TrailMyx, Cervezasub SendItems  namespace push  namespace local SI  set !bos_items %1  SendItems_loop1:    finditem CKF C_ , #BACKPACKID    if #FINDKIND <> -1    {      event property #FINDID      if sending notin #PROPERTY      {        ignoreitem #FINDID        goto SendItems_loop1      }      set !bagofsending #FINDID      SendItems_loop2:        finditem !bos_items C_ , #BACKPACKID        if #FINDKIND <> -1        {          event property !bagofsending          str pos #PROPERTY Charges:          set #STRRES #STRRES + 9          str mid #PROPERTY #STRRES 1          if #STRRES = 0   ; as in zero charges          {            ignoreitem !bagofsending            goto SendItems_loop1          }          set #LOBJECTID !bagofsending          set #LTARGETID #FINDID          set #LTARGETKIND 1          event macro 17          wait 10          target 5s          event macro 22          wait 10          ignoreitem #FINDID          set %weightwarn #FALSE          goto SendItems_loop2        }        else        {          if ( #WEIGHT > ( #MAXWEIGHT - 10 ) ) || ( #WEIGHT > 425 )          {            display ok You are nearly overweight, but you have no selected$items to send.  Please unload manually.            set %weightwarn #TRUE            namespace pop            return          }        }    }    else    {      display ok No valid bags of sending in your main pack.$Please unload manually.      set %weightwarn #TRUE      namespace pop      return    }  set %weightwarn #FALSE  namespace popreturn 
Also, note you can adjust the target weight (currently set to 425)

These aren't the best, I may have some better ones lurking somewhere else.  But for now these should get you going.

craigtothed:
I would like to modify it to send from a sub pack but have been having trouble getting that to happen. This is what Ive added.


--- Code: ---set %lootbagid whaeva

Gosub Sendtems POF LOOTBAG  ; added a second parameter

;  Trailmyx Bag of Sending SUB
;
sub SendItems
  namespace push
  namespace local SI
  set !bos_items %1
  SendItems_loop1:
  finditem CKF C_ , #BACKPACKID
  if #FINDKIND <> -1
  {
    event property #FINDID
    if sending notin #PROPERTY
    {
      ignoreitem #FINDID
      goto SendItems_loop1
    }
    set !bagofsending #FINDID
SendItems_loop2:
    if %2 = LOOTBAG  ; sends from the lootbag instead of the main bag
    [
    finditem !bos_items C_ , %lootbagid     
    ]
    else
    [
    finditem !bos_items C_ , #BACKPACKID
    ]
 bla bla bla more code follows.   

--- End code ---

Is this close to correct or am I going about it all wrong?

TrailMyx:
Mostly right.  Be sure to change your [] to {}.  Also remember that you must open the loot bag first.  You won't get anything from finditem from a closed bag.

Tana:
Hey TM i know this is an old thread but i found this and wanted to use it myself. i modified it a bit im bug testing it now but what do you think?


--- Code: ---
sub weightcheck
  if %useBOS = #true
  {
    GOSUB senditems %senditem
  }
  finditem * c_ , %mapbag
  IF #findcnt > 110
  {
    gosub gohome
  }
return
;-----------------------------------------------------------------------------

sub SendItems
  namespace push
  namespace local SI
  set !bos_items %1
  SendItems_loop1:
    finditem CKF C_ , #BACKPACKID
    if #FINDKIND <> -1
    {
      event property #FINDID
      if sending notin #PROPERTY
      {
        ignoreitem #FINDID
        goto SendItems_loop1
      }
      set !bagofsending #FINDID
      SendItems_loop2:
        finditem !bos_items C_ , #BACKPACKID
        if #FINDKIND <> -1
        {
          event property !bagofsending
          str pos #PROPERTY Charges:
          set #STRRES #STRRES + 9
          str mid #PROPERTY #STRRES 1
          if #STRRES = 0   ; as in zero charges
          {
            ignoreitem !bagofsending
            goto SendItems_loop1
          }
        if #weight > ( #maxweight - 10 )
          {
          set #LOBJECTID !bagofsending
          set #LTARGETID #FINDID
          set #LTARGETKIND 1
          event macro 17
          wait 10
          target 5s
          event macro 22
          wait 10
          goto SendItems_loop2
          }
        }
    }
    ELSE
      {
      namespace pop
      set %useBOS #false
      return
      }
  }
return

--- End code ---

Navigation

[0] Message Index

Go to full version