Wand Sorting and Combining Scripts

Discussion in 'Guides' started by fooka03, Jun 27, 2021.

  1. fooka03

    fooka03 Well-Known Member
    UO:R Subscriber

    Joined:
    Feb 10, 2013
    Messages:
    688
    Likes Received:
    432
    So in the first of hopefully a series of auto-sorting scripts I present to you my wand sorting and combining setup. As with anything that involves automating tedious but involved tasks, this is rather complicated in theory, implementation, and execution. Don't be discouraged if you have issues getting this working, post your questions and issues here and I'll try to answer them. Shameless ask for tips if you find this sort of thing useful.

    Theory

    The simple part of this task is the sorting piece. It's somewhat straightforward to think of sorting as three steps; pick up the thing, ID the thing, store the thing. To translate this into Razor concepts you're using a restock agent, using the item id skill on the restocked item, and then based on the text of the identification running a specific organizer. With there being four different wand item types, and eleven wand magic types, this corresponds to four restock agents and twelve organizer agents (a fireworks wand is still a wand, technically, so we want a dumping container for anything that falls outside of the main types just in case). If you're like me, you're not going to want to waste anything, even 1 charge of ID, so those organizer containers will be a permanent fixture in your home while the container you're sorting from will almost always be different as you drop off loot. The scripts take this concept into account and prompt you to choose what container you want to sort at each iteration of the loop.

    The next part of course is combining wands. To make this logic manageable, it is designed to run after wands are already sorted. Another optimization is to combine different item types of wands first, and then combining the remaining wands of a same type. With four types, the flow looks like this:
    • Combine 0DF2 with 0DF3
      • Combine 0DF2 with 0DF4 if we ran out of 0DF3 wands
        • Combine 0DF2 with 0DF5 if we ran out of 0DF4 wands
          • Combine remaining 0DF2 wands if we ran out of 0DF5 wands
          • Combine remaining 0DF5 wands if we ran out of 0DF2 wands
        • Combine 0DF4 with 0DF5 if we wan out of 0DF2 wands
          • Combine remaining 0DF4 wands if we ran out of 0DF5 wands
          • Combine remaining 0DF5 wands if we ran out of 0DF4 wands
      • Combine 0DF3 with 0DF4 if we ran out of 0DF2 wands
        • Combine 0DF3 with 0DF5 if we ran out of 0DF4 wands
          • Combine remaining 0DF3 wands if we ran out of 0DF5 wands
          • Combine remaining 0DF5 wands if we ran out of 0DF3 wands
        • Combine 0DF4 with 0DF5 if we wan out of 0DF
          • Combine remaining 0DF4 wands if we ran out of 0DF5 wands
          • Combine remaining 0DF5 wands if we ran out of 0DF4 wands
    As you can see here, the ending script is always a same type combination script and those do not result in a new script execution under any circumstance. If you follow along any of the paths, you can see at each level a type of wand has been complete used up until only one type remains, then that type is combined with itself.

    Implementation

    This is probably the section most people are interested in. I'm only going to post a representative script of each type here, otherwise download the bundle from the link at the end of the post for a complete set of scripts and razor profiles (one for sorting, one for combining).

    Sort 0DF2 Wands


    Code:
    clearsysmsg
    restock 3
    waitfortarget
    target 'sortbag'
    wait 1000
    while count 'Wand 0DF2' >= 1
    wait 9200
    skill 'itemidentification'
    waitfortarget
    clearsysmsg
    targettype 3570 backpack
    wait 1000
    if insysmsg 'arrow'
    organizer 1
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Magic Arrow Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-01'
        waitfortarget
        target 'storebag'
        organizer 1
        wait 1000
    endif
    elseif insysmsg 'mana'
    organizer 2
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Mana Drain Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-02'
        waitfortarget
        target 'storebag'
        organizer 2
        wait 1000
    endif
    elseif insysmsg 'identification'
    organizer 3
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New ID Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-03'
        waitfortarget
        target 'storebag'
        organizer 3
        wait 1000
    endif
    elseif insysmsg 'fireball'
    organizer 4
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Fireball Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-04'
        waitfortarget
        target 'storebag'
        organizer 4
        wait 1000
    endif
    elseif insysmsg 'weakness'
    organizer 5
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Weakness Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-05'
        waitfortarget
        target 'storebag'
        organizer 5
        wait 1000
    endif
    elseif insysmsg 'greater'
    organizer 7
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New GH Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-07'
        waitfortarget
        target 'storebag'
        organizer 7
        wait 1000
    endif
    elseif insysmsg 'healing'
    organizer 6
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Heal Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-06'
        waitfortarget
        target 'storebag'
        organizer 6
        wait 1000
    endif
    elseif insysmsg 'lightning'
    organizer 8
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Lightning Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-08'
        waitfortarget
        target 'storebag'
        organizer 8
        wait 1000
    endif
    elseif insysmsg 'feeblemindedness'
    organizer 9
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Feeble Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-09'
        waitfortarget
        target 'storebag'
        organizer 9
        wait 1000
    endif
    elseif insysmsg 'clumsi'
    organizer 10
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Clumsy Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-10'
        waitfortarget
        target 'storebag'
        organizer 10
        wait 1000
    endif
    elseif insysmsg 'harming'
    organizer 11
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Harming Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-11'
        waitfortarget
        target 'storebag'
        organizer 11
        wait 1000
    endif
    else
    overhead 'Unknown wand type'
    organizer 12
    wait 1000
    if insysmsg 'hold'
        overhead 'Select New Unknown Bag'
        setvar 'storebag'
        hotkey 'Set Organizer HotBag-12'
        waitfortarget
        target 'storebag'
        organizer 12
        wait 1000
    endif
    endif
    clearsysmsg
    restock 3
    waitfortarget
    target 'sortbag'
    wait 1000
    endwhile
    hotkey 'Play Script: sort_wand\0df3'
    Combine 0DF2 with 0DF3 wands

    Code:
    overhead 'Select Wand Store Container'
    
    setvar 'storebag'
    hotkey 'Set Organizer HotBag-01'
    waitfortarget
    target 'storebag'
    overhead 'Select Wand Stock Container'
    setvar 'sortbag'
    restock 1
    waitfortarget
    target 'sortbag'
    wait 1350
    while count 'Wand 0DF2' > 0
        if count 'Wand 0DF3' <= 0
            hotkey 'Play Script: sort_wand\squish 24'
        endif
        dclicktype '3570' backpack
        wait 670
        targettype '3571' backpack
        wait 670
        if count 'Wand 0DF2' > 0
            organizer 1
        endif
        restock 1
        waitfortarget
        target 'sortbag'
        wait 1350
    endwhile
    hotkey 'Play Script: sort_wand\squish 34'


    Combine 0DF2 wands

    While this script uses a pair of scissors to establish the last target, this can easily be replaced with any bladed weapon, axe, etc.

    Code:
    overhead 'Select Wand Store Container'
    setvar 'storebag'
    hotkey 'Set Organizer HotBag-01'
    waitfortarget
    target 'storebag'
    overhead 'Select Wand Stock Container'
    setvar 'sortbag'
    restock 7
    waitfortarget
    target 'sortbag'
    wait 1350
    while count 'Wand 0DF2' > 0
        useonce 'add'
        waitfortarget
        targettype '3570' backpack
        dress '0DF2'
        wait 670
        restock 7
        waitfortarget
        target 'sortbag'
        wait 1350
        if count 'Wand 0DF2' <= 0
            stop
        endif
        dclicktype 'scissors' backpack
        waitfortarget
        targettype '3570' backpack
        undress '0DF2'
        wait 670
        useonce
        waitfortarget
        target 'last'
        wait 670
        if count 'Wand 0DF2' >= 2
            lift 'last'
            wait 70
            drop 'storebag'
            wait 670
        endif
        restock 7
        waitfortarget
        target 'sortbag'
        wait 1350
    endwhile
    Scripts and Profiles

    Download Here!
    Crisco-Pjoe, Draccus, Sayer and 2 others like this.
  2. fooka03

    fooka03 Well-Known Member
    UO:R Subscriber

    Joined:
    Feb 10, 2013
    Messages:
    688
    Likes Received:
    432
    Reserved for execution notes, updates, and FAQ

Share This Page