<file_sep># in dress agent create one that is your player name
# without spaces and a 1 at the end.
# Example: "Player Name" needs to be playername1

msgcolor = 62
wep1 = Player.Name.lower().replace(' ', '') + '1'

Player.HeadMessage(msgcolor, "Weapon 1")
Dress.ChangeList(wep1)
Dress.DressFStart()
<file_sep># ButlerHelper by Spatchel & Matsamilla
# use with ButlerProfiles.py for best results, update butlerID with butler serial below

# Last updated 6/2/22

###########################################################
# Add your butlers serial below                           #
###########################################################

butlerID = 0x0029C3D1 #add your butler serial here

###########################################################
# Option to equip armor, bag regs & bag pots below        #
###########################################################

from System.Collections.Generic import List
import sys
# 4 = equip armor, 5 = bag regs, 6 = bag pots (switch = List[int]([0,4,5,6]) would do all
switch = List[int]([0,4])

###########################################################
# If you dont run ButlerProfiles.py, this will load       #
###########################################################
regs = 30 # default reg count if not profile
armor = 0 # default armor, 0=no 1=yes
cap = 0 # cap in default profile,  0=no 1=yes
bandies = 0 # default bandage count
arrows = 0
bolts = 0
cure = 10
heal = 10
refresh = 10

######## NO TOUCHY BELOW THIS #############################

butler = Mobiles.FindBySerial(butlerID)
randomPause = 150
player_bag = Items.FindBySerial(Player.Backpack.Serial)

if butler == None:
    Player.HeadMessage(33, 'Butler not found, stoppling')
    sys.exit()
while Player.DistanceTo(butler) > 2.5:
    if Timer.Check('butler') == False:
        Mobiles.Message(butler,33, 'Come closer to restock.')
        Timer.Create('butler',2500)

#moss count
if Misc.CheckSharedValue('moss'):
    moss6 = Misc.ReadSharedValue('moss')
else: 
    moss6 = regs
#ash count
if Misc.CheckSharedValue('ash'):
    ash7 = Misc.ReadSharedValue('ash')
else: 
    ash7 = regs   
# root count
if Misc.CheckSharedValue('root'):
    root8 = Misc.ReadSharedValue('root')
else: 
    root8 = regs
# pearl count
if Misc.CheckSharedValue('pearl'):
    pearl9 = Misc.ReadSharedValue('pearl')
else: 
    pearl9 = regs
#nightshade count
if Misc.CheckSharedValue('shade'):
    shade10 = Misc.ReadSharedValue('shade')
else: 
    shade10 = regs
# Ginseng count
if Misc.CheckSharedValue('ginseng'):
    ginseng11 = Misc.ReadSharedValue('ginseng')
else: 
    ginseng11 = regs 
# Garlic Count   
if Misc.CheckSharedValue('garlic'):
    garlic12 = Misc.ReadSharedValue('garlic')
else: 
    garlic12 = regs 
# Silk Count   
if Misc.CheckSharedValue('silk'):
    silk13 = Misc.ReadSharedValue('silk')
else: 
    silk13 = regs
# Armor
if Misc.CheckSharedValue('armor'):
    armorS = Misc.ReadSharedValue('armor')
    if cap:
        cap0 = armorS
    elif Player.CheckLayer('Helm'):
        cap0 = 0
    else:
        cap0 = 0
    gorget1 = armorS
    sleeves2 = armorS
    gloves3 = armorS
    if Player.CheckLayer("InnerTorso"):
        tunic4 = 0
    else:
        tunic4 = armorS
    if Player.CheckLayer("Pants"):
        legs5 = 0
    else:
        legs5 = armorS
else:
    if cap:
        cap0 = armor
    elif Player.CheckLayer('Helm'):
        cap0 = 0
    else:
        cap0 = 0
    gorget1 = armor
    sleeves2 = armor
    gloves3 = armor
    if Player.CheckLayer("InnerTorso"):
        tunic4 = 0
    else:
        tunic4 = armorS
    if Player.CheckLayer("Pants"):
        legs5 = 0
    else:
        legs5 = armorS
    
# Agility Pots Count    
if Misc.CheckSharedValue('agil'):
    agiImput = Misc.ReadSharedValue('agil')
else: 
    agiImput = 5
# Cure Pots Count    
if Misc.CheckSharedValue('cure'):
    cureImput = Misc.ReadSharedValue('cure')
else: 
    cureImput = 5
# Explode Pots Count
if Misc.CheckSharedValue('exp'):
    expImput = Misc.ReadSharedValue('exp')
else: 
    expImput = 0
# Heal Pots Count    
if Misc.CheckSharedValue('heal'):
    healImput = Misc.ReadSharedValue('heal')
else: 
    healImput = 5
# Deadlypoison Pots Count    
if Misc.CheckSharedValue('deadlypoison'):
    dpImput = Misc.ReadSharedValue('deadlypoison')
else: 
    dpImput = 0
# Refresh Pots Count
if Misc.CheckSharedValue('refresh'):
    refreshImput = Misc.ReadSharedValue('refresh')
else: 
    refreshImput = 5
# Strength Pots Count
if Misc.CheckSharedValue('str'):
    strImput = Misc.ReadSharedValue('str')
else: 
    strImput = 5
# Bandages Count    
if Misc.CheckSharedValue('bandies'):
    bandages21 = Misc.ReadSharedValue('bandies')
else: 
    bandages21 = bandies
# Arrows
if Misc.CheckSharedValue('arrows'):
    arrows25 = Misc.ReadSharedValue('arrows')
else: 
    arrows25 = arrows    
# Bolts
if Misc.CheckSharedValue('bolts'):
    bolts26 = Misc.ReadSharedValue('bolts')
else: 
    bolts26 = bolts

def dumpBottles():
    for i in player_bag.Contains:
        if i.ItemID == 0x0F0E:
            Items.Move(i, butlerID, 0)
            Misc.Pause(600)
def butler():
    global saveSwitch
    Mobiles.UseMobile(butlerID)
    Gumps.WaitForGump(989312372, 2000)
    if Gumps.LastGumpTextExist( 'Remove Leather Tub?' ):
        Misc.SendMessage('Leather Tub Detected')
        saveSwitch = 5
        withdrawSwitch = 8
    else:
        saveSwitch = 3
        withdrawSwitch = 6
    
    #################### Armor #######################################
    textid = List[int]([0])
    text = List[str]([str(cap0)])
    saveProfile(textid, text)

    textid = List[int]([1])
    text = List[str]([str(gorget1)])
    saveProfile(textid, text)
    
    textid = List[int]([2])
    text = List[str]([str(sleeves2)])
    saveProfile(textid, text)
    
    textid = List[int]([3])
    text = List[str]([str(gloves3)])
    saveProfile(textid, text)
    
    textid = List[int]([4])
    text = List[str]([str(tunic4)])
    saveProfile(textid, text)
    
    textid = List[int]([5])
    text = List[str]([str(legs5)])
    saveProfile(textid, text)
    
    #################### REGS #######################################
    # Moss
    textid = List[int]([6])
    text = List[str]([str(moss6)])
    saveProfile(textid, text)
    
    #Ash
    textid = List[int]([7])
    text = List[str]([str(ash7)])
    saveProfile(textid, text)
    
    #Root
    textid = List[int]([8])
    text = List[str]([str(root8)])
    saveProfile(textid, text)
    
    #Pearl
    textid = List[int]([9])
    text = List[str]([str(pearl9)])
    saveProfile(textid, text)
    
    #Nightshade
    textid = List[int]([10])
    text = List[str]([str(shade10)])
    saveProfile(textid, text)
    
    #Ginseng
    textid = List[int]([11])
    text = List[str]([str(ginseng11)])
    saveProfile(textid, text)
    
    #garlic
    textid = List[int]([12])
    text = List[str]([str(garlic12)])
    saveProfile(textid, text)
    
    #SpidersSilk
    textid = List[int]([13])
    text = List[str]([str(silk13)])
    saveProfile(textid, text)
    
    #################### Potions ###################################
    # Cure 
    textid = List[int]([14])
    text = List[str]([str(cureImput)])
    saveProfile(textid, text)

    # Agility
    textid = List[int]([15])
    text = List[str]([str(agiImput)])
    saveProfile(textid, text)

    #Strength
    textid = List[int]([16])
    text = List[str]([str(strImput)])
    saveProfile(textid, text)
    
    #Deadlypoison 
    textid = List[int]([17])
    text = List[str]([str(dpImput)])
    saveProfile(textid, text)

    #Heal
    textid = List[int]([19])
    text = List[str]([str(healImput)])
    saveProfile(textid, text)

    #Refresh
    textid = List[int]([18])
    text = List[str]([str(refreshImput)])
    saveProfile(textid, text)
  
    #Explode
    textid = List[int]([20])
    text = List[str]([str(expImput)])
    saveProfile(textid, text)
    
    #################### Bandages ###################################
    textid = List[int]([21])
    text = List[str]([str(bandages21)])
    saveProfile(textid, text)
    
    #################### Petals #####################################
    textid = List[int]([23])
    text = List[str]([str(0)])
    saveProfile(textid, text)
    
    textid = List[int]([25])
    text = List[str]([str(arrows25)])
    saveProfile(textid, text)
    
    #################### Arrows/Bolts ###############################
    textid = List[int]([26])
    text = List[str]([str(bolts26)])
    saveProfile(textid, text)

    Gumps.WaitForGump(989312372, 2000)
    #Gumps.SendAction(989312372, withdrawSwitch)
    Gumps.SendAdvancedAction(989312372, withdrawSwitch, switch)
    
def saveProfile(textid, text):
    if Gumps.CurrentGump() != 989312372:
        tempGump = Gumps.CurrentGump()
        Gumps.CloseGump(tempGump)
        Mobiles.UseMobile(butlerID)
    Gumps.WaitForGump(989312372, 2000)
    Gumps.SendAdvancedAction(989312372, saveSwitch, switch, textid, text)
    Misc.Pause(randomPause)

dumpBottles()
butler()
<file_sep># Bandage script by Matsamilla
# Relys on Bandage_Timer.py, without it it will not stop applying bandages.

# Pause at start for skill check,
# Script stops if no healing on toon.
import sys
Misc.Pause( 5000 )
if Player.GetRealSkillValue( 'Healing' ) < 50:
    Misc.SendMessage( 'No Healing, stopping script',33)
    Misc.Pause( 200 )
    sys.exit()


def BandageSelf():
    if Misc.ReadSharedValue('bandageDone') == True:
        lastTarget = Target.GetLast()
        while Target.HasTarget():
            Misc.Pause(10)
        Items.UseItemByID(0x0E21, 0)
        Target.WaitForTarget(1500, False)
        Target.Self()
        Misc.Pause (500)
        
        Target.SetLast(lastTarget)

Timer.Create( 'outOfBandageWarningIncrement', 1 )
while True:
    # make sure Bandage_Timer.py is running, script will not run
    # correctly if timer is not running.
    if not Misc.ScriptStatus('Bandage_Timer.py'):
        Misc.ScriptRun('Bandage_Timer.py')
    
    if Player.IsGhost:
        # Player died, wait until Player is resurrected
        while Player.IsGhost:
            Misc.Pause( 100 )
    
    # Checks for bandages
    if Items.BackpackCount( 0x0E21 ,-1 ):
        # only apply bandage if player is not hidden, damaged or poisoned and not one already applying.
        if Player.Visible == True and Player.Hits < Player.HitsMax or Player.Poisoned and Misc.CheckSharedValue('bandageDone') == True:
            BandageSelf()
    # if no bandages, warn player.
    elif Timer.Check( 'outOfBandageWarningIncrement' ) == False:
        Player.HeadMessage( 1100, 'Out of bandages!' )
        Timer.Create( 'outOfBandageWarningIncrement', 5000 )

    Misc.Pause( 50 )
<file_sep># Drag-Drop organizer by Mourn
# contributions by MatsaMilla
# adjust to your servers drag delay in ms
dragDelay = 600

import sys
startX = 0
startY = 0
verticalIncrement = 0
horizontalIncrement = 5
endX = 0
endY = 0
item = Items.FindBySerial( Target.PromptTarget( 'Choose type' ))
container = Items.FindBySerial( item.Container )
itemID = item.ItemID
itemHue = item.Hue
destPrompt = Target.PromptTarget( 'Chose Destination' )
itemsToMove = []
# gems
gems = [0x0F19, 0x0F25, 0x0F13, 0x0F16, 0x0F21, 0x0F26, 0x0F15, 0x0F2D, 0x0F10]
#glowing runes
glowingRunes = [0x483b, 0x483e, 0x4841, 0x4844, 0x4847, 0x484a, 0x484d,
 0x4850, 0x4853, 0x4856, 0x4859, 0x485c, 0x485f, 0x4862, 0x4865, 0x4868, 
 0x486b, 0x486e, 0x4871, 0x4874, 0x4877, 0x487a, 0x487d, 0x4880, 0x4883]
#Regs
regs = [0x0F86, 0x0F88, 0x0F8D, 0x0F85,0x0F7B, 0x0F84, 0x0F8C, 0x0F7A]

#Misc.SendMessage(str(dest))

def getSize(container):
    global startX
    global startY
    global endX
    global endY
    global verticalIncrement
    global horizontalIncrement
    
    if "backpack" in container.Name:
        Misc.SendMessage("Setting size to Backpack or a Pouch")
        startX = 45
        startY = 75
        endX = 160
        endY = 150
        verticalIncrement = 20
    elif "pouch" in container.Name:
        Misc.SendMessage("Setting size to Pouch")
        startX = 45
        startY = 75
        endX = 160
        endY = 150
        verticalIncrement = 20
    elif "bag" in container.Name:
        Misc.SendMessage("Setting size to Bag")
        startX = 30
        startY = 40
        endX = 115
        endY = 120
        verticalIncrement = 20
    elif "ornate" in container.Name:
        Misc.SendMessage("Setting size to Box")
        startX = 15
        startY = 50
        endX = 155
        endY = 120
        verticalIncrement = 20
    elif "wooden box" in container.Name:
        Misc.SendMessage("Setting size to Box")
        startX = 15
        startY = 50
        endX = 155
        endY = 120
        verticalIncrement = 20
    elif "metal chest" in container.Name:
        Misc.SendMessage("Setting size to Metal Chest")
        startX = 20
        startY = 105
        endX = 135
        endY = 150
        verticalIncrement = 10
    else:
        Misc.SendMessage("Setting size to Unknown")
        startX = 50
        startY = 50
        endX = 115
        endY = 120
        verticalIncrement = 20
        
if destPrompt == Player.Serial:
    dest = Player.Backpack.Serial
    Misc.SendMessage("Setting size to Backpack")
    startX = 45
    startY = 75
    endX = 160
    endY = 150
    verticalIncrement = 20
else:
    dest = Items.FindBySerial( destPrompt )
    getSize(dest)
        
if item.ItemID in gems:
    for items in container.Contains:
        if items.ItemID in gems:
            Items.Move(items,dest,0)
            Misc.Pause(600)
    sys.exit()
elif item.ItemID in glowingRunes:
    for items in container.Contains:
        if items.ItemID in glowingRunes:
            Items.Move(items,dest,0)
            Misc.Pause(600)
    sys.exit()
elif item.ItemID in regs:
    for items in container.Contains:
        if items.ItemID in regs:
            Items.Move(items,dest,0)
            Misc.Pause(600)
    sys.exit()
else:
    for items in container.Contains:
        if items.ItemID == itemID and items.Hue == itemHue :
            itemsToMove.append( items.Serial )


x = startX
y = startY
total = len( itemsToMove )
timeToMove = ( total * dragDelay ) / 1000

Player.HeadMessage( 66, "Moving " + str( total ) + ' Items' )
Misc.Pause( 200 )
Player.HeadMessage( 66, str( timeToMove ) + ' Seconds' )
Journal.Clear()
        
for items in itemsToMove:
    if x > endX:
        x = startX
        y = y + verticalIncrement
    if y >= endY:
        y = startY + verticalIncrement
    Items.Move( items , dest , 0 , x , y )
    Misc.Pause( dragDelay )
    x = x + horizontalIncrement
    if Journal.Search('That container cannot hold more items.'):
        Player.HeadMessage( 66, "Container full, stopping" )
        Journal.Clear()
        sys.exit()
    
Player.HeadMessage( 76 ,'Items have been moved' )
<file_sep># Trains Magery to GM
# Change resistTrain to True if you are training resist and/or
#   don't want to take damage
# False will make it cast dmg spells on yourself, which use less regs.
#    but require someone healing you, or you to have healing.
# By MatsaMilla

resistTrain = True
# ------------------------------------
self = Player.Serial
pearl = 0x0F7A
root = 0x0F86
shade = 0x0F88
silk = 0x0F8D
moss = 0x0F7B
ginseng = 0x0F85
garlic = 0x0F84
ash = 0x0F8C

import sys
def trainMageryNoResist():
    while Player.Hits < 45:
        Misc.Pause(100)
    
    if Player.GetRealSkillValue('Magery') < 35:
        Misc.SendMessage('Go buy Magery skill!!')
        sys.exit()
    elif Player.GetRealSkillValue('Magery') < 65:
        Spells.CastMagery('Mind Blast')
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    elif Player.GetRealSkillValue('Magery') < 85:
        Spells.CastMagery('Energy Bolt')
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    elif Player.GetRealSkillValue('Magery') < 100:
        Spells.CastMagery("Flamestrike")
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    
    if Player.Mana < 40:
        Player.UseSkill('Meditation')
        while Player.Mana < Player.ManaMax:
            if (not Player.BuffsExist('Meditation') and not Timer.Check('skillTimer')):
                Player.UseSkill('Meditation')
                Timer.Create('skilltimer', 11000)
            Misc.Pause(100)
    

def trainMage():
    if Player.GetRealSkillValue('Magery') < 35:
        Misc.SendMessage('Go buy Magery skill!!')
        sys.exit()
    elif Player.GetRealSkillValue('Magery') < 55:
        Spells.CastMagery('Mana Drain')
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    elif Player.GetRealSkillValue('Magery') < 75:
        Spells.CastMagery('Invisibility')
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    elif Player.GetRealSkillValue('Magery') < 100:
        Spells.CastMagery('Mana Vampire')
        Target.WaitForTarget(2500)
        Target.TargetExecute(self)
        Misc.Pause(2500)
    if Player.Mana < 40:
        Player.UseSkill('Meditation')
        while Player.Mana < Player.ManaMax:
            if (not Player.BuffsExist('Meditation') and not Timer.Check('skillTimer')):
                Player.UseSkill('Meditation')
                Timer.Create('skilltimer', 11000)
            Misc.Pause(100)
            
def checkRegs():
    if Items.BackpackCount(pearl, -1) < 2:
        Misc.SendMessage('Low on Pearl!')
        sys.exit()
    elif Items.BackpackCount(root, -1) < 2:
        Misc.SendMessage('Low on Root!')
        sys.exit()
    elif Items.BackpackCount(shade, -1) < 2:
        Misc.SendMessage('Low on Shade!')
        sys.exit()
    elif Items.BackpackCount(silk, -1) < 2:
        Misc.SendMessage('Low on Silk!')
        sys.exit()
    elif Items.BackpackCount(garlic, -1) < 2:
        Misc.SendMessage('Low on Garlic!')
        sys.exit()
    elif Items.BackpackCount(ash, -1) < 2:
        Misc.SendMessage('Low on Ash!')
        sys.exit()
    elif Items.BackpackCount(silk, -1) < 2:
        Misc.SendMessage('Low on Silk!')
        sys.exit()
    elif Items.BackpackCount(ginseng, -1) < 2:
        Misc.SendMessage('Low on Ginseng!')
        sys.exit()

Journal.Clear()
while Player.GetRealSkillValue('Magery')  < 100:
    if resistTrain:
        trainMage()
    else:       
        trainMageryNoResist()
    checkRegs()
    
Player.ChatSay(33, 'GM Magery')
<file_sep>def writeautofill(x):
    f = open('C:/Users/Jason/PycharmProjects/BodBot/smithautofill.txt', 'a')        
    f.write(str(x))
    f.close()   
def writegarbo(x):
    f = open('C:/Users/Jason/PycharmProjects/BodBot/smithgarbo.txt', 'a')        
    f.write(str(x))
    f.close()   
def stringtest(x):
    bodList = Items.GetPropStringList(x)
    f = open('C:/Users/Jason/PycharmProjects/BodBot/test.txt', 'a')        
    f.write(str(bodList))
    f.close()  
    
    
    
def getstringofbod(bod):
        result= ""
        bodList = Items.GetPropStringList(bod)
        for i in range(0, len(bodList)):
            result = result + bodList[i]
            
        result = result.replace("[","")
        result = result.replace("]","")
        result = result.replace(" deedBlessed<BASEFONT COLOR=#585868> Hue: 1102 <BASEFONT COLOR=#FFFFFF>Weight: 1 stone","")
        result = result.replace("bulk orderAll items must be","")
        result = result.replace(".All items must be made with","")
        result = result.replace(".amount to make:","")
        result = result.replace("a bulk order","")
        
        result = result + '\n'
        return result
        

               
def comparetolist(input):
    filepath = 'C:/Users/Jason/PycharmProjects/BodBot/' + input + ".txt"
    f = open(filepath, 'r')        
    allinlist = f.readlines()
    f.close()
  
    #Player.HeadMessage(54, str(len(allinlist)))
    for i in range(0, len(allinlist)):
        #Player.HeadMessage(54, str(allinlist[i]))
        #Player.HeadMessage(54, str(getstringofbod(0x44D90146)))
        if getstringofbod(0x44D90146) == allinlist[i]:
            Player.HeadMessage(54, "yes")
        else:
            Player.HeadMessage(54, "No")

            #writeautofill(getstringofbod(0x444785C5))    

#bod = 0x47842EEF    #lbod        
#bod = 0x479CFE6D
#bod = 0x47079787 #femail plate
bod = Target.PromptTarget("select bod to trash")
#bod =0x41104ADC
#writeautofill(getstringofbod(bod)) #adds to autofill
writegarbo(getstringofbod(bod)) #adds to garbo list
#stringtest(bod) #prints raw string to test.txt

    
    <file_sep># Runebook copy by Wardoctor. Upated by MatsaMilla
# Last update: 12/9/21

# If copying a locked down book, DO THIS BEFORE STARTING
#   Mark a rune for a location close to runebook being copied
#
#   Put this rune into a book for safe keeping (runes are not blessed, runebooks are)
#   Set the rune as the default location for the book
#   Select the correct book when the target comes up for Select item to recall off of to return to runebook being copied


def PromptRunebook( promptString ):
    runebookSerial = Target.PromptTarget( promptString )
    runebook = Items.FindBySerial( runebookSerial )

    if runebook == None or runebook.ItemID != 0x22C5:
        Player.HeadMessage( 33, 'That is not a runebook!' )
        return None
    else:
        return runebook


def GetNamesOfRunesInBook( runebook ):
    Items.UseItem( runebook )

    # Pause here since the next part goes pretty quick
    Misc.Pause( 650 )

    Gumps.WaitForGump( 1431013363, 5000 )
    while Gumps.CurrentGump() != 1431013363:
        Player.HeadMessage( 33, 'Too far from runebook to copy, please move closer.' )
        Misc.Pause( 1000 )
        Items.UseItem( runebook )
        Gumps.WaitForGump( 1431013363, 5000 )

    runeNames = []
    lineList = Gumps.LastGumpGetLineList()

    # Remove the default 3 lines from the top of the list
    lineList = lineList[ 3 : ]

    # Remove the items before the names of the runes
    endIndexOfDropAndDefault = 0
    for i in range( 0, len( lineList ) ):
        if lineList[ i ] == 'Set default' or lineList[ i ] == 'Drop rune':
            endIndexOfDropAndDefault += 1
        else:
            break

    # Add two for the charge count and max charge numbers
    endIndexOfDropAndDefault += 2
    runeNames = lineList[ endIndexOfDropAndDefault : ( endIndexOfDropAndDefault + 16 ) ]
    runeNames = [ name for name in runeNames if name != 'Empty' ]

    return runeNames


def GetNumberOfRunesInBook( runebook ):
    return len( GetNamesOfRunesInBook( runebook ) )


def CopyRunebookName( runebookToCopy, runebookToPlaceIn, runebookMoveable ):
    Journal.Clear()
    if Gumps.CurrentGump() == 1431013363:
        Gumps.WaitForGump( 1431013363, 1000 )
        Gumps.SendAction( 1431013363, 0 )

    Items.SingleClick( runebookToCopy.Serial )
    Misc.Pause( 200 )
    runebookName = None
    if runebookMoveable:
        for line in Journal.GetTextByType( 'Label' ):
            if '[' in line:
                bracketIndex = line.find( '[' )
                runebookName = line[ 0 : ( bracketIndex - 1 ) ]
    else:
        journalText = Journal.GetTextByType( 'Label' )
        journalText.Reverse()
        runebookName = journalText[ 0 ]

    if runebookName != None and runebookName != '':
        Items.UseItem( runebookToPlaceIn )
        Gumps.WaitForGump( 1431013363, 10000 )
        Misc.Pause( 200 )
        Gumps.SendAction( 1431013363, 1 )
        Misc.WaitForPrompt( 1000 )
        Misc.ResponsePrompt( runebookName )
        Gumps.WaitForGump( 1431013363, 1000 )
        Gumps.SendAction( 1431013363, 0 )


def CopyRunebook():
    global runebookToCopy
    global runebookToPlaceIn

    runebookToCopy = PromptRunebook( 'Select the runebook to copy from' )
    if runebookToCopy == None:
        return

    runebookToPlaceIn = PromptRunebook( 'Select the runebook to copy to' )
    if runebookToPlaceIn == None:
        return

    # Test if the runebook is locked down or not
    Journal.Clear()
    runebookMoveable = True
    recallRunebook = None
    if runebookToCopy.RootContainer != Player.Serial:
        Items.Move( runebookToCopy, Player.Backpack, 0 )
        Misc.Pause( 650 + 100 ) # plus 100 to be extra safe

        runebookToCopy = Items.FindBySerial( runebookToCopy.Serial )

        if runebookToCopy.RootContainer != Player.Backpack.Serial:
            runebookMoveable = False
            recallRunebook = Target.PromptTarget( 'Select item to recall off of to return to runebook being copied' )

    numberOfRunesInOldBook = GetNumberOfRunesInBook( runebookToCopy )
    numberOfRunesInNewBook = GetNumberOfRunesInBook( runebookToPlaceIn )
    runeNames = GetNamesOfRunesInBook( runebookToCopy )

    Misc.SendMessage( '# of runes to copy: %i' % numberOfRunesInOldBook )
    Misc.SendMessage( '# of runes already copied: %i' % numberOfRunesInNewBook )
    numberOfRunesToBeMarked = numberOfRunesInOldBook - numberOfRunesInNewBook

    # Make sure we have enough runes to be marked
    blankRuneBagSerial = Target.PromptTarget( 'Select bag with empty runes' )
    blankRuneBag = Items.FindBySerial( blankRuneBagSerial )
    if blankRuneBag == None or not blankRuneBag.IsContainer:
        Player.HeadMessage( 33, 'Invalid item selection!' )
        return

    numberOfBlankRunes = 0
    for item in blankRuneBag.Contains:
        if item.ItemID == 0x1F14:
            numberOfBlankRunes += 1

    if numberOfRunesToBeMarked > numberOfBlankRunes:
        Player.HeadMessage( 33, 'You don\'t have enough blank runes to copy this book! You need %i more runes' % ( numberOfRunesToBeMarked - numberOfBlankRunes ) )
        return

    # Copy the runebook
    for i in range( numberOfRunesInNewBook, numberOfRunesInOldBook ):
        Items.UseItem( runebookToCopy )
        Misc.Pause( 650 )
        Gumps.WaitForGump( 1431013363, 5000 )

        if i == 0:
            Gumps.SendAction( 1431013363, 5 )
        else:
            Gumps.SendAction( 1431013363, ( 5 + ( i * 6 ) ) )

        Timer.Create( 'spellCooldown', 2500 )
        Misc.Pause( 100 )
        playerPosition = Player.Position

        runeToMark = Items.FindByID( 0x1F14, -1, blankRuneBag.Serial )

        while Timer.Check( 'spellCooldown' ):
            Misc.Pause( 50 )

        markScrolls = Items.FindByID( 0x1F59, 0x0000, Player.Backpack.Serial )
        if markScrolls != None:
            Items.UseItem( markScrolls )
            Timer.Create( 'markScrollDragDelay', 650 )
        else:
            Spells.CastMagery( 'Mark' )

        Target.WaitForTarget( 2000, True )
        Target.TargetExecute( runeToMark )

        if markScrolls != None and Timer.Check( 'markScrollDragDelay' ):
            while Timer.Check( 'markScrollDragDelay' ):
                Misc.Pause( 20 )
        elif markScrolls == None:
            Timer.Create( 'spellCooldown', 1800 )

        Items.UseItem( runeToMark )

        Misc.WaitForPrompt( 1000 )
        Misc.ResponsePrompt( runeNames[ i ] )
        Misc.Pause( 650 )

        Items.Move( runeToMark, runebookToPlaceIn, 0 )
        Misc.Pause( 650 )

        if runebookMoveable:
            if Player.Mana < 41:
                Player.UseSkill( 'Meditation' )
                while Player.Mana < ( Player.ManaMax - 3 ):
                    Misc.Pause( 50 )

            while Timer.Check( 'spellCooldown' ):
                Misc.Pause( 50 )
        else:
            while Timer.Check( 'spellCooldown' ):
                Misc.Pause( 50 )

            Spells.CastMagery( 'Recall' )
            Target.WaitForTarget( 15000, False )
            Target.TargetExecute( recallRunebook )

            Player.HeadMessage( 44, 'Move within recall range of the runebook being copied' )
            Timer.Create( 'messageCooldown', 2000 )
            while not Player.InRangeItem( runebookToCopy, 1 ):
                Misc.Pause( 100 )
                if not Timer.Check( 'messageCooldown' ):
                    Player.HeadMessage( 44, 'Move within recall range of the runebook being copied' )
                    Timer.Create( 'messageCooldown', 2000 )

            if Player.Mana < 42: # 42 = 11 for 2 Recalls and 20 for one Mark
                Player.HeadMessage( 44, 'Meditating' )
                Player.UseSkill( 'Meditation' )
                while Player.Mana < ( Player.ManaMax - 3 ):
                    if not Player.BuffsExist( 'Meditation' ):
                        Player.UseSkill( 'Meditation' )
                    Misc.Pause( 50 )

    Misc.Pause( 650 )
    CopyRunebookName( runebookToCopy, runebookToPlaceIn, runebookMoveable )

    Player.HeadMessage( 33, 'Done copying runebook!' )
    Misc.Beep()


runebookToCopy = None
runebookToPlaceIn = None
CopyRunebook()
<file_sep># Bent Rod Crafter by MatsaMilla
# Last edit: Matsamilla 6/4/19

# Moves bent rods to beetle

from System.Collections.Generic import List
import winsound
import sys
#***************SETUP SECTION**********************************
#ItemSerials
beetle = 0x00215F22
keepGM = False # true to keep all GM rods too
keepCount = 30 # how many GM rods to keep
#**************************************************************

error = "Sounds2\error.wav"
dragTime = 600
saw = 0x1034
tink = 0x1EB8
cloth = 0x1766
wood = 0x1BD7
logs = 0x1BDD
ignot = 0x1BF2
pole = 0x0DBF
noColor = 0x0000
self_pack = Player.Backpack.Serial
self = Player.Serial
gmCount = 0

# Use neraby trashcan
trashBarrelFilter = Items.Filter()
trashBarrelFilter.OnGround = 1
trashBarrelFilter.Movable = False
trashBarrelFilter.RangeMin = 0
trashBarrelFilter.RangeMax = 2
trashBarrelFilter.Graphics = List[int]( [ 0x0E77 ] )
trashBarrelFilter.Hues = List[int]( [ 0x03B2 ] )
trashcanhere = Items.ApplyFilter( trashBarrelFilter )

if trashcanhere:
    global trashcan
    for t in trashcanhere:
        trashcan = t
else:
    Misc.SendMessage('No trashcan nearby, stopping',33)
    sys.exit()

if keepGM:
    Mobiles.UseMobile(self)
    Misc.Pause(dragTime)
    Mobiles.SingleClick(beetle)
    Misc.WaitForContext(beetle, 1500)
    Misc.ContextReply(beetle, "Open Backpack")
    Misc.Pause(dragTime)
    gmBag = Target.PromptTarget('Select Bag for GM Rods')
    
def moveToBeetle():
    global gmCount
    if keepGM:
        if gmRod:
            gmCount = gmCount +1
            Misc.SendMessage(gmCount)
            if Player.Mount:
                Mobiles.UseMobile(self)
                Misc.Pause(dragTime)
                Items.Move(bentRod, gmBag, 1)
                Misc.Pause(dragTime)
                Mobiles.UseMobile(beetle)
                Misc.Pause(dragTime)
            if gmCount == keepCount:
                Misc.SendMessage('GM Rod Count Reached, stopping.',33)
                winsound.PlaySound(error, winsound.SND_FILENAME)
                sys.exit()
        else:
            if Player.Mount:
                Mobiles.UseMobile(self)
                Misc.Pause(dragTime)
                Items.Move(bentRod, beetle, 1)
                Misc.Pause(dragTime)
                Mobiles.UseMobile(beetle)
                Misc.Pause(dragTime)
        
    else:
        if Player.Mount:
            Mobiles.UseMobile(self)
            Misc.Pause(dragTime)
            Items.Move(bentRod, beetle, 1)
            Misc.Pause(dragTime)
            Mobiles.UseMobile(beetle)
            Misc.Pause(dragTime)
        
def trashPole():
    if trashcan:
        Items.Move(bentRod, trashcan.Serial, 1)
        Misc.Pause(dragTime)
    else:
        Misc.SendMessage('No trashcan nearby, stopping',33)
        sys.exit()
    
def hide():
    if not Player.BuffsExist('Hiding'):
        Player.UseSkill('Hiding')

def checkMats():
    if Items.BackpackCount(cloth, -1) < 5:
        Misc.SendMessage('Out of Cloth',33)
        winsound.PlaySound(error, winsound.SND_FILENAME)
        sys.exit()
        
    if Items.BackpackCount(wood, -1) < 5 and Items.BackpackCount(logs, -1) < 5:
        Misc.SendMessage('Out of Wood',33)
        winsound.PlaySound(error, winsound.SND_FILENAME)
        sys.exit()
        
    if Items.BackpackCount(saw, noColor) < 1:
        craftTools()
            
def craftTools():
    currentTink = Items.FindByID(tink, -1, -1)
    
    if Items.BackpackCount(ignot, noColor) < 10:
        Misc.SendMessage('Out of Ignots',33)
        winsound.PlaySound(error, winsound.SND_FILENAME)
        sys.exit()
    
    if Items.BackpackCount(tink, noColor) < 2:
        Items.UseItem(currentTink.Serial)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 8)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 23)

    if Items.BackpackCount(saw, noColor) < 1:
        Items.UseItem(currentTink.Serial)
        Gumps.WaitForGump(949095101,1500)
        Gumps.SendAction(949095101, 8)
        Gumps.WaitForGump(949095101,1500)
        Gumps.SendAction(949095101, 51)

def craftPole():
    if not Player.Mount:
        Mobiles.UseMobile(beetle)
        Misc.Pause(dragTime)
    currentSaw = Items.FindByID(saw, -1, -1)
    if currentSaw:
        Items.UseItem(currentSaw)
        Gumps.WaitForGump(949095101,1500)
        Gumps.SendAction(949095101, 22)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 37)
        Misc.Pause(2000)
    
def bentRodCheck():
    global bentRod
    global gmRod
    bentRod = Items.FindByID(pole, -1, self_pack)
    gmRod = False
    
    
    if bentRod:
        if keepGM:
            Items.SingleClick(bentRod.Serial)
            Misc.Pause(dragTime)
            if Journal.Search('a bent rod'):
                moveToBeetle()
                Journal.Clear()
            elif Journal.Search('Exceptional'):
                gmRod = True
                moveToBeetle()
                Journal.Clear()
            else:
                trashPole()
        else:
            Items.SingleClick(bentRod.Serial)
            Misc.Pause(dragTime)
            if Journal.Search('a bent rod'):
                moveToBeetle()
                Journal.Clear()
            else:
                trashPole()
            
while True:
    Journal.Clear()
    if Player.GetRealSkillValue('Hiding') > 30:
        hide() 
    checkMats()           
    craftPole()
    while Items.BackpackCount(pole, -1) > 0:
        bentRodCheck()
<file_sep>Player.ChatSay(5, "Right One")<file_sep>restockBeetle = False

amountToMake = 10000
restockChestSerial = 0x43510513
dragTime = 600
bp = 0x0F7A
bm = 0x0F7B
mr = 0x0F86
pen = 0x0FBF
scroll = 0x0EF3
recall = 0x1F4C
noColor = 0x0000
pack = Player.Backpack.Serial

beetle = 0x0023F0A0
beetleContainer = 0x439F1BD4 # Inspect item in beetle to get container


restockChest = Items.FindBySerial(restockChestSerial)

import sys
def craftRecall():
    #pens = Items.FindByID(0x0FBF,-1,pack)
    pens = FindItem(0x0FBF, Player.Backpack)
    Items.UseItem(pens)
    Gumps.WaitForGump(949095101, 2000)
    Gumps.SendAction(949095101, 22)
    Gumps.WaitForGump(949095101, 2000)
    Gumps.SendAction(949095101, 51)
    Gumps.WaitForGump(949095101, 2000)
    
    if Player.Mana < 20:
        med()
        
def med():
    Player.UseSkill('Meditation')
    Timer.Create('med', 7000)
    Misc.Pause(dragTime)
    while Player.Mana < Player.ManaMax:
        if not Player.BuffsExist('Meditation') and Timer.Check('med') == False:
            Misc.Pause(2000)
            Player.UseSkill('Meditation')
            Timer.Create('med', 7000)
        Misc.Pause(100)
    

def unload():
    recalls = Items.FindByID(recall, -1, pack)
    if recalls:
        if restockBeetle:
            if Player.Mount:
                Mobiles.UseMobile(self)
                Misc.Pause(dragTime)
                Items.Move(recalls, beetle, 0)
                Misc.Pause(dragTime)
            if not Player.Mount:
                Mobiles.UseMobile(beetle)
                Misc.Pause(dragTime)
                
        else:
            Items.Move(recalls, restockChest.Serial, 0)
            Misc.Pause(dragTime)
        
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''
    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem    
        

def restock():
    recalls = Items.FindByID(recall, -1, pack)
    
    if restockBeetle:
        if Items.BackpackCount(scroll, -1) < 1 or Items.BackpackCount(bp, -1) < 1 or Items.BackpackCount(bm, -1) < 1 or Items.BackpackCount(mr, -1) < 1:
            if Player.Mount:
                Mobiles.UseMobile(Player.Serial)
                Misc.Pause(dragTime)
            backpackscrolls = Items.FindByID(scroll, noColor, pack)
            backpackBp = Items.FindByID(bp, noColor, pack)
            backpackBm = Items.FindByID(bm, noColor, pack)
            backpackMr = Items.FindByID(mr, noColor, pack)
            
            
            if backpackscrolls:
                Items.Move(backpackscrolls, beetle, beetleContainer)
                Misc.Pause(dragTime)
            if backpackBp:
                Items.Move(backpackBp, beetle, 0)
                Misc.Pause(dragTime)
            if backpackBm:
                Items.Move(backpackBm, beetle, 0)
                Misc.Pause(dragTime)
            if backpackMr:
                Items.Move(backpackMr, beetle, 0)
                Misc.Pause(dragTime)
            if recalls:
                Items.Move(recalls, beetle, 0)
                Misc.Pause(dragTime)
            
            Mobiles.SingleClick(beetle)
            Misc.WaitForContext(beetle, 1500)
            Misc.ContextReply(beetle, "Open Backpack")
            Misc.Pause(dragTime)
            
            beetleScrolls = Items.FindByID(scroll, noColor, beetleContainer)
            bps = Items.FindByID (bp , noColor, beetleContainer)
            bms = Items.FindByID (bm , noColor, beetleContainer)
            mrs = Items.FindByID (mr , noColor, beetleContainer)
            
            if beetleScrolls:
                Items.Move(beetleScrolls, pack, 100)
                Misc.Pause(dragTime)
            if bps:
                Items.Move(bps, pack, 100)
                Misc.Pause(dragTime)
            if bms:
                Items.Move(bms, pack, 100)
                Misc.Pause(dragTime)
            if mrs:
                Items.Move(mrs, pack, 100)
                Misc.Pause(dragTime)
                
        if not Player.Mount:
            Mobiles.UseMobile(beetle)
            Misc.Pause(dragTime)
    else:
        if Items.BackpackCount(scroll, -1) < 1:
            Items.UseItem(restockChest)
            Misc.Pause(dragTime)
            scrolls = Items.FindByID (scroll ,-1,restockChest.Serial)
            Items.Move(scrolls, pack, 100)
            Misc.Pause(dragTime)
            unload()
            
        if Items.BackpackCount(bp, -1) < 1:
            Items.UseItem(restockChest)
            Misc.Pause(dragTime)
            bps = Items.FindByID (bp ,-1,restockChest.Serial)
            Items.Move(bps, pack, 100)
            Misc.Pause(dragTime)
            unload()
        
        if Items.BackpackCount(bm, -1) < 1:
            Items.UseItem(restockChest)
            Misc.Pause(dragTime)
            bms = Items.FindByID (bm ,-1,restockChest.Serial)
            Items.Move(bms, pack, 100)
            Misc.Pause(dragTime)
            unload()
            
        if Items.BackpackCount(mr, -1) < 1:
            Items.UseItem(restockChest)
            Misc.Pause(dragTime)
            mrs = Items.FindByID (mr ,-1,restockChest.Serial)
            Items.Move(mrs, pack, 100)
            Misc.Pause(dragTime)
            unload()
    if Items.BackpackCount(pen, -1) < 1:
        restockPen = FindItem(pen, restockChest)
        Items.Move(restockPen, pack, 0)
        Misc.Pause(dragTime)
    
    if Items.BackpackCount(scroll, -1) < 1 or Items.BackpackCount(bp, -1) < 1 or Items.BackpackCount(bm, -1) < 1 or Items.BackpackCount(mr, -1) < 1:
        sys.exit()
    if Items.BackpackCount(pen, -1) < 1:
        Misc.SendMessage('Out of pens', 33)
        sys.exit()
for i in range(0,amountToMake):
    restock()    
    craftRecall()
    if i % 10 == 0:
        Misc.SendMessage ( 'Recalls made: %i' % ( i ) , 33)
        #Misc.SendMessage(i)
<file_sep># Recall Home by MatsaMilla
# version 2.1 - overhead message for using charges, and remaining charges
#
# Enter in player name (case sensitive!), runebook and runeNumber (posotion of rune in book, 1-16)

# True = Mage will not open book, home rune set to default
targetBook = True

if Player.Name == "MetaMilla":
    runebook = 0x43286FAE
    runeNumber = 1
    
elif Player.Name == "MGD":
    runebook = 0x402F6431
    runeNumber = 1
    
elif Player.Name == "MatsaMilla":
    runebook = 0x40c0aa9a
    runeNumber = 2
    
elif Player.Name == "Matsa-":
    runebook = 0x40c0aa9a
    runeNumber = 2
    

    
#***************************************************************#
    
def recallMagery(book, rune):
    if targetBook:
        Spells.CastMagery('Recall')
        Target.WaitForTarget(3500,False)
        Target.TargetExecute(book)
        
    else:
        rune = rune -1
        rune = 5 + (6 * rune)
        if Gumps.CurrentGump() != 1431013363:
            Items.UseItem(book)
        Gumps.WaitForGump(1431013363, 1000)
        Gumps.SendAction(1431013363, rune)
    
def recallCharge(book, rune):
    rune = rune -1
    rune = 2 + (6 * rune)
    if Gumps.CurrentGump() != 1431013363:
        Items.UseItem(book)
        Misc.Pause(100)
    Gumps.WaitForGump(1431013363, 1000)
    Gumps.SendAction(1431013363, rune)
    Items.WaitForProps(book,500)
    charges = Items.GetPropValue(book,'Charges')
    Player.HeadMessage(66, str(int(charges)) + ' charges left' )
    
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
def checkRegs():
    if (FindItem(0x0F7A , Player.Backpack) and FindItem(0x0F86 , Player.Backpack) and FindItem(0x0F7B , Player.Backpack) ):
        return True
    else:
        return False

    
if runebook != None:
    if Player.GetRealSkillValue('Magery') > 50 and checkRegs():
        recallMagery(runebook, runeNumber)
    else:
        Player.HeadMessage(66,"-Using Charge-")
        recallCharge(runebook, runeNumber)
else:
    Player.HeadMessage(33,'No Runebook Set')
<file_sep>Player.ChatSay(5, "Turn Around")<file_sep>#buff pots
leftHand = Player.GetItemOnLayer('LeftHand')
chugtime = 650
journalTimeout = 100
msgColor = 66
noBow = True
bows = [0x13B2,0x26C2,0x0F50,0x13FD,0x0A12,0x0F6B] # 0x0A12,0x0F6B = torch

if not leftHand:
    noBow = True
elif leftHand.ItemID in bows:
    noBow = False
elif leftHand:
    noBow = True
    
def str():
    Player.ChatSay( 1 , '[drink GreaterStrengthPotion ')
    Misc.Pause( journalTimeout )
    if Journal.Search( 'You do not have any of those potions.'):
        Player.HeadMessage(msgColor, "No Strength pots!")
        Journal.Clear()
    else:
        Misc.Pause(chugtime)
        
def strPot():
    whitePot = Items.FindByID(0x0F09,0,Player.Backpack.Serial,True)
    if whitePot:
        Items.UseItem(whitePot)
        Misc.Pause(chugtime)
    else:
        Player.HeadMessage(msgColor, "No Strength pots!")
        
def agil():
    Player.ChatSay( 1 , '[drink GreaterAgilityPotion')
    Misc.Pause( journalTimeout )
    if Journal.Search( 'You do not have any of those potions.'):
        Player.HeadMessage(msgColor, "No Agility pots!")
        Journal.Clear()
    else:
        Misc.Pause(chugtime)
        
def agilPot():
    bluePot = Items.FindByID(0x0F08,0,Player.Backpack.Serial,True)
    if bluePot:
        Items.UseItem(bluePot)
        Misc.Pause(chugtime)
    else:
        Player.HeadMessage(msgColor, "No Agility pots!")

        
def refresh():
    Player.ChatSay( 1 , '[drink totalrefreshpotion')
    Misc.Pause(100)
    if Journal.Search( 'You do not have any of those potions.'):
        Player.HeadMessage(msgColor, "No Refresh pots!")
        Journal.Clear()
#    else:
#        Misc.Pause(chugtime)

def refreshPot():
    redPot = Items.FindByID(0x0F0B,0,Player.Backpack.Serial,True)
    if redPot:
        Items.UseItem(redPot)
    else:
        Player.HeadMessage(msgColor, "No Refresh pots!")
        
def clearHands():
    if leftHand and noBow:
        Player.UnEquipItemByLayer('LeftHand')
        Misc.Pause(chugtime)
        return True
    else:
        return False
       
def reArm():
    Player.EquipItem(leftHand)
    Misc.Pause(50)
    
def buffUp():
    if Player.Str <= 100:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        str()
        agil()
        refresh()
        if disarmed:
            reArm()
    elif Player.Dex <= 100:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        str()
        agil()
        refresh()
        if disarmed:
            reArm()
    elif Player.Stam <= Player.StamMax:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        refresh()
        if disarmed:
            reArm()
    else:
        Player.HeadMessage(msgColor, 'Buffed and full stam')
        
def buffUpPots():
    if Player.Str <= 100:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        strPot()
        agilPot()
        refreshPot()
        if disarmed:
            reArm()
    elif Player.Dex <= 100:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        strPot()
        agilPot()
        refreshPot()
        if disarmed:
            reArm()
    elif Player.Stam <= Player.StamMax:
        if clearHands():
            disarmed = True
        else:
            disarmed = False
        refreshPot()
        if disarmed:
            reArm()
    else:
        Player.HeadMessage(msgColor, 'Buffed and full stam')


if Misc.ShardName() == "Ultima Forever" or Misc.ShardName() == "UOForever":
    buffUp()
else:
    buffUpPots()
<file_sep>Player.ChatSay(5, "Embark")
Misc.Pause(400)
Player.ChatSay(5, "Raise Anchor")<file_sep># T-Map ID & Pull by MatsaMilla
# Last Edit 3/18322
# Disable auto-open corpses to run smoother
# Uses wands if ID skill below 80. Set idAllItems to false to not ID at all.
# Must use tooltips

#*********** SETUP SECTION*********************************************

# Replace with beetle serial if you have one 
beetle = 0x0006EB2A

# False if you don not have beetle 
beetleBag = True

# True if you want to keep scrolls
sortScrolls = False

# True to ID & Pull, false to just pull weps & armor
idAllItems = True

# Modify for item delay of server or to slow down / speed up script
dragTime = 800

#********** Wep Mods To KEEP *******************************************

# modify list to keep armor matching strings below, must match in both keepArmorMods & keepArmorHPMods
keepArmorMods = ['Invulnerability','Exceptional'] #'Fortification', 'Hardening', 'Guarding', 'Defence'
keepArmorHPMods = ['Indestructible','Fortified','Massive'] # 'Substantial' , 'Durable'

# always keep wep mods
keepProps = ['Vanquishing']

# keep wep mods if matching keepWepDmgMods  or keepWepAccuracyMods
keepWepDmgMods = ['Power'] # 'Force', 'Might', 'Ruin'
keepWepAccuracyMods = ['Supremely Accurate','Exceedingly Accurate'] # 'Eminently Accurate', 'Surpassingly Accurate', 'Accurate'

# keep slayers if matching in this list
slayerProps = ['Silver','Undead','Snake','Lizardman','Dragon','Reptile','Terathan',
'Orc Slaying','Ogre','Water','Earth','Elemental','Repond','Fey','Daemon','Exorcism','Poison','Arachnid']
# 'Scorpion','Flame','Vacuum','Gargoyle','Spider'

# useless items no matter how good they are, aka bad shields & ringmail
sellItems = [ 0x1B72,0x13DB,0x13D5,0x13DA,0x1B7B,0x1DB9,0x13BB,0x1B79,0x13EB,0x1B7A,0x13F0,0x1C02,0x1C0C,
0x13EC,0x1B73,0x13DC,0x13BE,0x13EE,0x13D6,0x13BF ]

#*********************NO TOUCH BELOW*************************************
import sys
Misc.SendMessage('Starting TMap Pull and ID', 33)
skillTimer = 0
msgColor = 68
self = Mobiles.FindBySerial(Player.Serial)
heavy = Player.MaxWeight - 10

# Will use ID Wand if skill Item ID below 80
if Player.GetRealSkillValue('Item ID') < 80:
    idWand = True
else:
    idWand = False

#loot includes gate, recall & lvl 8 summoning scrolls
loot = [0x2260,0x1f4c,0x1f60,0x1f66,0x1f68,0x1f69,0x1f6a,0x1f6b,0x1f6c]
perk = [0x2dd5,0x1f18,0x2da3,0x166e,0x26BB,0x139B]
gold = [0xeed]
gems = [0xf16,0xf15,0xf19,0xf25,0xf21,0xf10,0xf26,0xf2d,0xf13]
wands = [0xdf5,0xdf3,0xdf4,0xdf2]
boneArmor = [0x1450,0x1f0b,0x1452,0x144f,0x1451,0x144e]
regs= [0xf7a,0xf7b,0xf86,0xf84,0xf85,0xf88,0xf8d,0xf8c]

scrolls = [0x1f2d,0x1f2e,0x1f2f,0x1f30,0x1f31,0x1f32,0x1f33,0x1f34,0x1f35,0x1f36,0x1f37,0x1f38,0x1f39,
0x1f3a,0x1f3b,0x1f3c,0x1f3d,0x1f3e,0x1f3f,0x1f40,0x1f41,0x1f42,0x1f43,0x1f44,0x1f45,0x1f46,0x1f47,0x1f48,
0x1f49,0x1f4a,0x1f4b,0x1f4d,0x1f4e,0x1f4f,0x1f50,0x1f51,0x1f52,0x1f53,0x1f54,0x1f55,0x1f56,0x1f57,0x1f58,
0x1f59,0x1f5a,0x1f5b,0x1f5c,0x1f5d,0x1f5e,0x1f5f,0x1f60,0x1f61,0x1f62,0x1f63,0x1f64,0x1f65,0x1f66,0x1f67,
0x1f68,0x1f69,0x1f6a,0x1f6b,0x1f6c]

trash = [0x1717,0x1718,0x1544,0x1540,0x1713,0x1715,0x1714,0x1716,0x1717,0x1718,0x1719,0x171a,0x171b,
0x171c,0x2306,0x13f6,0xec4,0x1716,0xe81,0xe86,]

boneArmor = [0x1450,0x1f0b,0x1452,0x144f,0x1451,0x144e]

weps = [0xf62,0x1403,0xe87,0x1405,0x1401,0xf52,0x13b0,0xdf0,0x1439,0x1407,0xe89,0x143d,0x13b4,0xe81,0x13f8,
0xf5c,0x143b,0x13b9,0xf61,0x1441,0x13b6,0xec4,0x13f6,0xf5e,0x13ff,0xec3,0xf43,0xf45,0xf4d,0xf4b,0x143e,
0x13fb,0x1443,0xf47,0xf49,0xe85,0xe86,0x13fd,0xf50,0x13b2,]

armor = [0x1b72,0x1b73,0x1b7b,0x1b74,0x1b79,0x1b7a,0x1b76,0x1408,0x1410,0x1411,0x1412,0x1413,0x1414,0x1415,
0x140a,0x140c,0x140e,0x13bb,0x13be,0x13bf,0x13ee,0x13eb,0x13ec,0x13f0,0x13da,0x13db,0x13d5,0x13d6,0x13dc,
0x13c6,0x13cd,0x13cc,0x13cb,0x13c7,0x1db9,0x1c04,0x1c0c,0x1c02,0x1c00,0x1c08,0x1c06,0x1c0a,]

# check / set bags. Idea from Wardoc (thanks!)
def GetBag ( sharedValue, promptString ):
    if Misc.CheckSharedValue( sharedValue ):
        bag = Misc.ReadSharedValue( sharedValue )
        if not Items.FindBySerial( bag ):
            Player.HeadMessage(66,promptString)
            bag = Target.PromptTarget( promptString )
            Misc.SetSharedValue( sharedValue, bag )
    else:
        Player.HeadMessage(66,promptString)
        bag = Target.PromptTarget( promptString )
        Misc.SetSharedValue( sharedValue, bag )
    return bag
    
regBag = GetBag( 'regBag', 'Select Bag for Regs' )
gemBag = GetBag( 'gemBag', 'Select Bag for Gems' )
trashCan = GetBag( 'trashCan', 'Select corpse to dump on')
if idAllItems:
    sellBag = GetBag( 'sellBag', 'Select Bag for BAD weps and armor' )
    keepBag = GetBag( 'keepBag', 'Select Bag for GOOD weps and armor' )
else:
    armorBag = GetBag( 'armorBag', 'Select Bag for armor' )
    wepBag = GetBag( 'wepBag', 'Select Bag for weapons' )
if sortScrolls:
    scrollBag = GetBag( 'scrollBag', 'Select Bag for Scrolls' )

Player.HeadMessage(66,"Select Treasure Chest")
chest = Target.PromptTarget('Select Treasure Chest')

mapChest = Items.FindBySerial(chest)
Items.UseItem(mapChest)
Misc.Pause(dragTime)

def checkWeight():
    if Player.Weight >= heavy:
        Player.ChatSay(msgColor, 'Overweight, stopping!')
        sys.exit()

def checkDistance():
    reopenChest = False
    while mapChest.DistanceTo(self) > int(1):
        Misc.Pause(1000)
        reopenChest = True
        if not Timer.Check('Distance'):
            Player.HeadMessage(msgColor, 'Too Far Away')
            Timer.Create('Distance', 2500)
    if reopenChest == True:
        Items.UseItem(mapChest)
        Misc.Pause(dragTime)
        reopenChest = False

def goldToBeetle():
    #moves gold to beetle
    if beetleBag:
        for s in mapChest.Contains:
            checkDistance()
            if s.ItemID in gold:
                if Player.Mount:
                    Mobiles.UseMobile(Player.Serial)
                    Misc.Pause(dragTime)
                Items.Move(s, beetle, 0)
                Misc.Pause(dragTime)
                if not Player.Mount:
                    Mobiles.UseMobile(beetle)
                    Misc.Pause(dragTime)
                    
def idStuffToolTips(container, type):
    if type == 'weps':
        idItems = weps
        tier1 = keepWepDmgMods
        tier2 = keepWepAccuracyMods
        worthlessBag = sellBag
    elif type == 'armor':
        idItems = armor
        tier1 = keepArmorMods
        tier2 = keepArmorHPMods
        worthlessBag = sellBag
    elif type == 'bone':
        idItems = boneArmor
        tier1 = keepArmorMods
        tier2 = ['Indestructible']
        worthlessBag = trashCan
    
        
    for i in container.Contains:
        worldSave()
        if i.ItemID in idItems:
            checkWeight()
            Journal.Clear()
            idTarget()
            Target.WaitForTarget(1500)
            Target.TargetExecute(i.Serial)
            Misc.Pause(dragTime)
            Items.WaitForProps(i,2000)
            props = Items.GetPropStringList(i)
            if any(elem in keepProps for elem in props):
                #** Good Stuff Move **
                Items.Move(i, keepBag, 0)
                Misc.Pause(dragTime)
            elif any(elem in tier1 for elem in props):
                #moves items if in sell ids
                if i.ItemID in sellItems:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
                elif any(elem in tier2 for elem in props):
                    #** Good Stuff Move **
                    Items.Move(i, keepBag, 0)
                    Misc.Pause(dragTime)
                else:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
            else:
                #** Sell Stuff Move **
                Items.Move(i, worthlessBag, 0)
                Misc.Pause(dragTime)
            
def itemID(container):
    if idAllItems:
        idStuffToolTips(container, 'weps')
        idStuffToolTips(container, 'armor')
        idStuffToolTips(container, 'bone')
    else:
        for i in container.Contains:
            if i.ItemID in armor:
                Items.Move(i,armorBag,0)
                Misc.Pause(dragTime)
            elif i.ItemID in weps:
                Items.Move(i,wepBag,0)
                Misc.Pause(dragTime)
            elif i.ItemID in boneArmor:
                Items.Move(i,wepBag,0)
                Misc.Pause(dragTime)
                
def pullGems():
    for i in mapChest.Contains :
        checkDistance()
        checkWeight()
        if i.ItemID == 0x0F21 and i.Hue == 0x0489:
            Player.ChatEmote(1,'[e woohoo')
            Misc.Pause(200)
            Player.ChatParty('FRAG, GET OUT OF HERE!')
            Misc.Pause(200)
            Player.ChatSay(66, 'FRAG, GET OUT OF HERE!')
            Items.Move(i, gemBag, 0)
            Misc.Pause(dragTime)
        if i.ItemID in gems:
            Items.Move(i, gemBag, 0)
            Misc.Pause(dragTime)
                
def pull():
    for i in mapChest.Contains :
        checkDistance()
        checkWeight()
        if i.ItemID in gold:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in loot:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in perk:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in regs:
            Items.Move(i, regBag, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in wands:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in scrolls:
            if sortScrolls:
                Items.Move(i, scrollBag, 0)
                Misc.Pause(dragTime)

def trashStuff():
    for i in mapChest.Contains :
        checkDistance()
        checkWeight()
        if i.ItemID in scrolls:
            Items.Move(i, trashCan, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in trash:
            Items.Move(i, trashCan, 0)
            Misc.Pause(dragTime)
            
def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()
            
def equipWand():
    global wandSerial
    player_bag = Items.FindBySerial(Player.Backpack.Serial)
    rightHand = Player.CheckLayer('RightHand')
    leftHand = Player.CheckLayer('LeftHand')
    if leftHand:
        Player.UnEquipItemByLayer('LeftHand')
        
    if not rightHand:
        Player.ChatSay(66,'[equip idwand')
        Misc.Pause(dragTime)
    if Player.GetItemOnLayer('RightHand').ItemID in wands:
        wandSerial = Player.GetItemOnLayer('RightHand').Serial
    else:
        Player.ChatSay(33, "No Wands Found, Stopping Script")
        sys.exit()
        
    
        
def idTarget():
    if idWand:
        equipWand()
        Items.UseItem(wandSerial)
    else:
        Player.UseSkill('Item ID')
        Misc.Pause(100)
    if not Target.HasTarget():
        idTarget()
        

goldToBeetle()

while mapChest:
    pullGems()
    pull()
    itemID(mapChest)
    trashStuff()
    mapChest = Items.FindBySerial(chest)
    
Player.HeadMessage(msgColor, 'Chest Cleared, Thanks MatsaMilla!')
<file_sep>Player.ChatSay(5, "Turn Right")<file_sep># XP tracker by SilentNox, imporoved by MatsaMilla
#   Version 2.6: Fixed error with rogue while using tooltips
    
# Tracks XP of talisman, or meta pet, just start it up and enjoy
# *leave talisman gump open if NOT using tooltips
# *leave meta stone gump open regardless

# Displays XP gained every 10 seconds, total every 60s & grand total

# true if using tooltips (works better)
toolTipsOn = True

# True = will track XP only while running the script
# False = will track XP since Enhanced, if you stop/restart script it will still track starting xp
trackOnScript = False

# put name in here if you never want to track (maxxed talismans) and will only open tali gump
noTrackList = ['mgdexxer', 'viernadourden', 'metamilla']

    
minxp = 0
currentxp = 0
counter = 0
name = Player.Name.lower().replace(' ', '')
import sys

def setupToolTips():
    global startingxp
    global temp
    global currentxp
    temp = Items.GetPropStringByIndex(Talli, propLine)
    if temp == 'MAX':
        Misc.SendMessage('Talisman Maxxed, stopping', 33)
        sys.exit()
    else:
        temp = temp.split(": ", 1)[1]
        temp = temp.split("/", 1)[0]
    
    if hasInt(temp):
        currentxp = int(temp)
    else:
        setup()
        
    if trackOnScript:
        startingxp = currentxp
        Misc.SendMessage('Starting XP: ' + startingxp, 33)
    else:
        if Misc.CheckSharedValue( pname + 'xp' ):
            startingxp = Misc.ReadSharedValue( pname + 'xp' )
            Misc.SendMessage('Starting XP: ' + str(startingxp) , 33)
            Misc.Pause(200)
            gainedXP = currentxp - startingxp
            if gainedXP > 0:
                Player.HeadMessage(66,'XP since run: ' + str(gainedXP))
            elif gainedXP == 0:
                Misc.NoOperation()
            else:
                Player.HeadMessage(44, 'You leveled up!' )
                Player.ChatSay(66, '[e woohoo')
                Misc.RemoveSharedValue( pname + 'xp' )
                setup() 
        else:
            startingxp = currentxp
            Misc.SetSharedValue( pname + 'xp', startingxp )
            Misc.SendMessage('Starting XP: ' + str(startingxp) , 33)
            
def talismanXpToolTips():
    global counter
    global currentxp
    global minxp
    

    Misc.Pause(10000)
    temp = Items.GetPropStringByIndex(Talli, propLine)
    if temp == 'MAX':
        Misc.SendMessage('Talisman Maxxed, stopping', 33)
        sys.exit()
    else:
        temp = temp.split(": ", 1)[1]
        temp = temp.split("/", 1)[0]

    if hasInt(temp):
        newxp = int(temp)
    else:
        newxp = currentxp
    
    difference = newxp - currentxp
    Misc.Pause(120)
    if difference > 0:
        Player.HeadMessage(54, '+' + str(difference) + ' xp')
        currentxp = newxp
    elif difference == 0:
            Misc.NoOperation()
    else:
        Player.HeadMessage(44, 'You leveled up!' )
        Misc.Pause(200)
        Player.ChatSay(66, '[e woohoo')
        Misc.RemoveSharedValue( pname + 'xp' )
        #startingxp = 0
        Misc.SetSharedValue( pname + 'xp', 0 )
        #Misc.SendMessage('Starting XP: ' + str(startingxp) , 33)
        Misc.Pause(10000)
    
    minxp = difference + minxp 
    counter = counter + 1
    if counter >= 6:
        overallxp = currentxp - startingxp
        if minxp > 0:
            Player.HeadMessage(54, '+' + str(minxp) + ' xp last 60s')
            Misc.Pause(200)
        
        if overallxp > 0:
            Player.HeadMessage(44, str(overallxp) + 'xp total.')
        elif overallxp == 0:
            Misc.NoOperation()
        else:
            Player.HeadMessage(44, 'You leveled up!' )
            Player.ChatSay(66, '[e woohoo')
            Misc.RemoveSharedValue( pname + 'xp' )
            setup() 
        counter = 0
        minxp = 0
    Misc.Pause(50)

def hasInt(s):
    try: 
        int(s)
        return True
    except ValueError:
        return False
        
def talismanXp():
    global counter
    global currentxp
    global minxp
    
    if Gumps.CurrentGump() == gumpid: 
        Misc.Pause(10000)
        temp = Gumps.LastGumpGetLine(gumpLine)
        temp = temp.split("/", 1)[0]
        if hasInt(temp):
            newxp = int(temp)
        else:
            newxp = currentxp
        
        difference = newxp - currentxp
        Misc.Pause(120)
        if difference > 0:
            Player.HeadMessage(54, '+' + str(difference) + ' xp')
            currentxp = newxp
        elif difference == 0:
                Misc.NoOperation()
        else:
            Player.HeadMessage(44, 'You leveled up!' )
            Player.ChatSay(66, '[e woohoo')
            Misc.RemoveSharedValue( pname + 'xp' )
            setup() 
        
        minxp = difference + minxp 
        counter = counter + 1
        if counter >= 6:
            overallxp = currentxp - startingxp
            if minxp > 0:
                Player.HeadMessage(54, '+' + str(minxp) + ' xp last 60s')
                Misc.Pause(200)
            
            if overallxp > 0:
                Player.HeadMessage(44, str(overallxp) + 'xp total.')
            elif overallxp == 0:
                Misc.NoOperation()
            else:
                Player.HeadMessage(44, 'You leveled up!' )
                Player.ChatSay(66, '[e woohoo')
                Misc.RemoveSharedValue( pname + 'xp' )
                setup() 
            counter = 0
            minxp = 0
    else:
        tempGump = Gumps.CurrentGump()
        Gumps.CloseGump(tempGump)
    Misc.Pause(50)
    

def setup():
    global startingxp
    global temp
    global currentxp
    
    Gumps.WaitForGump(gumpid, 10000)
    temp = Gumps.LastGumpGetLine(gumpLine)
    if temp == 'MAX':
        Misc.SendMessage('Talisman Maxxed, stopping', 33)
        sys.exit()
    
    temp = temp.split("/", 1)[0]
    
    #Misc.SendMessage(str(temp))
    
    if hasInt(temp):
        currentxp = int(temp)
        #Misc.SendMessage('OK')
    else:
        Misc.Pause(600)
        Misc.SendMessage('retrying read')
        setup()
        
    if trackOnScript:
        startingxp = currentxp
        Misc.SendMessage('Starting XP: ' + str(startingxp), 33)
    else:
        if Misc.CheckSharedValue( pname + 'xp' ):
            startingxp = Misc.ReadSharedValue( pname + 'xp' )
            Misc.SendMessage('Starting XP: ' + str(startingxp) , 33)
            Misc.Pause(200)
            gainedXP = currentxp - startingxp
            if gainedXP > 0:
                Player.HeadMessage(66,'XP since run: ' + str(gainedXP))
            elif gainedXP == 0:
                Misc.NoOperation()
            else:
                Player.HeadMessage(44, 'You leveled up!' )
                Player.ChatSay(66, '[e woohoo')
                Misc.RemoveSharedValue( pname + 'xp' )
                setup() 
        else:
            startingxp = currentxp
            Misc.SetSharedValue( pname + 'xp', startingxp )
            Misc.SendMessage('Starting XP: ' + str(startingxp) , 33)

Misc.Pause(200)
pname = Player.Name.lower().replace(' ', '')
    
Talli = Player.GetItemOnLayer('Talisman')
if Talli:
    Tallyserial = Items.FindBySerial(Talli.Serial)
    Tallyserial = Items.FindBySerial(Talli.Serial)
    if Talli.Hue == 0x078c:
        propLine = 6
    else:
        propLine = 5
    gumpLine = 4
    gumpid = 463091633
else:
    Talli = Items.FindByID( 0x3679  , -1 , Player.Backpack.Serial)
    if Talli:
        Items.UseItem(Talli)
        Misc.Pause(600)
        Tallyserial = Items.FindBySerial(Talli.Serial)
        gumpLine = 4
        gumpid = 3527528070
        Misc.SendMessage('Using Meta Stone', 33)
    else:
        Misc.SendMessage('Talisman Not Found, Stopping', 33)
        sys.exit()
        
        #setup()

try:
    if toolTipsOn:
        if Talli.ItemID == 0x3679:
            setup()
            while True:
                talismanXp()
        else:
            setupToolTips()
            if pname in noTrackList:
                Items.UseItem(Tallyserial)
                Misc.Pause(200)
                sys.exit()
            while True:
                talismanXpToolTips()
    else:
        Items.UseItem(Tallyserial)
        Misc.Pause(200)
        if pname in noTrackList:
            sys.exit()
        setup()
        while True:
            talismanXp()
except:
  print("An exception occurred")
<file_sep>Player.ChatSay(5, "Forward Left")<file_sep># Recursive, fast steal script by ATHL33T
# Updated by MatsaMilla 4/2/22

if Player.GetRealSkillValue('Snooping') < 100:
    Misc.SendMessage('You\'re not a theif', 33)
    sys.exit()

escapeRunebook = 0x414D8007

recallAfterSteal = False

psHue = 0x0481
blazeHue = 1161 #0x0489
short_delay = 20
journal_delay = 120
snoop_delay = 600

ignoreList = []

trap_hues = [0x0489, 0x0026]
containers = [0xe76, 0xe75, 0xe74, 0xe78, 0xe7d, 0xe77]
bags = [0x0E76, 0xE75, 0xE74, 0xE78, 0xE77, 0x0E79]
# 0x0E7D trap box
# 0x0E79 pouch 
# 0x0E75 backpack
# 0x0E76 bag

relic = 0x2AA4
eventFrag = 0x35DA
portalFrag = 0x0F21
powerScroll = 0x14F0
skillScroll = 0x2260
dragonEgg = 0x47E6
head = 0x1CE1
garlic = 0x0F84
root = 0x0F86
bandages = 0x0E21
cure_pots = 0x0F07
arrows = 0x0F3F
#bags = []

steal_priorities_Hues = [ powerScroll, portalFrag, skillScroll ]
steal_priorities = [ relic, eventFrag, dragonEgg, portalFrag, skillScroll, powerScroll, head ]
stealHues = [ blazeHue, psHue ]
def is_steal_success():
    Misc.Pause(journal_delay)
    if Journal.Search('You fail to steal the item.'):
        Player.HeadMessage(33, 'FAILED')
    elif Journal.Search('You successfully steal the item.'):
        Player.HeadMessage(66, '└[∵┌]└[ ∵ ]┘[┐∵]┘')
        Player.HeadMessage(66, 'GOT EM')
        Player.ChatSay(52, "[organizeme")
        if recallAfterSteal:
            escape()
        sys.exit()
    else:
        Player.HeadMessage(66, 'third thing')
        
def escape():
    runebook = Items.FindByID( 0x22C5 , -1 , Player.Backpack.Serial )
    Spells.CastMagery('Recall')
    Target.WaitForTarget(1500)
    Target.TargetExecute( runebook )
    
def steal(item, mark):
    Journal.Clear()
    attempted = False
    Items.WaitForProps(item,500)
    
    while not attempted:
        
        if Items.GetPropValue(item, 'Blessed'):
            Player.HeadMessage(66 , 'Blessed Item')
            ignoreList.append(item.Serial)
            break
            
        #Player.HeadMessage(66,'Attempting')
        Player.UseSkill('Stealing')
        Misc.Pause(journal_delay)
        if Journal.SearchByType('You must wait a few moments to use another skill.', 'Regular'):
            Player.HeadMessage(66 , 'Skill Timer')
            Misc.Pause(journal_delay)
            Journal.Clear()
        elif Journal.SearchByType('You can\'t steal that.', 'System'):
            Player.HeadMessage(66 , 'Blessed Item')
            ignoreList.append(item)
            Journal.Clear()
            attempted = True
        else:
            Target.WaitForTarget(1500)
            while Player.DistanceTo(mark) > 1:
                Misc.Pause(short_delay)
            Target.TargetExecute(item)
            attempted = True

    is_steal_success()

def snoop_recursive(container, mark):
    Items.UseItem(container)
    contents = container.Contains
    stealThis = []

    #steal_target_bags = [item for item in contents if item.IsContainer and item.Hue not in trap_hues]
    steal_target_bags = [item for item in contents if item.ItemID in bags and item.Hue not in trap_hues]
    
    #items_to_steal = [item.Serial for item in contents if (item.ItemID in steal_priorities_Hues and item.Hue in stealHues)]
    items_to_steal = [item.Serial for item in contents if (item.ItemID in steal_priorities)]
    
    for i in items_to_steal:
        ok = Items.FindBySerial(i)
        if ok.Serial in ignoreList:
            Misc.NoOperation()
        elif ok.ItemID in steal_priorities_Hues:
            if ok.Hue in stealHues:
                stealThis.append(i)
        else:
            stealThis.append(i)
            
    if len(stealThis) > 0:
        #stealItem = Items.FindBySerial(items_to_steal[0])
        stealItem = Items.FindBySerial(stealThis[0])
        Player.HeadMessage(66,stealItem.Name)
        return steal(stealItem, mark)
    
    if len(steal_target_bags) == 0:
        return True
    else:
        for bag in steal_target_bags:
            Misc.Pause(snoop_delay)
            snoop_recursive(bag, mark)
    return True

def run_continuously():
    while Player.Hits > 0:
        mark = Target.GetTargetFromList("stealtarget")
        if mark != None and Player.DistanceTo(mark) < 2:
            snoop_recursive(mark.Backpack, mark)
            Misc.Pause(short_delay)
        Misc.Pause(600)
        
# filter
def find():
    fil = Mobiles.Filter()
    fil.Enabled = True
    fil.RangeMax = 1
    fil.IsHuman = True
    fil.IsGhost = False
    fil.Friend = False
    fil.Notorieties = List[Byte](bytes(1,3,4,5,6))
    list = Mobiles.ApplyFilter(fil)

    return list

def run_once():
    mark = Mobiles.Select(find(),'Next') # Target.GetTargetFromList("stealtarget")
    
    if mark != None and Player.DistanceTo(mark) < 2:
        snoop_recursive(mark.Backpack, mark)
        Misc.Pause(short_delay)
    Misc.Pause(600)

Player.HeadMessage(66, 'sticky fingers time')
run_continuously()
<file_sep>Player.ChatSay(5, "Right")<file_sep># Version 2.0 - updated 12/30/20
# recharges blaze pouches in pack. MUST HAVE TOOL TIPS ENABLED
# By MatsaMilla

for i in Player.Backpack.Contains:
    if i.ItemID == 0x0E79 and i.Hue == 0x0489:
        Items.WaitForProps( i , 1000 )
        charges = Items.GetPropValue(i,"Charges")
        if charges:
            if charges < 30:
                while charges < 30:
                    Spells.CastMagery('Magic Trap')
                    Target.WaitForTarget(10000, False)
                    Target.TargetExecute(i)
                    Misc.Pause(800)
                    Items.WaitForProps( i , 1000 )
                    charges = Items.GetPropValue(i,"Charges")
                    if Player.Mana < 20:
                        Player.UseSkill("Meditation")
                        while Player.Mana < Player.ManaMax:
                            Misc.Pause(100)
        

# blazePouch = Items.FindBySerial( Target.PromptTarget('Target Pouch') )
# trapcharges = 1

# Journal.Clear()
# while trapcharges < 30:
   # Spells.CastMagery('Magic Trap')
   # Target.WaitForTarget(10000, False)
   # Target.TargetExecute(blazePouch)
   # Misc.Pause(800)
   # Misc.SendMessage(trapcharges)
   # trapcharges = trapcharges +1
   
   # if Journal.Search('This pouch can only hold 30 charges.'):
       # Stop
   
   # if Player.Mana < 20:
       # Player.UseSkill("Meditation")
       # while Player.Mana < Player.ManaMax:
           # Misc.Pause(100)
<file_sep># Dexxer trainer by MatsaMilla
# Will train Healing , Anatomy, Hiding & Alchemy
dummy = None
dragTime = 600
        
bows = [0x13B2,0x26C2,0x0F50,0x13FD]
leftHand = Player.GetItemOnLayer('LeftHand')

import sys
def trainingDummy():
    global dummy
    training = Target.PromptTarget("Target training dummy")
    dummy = Mobiles.FindBySerial(training)

def kegPots():
    if Journal.Search('hold any more'):
        Misc.SendMessage('Empty Keg!!')
        sys.exit()
    
    keg = Items.FindByID(0x1940,-1,Player.Backpack.Serial)
    tr = Items.FindByID(0xf0b,-1,Player.Backpack.Serial)
    ga = Items.FindByID(0xf08 ,-1,Player.Backpack.Serial)
    gs = Items.FindByID(0xf09 ,-1,Player.Backpack.Serial)
    gh = Items.FindByID(0xf0c ,-1,Player.Backpack.Serial)
    gc = Items.FindByID(0xf07 ,-1,Player.Backpack.Serial)
    
    if tr:
        Items.Move(tr, keg, 0)
        Misc.Pause(dragTime)
    elif ga:
        Items.Move(ga, keg, 0)
        Misc.Pause(dragTime)
    elif gs:
        Items.Move(gs, keg, 0)
        Misc.Pause(dragTime)
    elif gh:
        Items.Move(gh, keg, 0)
        Misc.Pause(dragTime)
    elif gc:
        Items.Move(gc, keg, 0)
        Misc.Pause(dragTime)
        
def trainAlchy():
    if Player.GetRealSkillValue('Alchemy') < 100:
        
        if Player.GetRealSkillValue('Alchemy') < 60:
            mortar = Items.FindByID(0x0E9B , -1 , Player.Backpack.Serial)
            Items.UseItem(mortar)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,1)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,9)
            Gumps.WaitForGump(0x38920abd, 1500)
            
            kegPots()
        
        elif Player.GetRealSkillValue('Alchemy') < 70:
            mortar = Items.FindByID(0x0E9B , -1 , Player.Backpack.Serial)
            Items.UseItem(mortar)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,8)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,9)
            Gumps.WaitForGump(0x38920abd, 1500)
            
            kegPots()
            
        elif Player.GetRealSkillValue('Alchemy') < 80:
            mortar = Items.FindByID(0x0E9B , -1 , Player.Backpack.Serial)
            Items.UseItem(mortar)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,29)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,9)
            Gumps.WaitForGump(0x38920abd, 1500)
            
            kegPots()
        
        elif Player.GetRealSkillValue('Alchemy') < 90:
            mortar = Items.FindByID(0x0E9B , -1 , Player.Backpack.Serial)
            Items.UseItem(mortar)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,22)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,9)
            Gumps.WaitForGump(0x38920abd, 1500)
            
            kegPots()
            
        elif Player.GetRealSkillValue('Alchemy') < 100:
            mortar = Items.FindByID(0x0E9B , -1 , Player.Backpack.Serial)
            Items.UseItem(mortar)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,43)
            Gumps.WaitForGump(0x38920abd, 1500)
            Gumps.SendAction(0x38920abd ,9)
            Gumps.WaitForGump(0x38920abd, 3500)
            
            kegPots()

            
def trainHide():
    if not Timer.Check('hideTimer'):
        Player.UseSkill('Hiding')
        Timer.Create('hideTimer', 11000)
    elif Player.GetRealSkillValue('Hiding') == 100:
        if not Player.BuffsExist('Hidden'):
            Player.UseSkill('Hiding')
        
def trainHealing():
    if dummy == None:
        trainingDummy()
    if (Journal.Search('resurrect your patient.') or not Timer.Check('bandie')):
        Journal.Clear()
        bandage = Items.FindByID(0x0E21,-1,Player.Backpack.Serial)
        Items.UseItem(bandage)
        Target.WaitForTarget(10000, False)
        Target.TargetExecute(dummy)
        Timer.Create('bandie', 11000)
        
def trainResist():
    if dummy == None:
        trainingDummy()
    if not Timer.Check ('casttime')and Player.DistanceTo(dummy) < 12:
        Spells.CastMagery("Mana Vampire")
        Target.WaitForTarget(1500, False)
        Target.TargetExecute(dummy)
        Timer.Create('casttime', 3000)
    
    Player.SetWarMode(False)

def equipBow():
    #Misc.Pause( config.dragDelayMilliseconds )
    if Player.GetRealSkillValue('Archery') > 80:
        player_bag = Items.FindBySerial(Player.Backpack.Serial)
        if not leftHand:
            for i in player_bag.Contains:
                if i.ItemID in bows:
                    Player.EquipItem(i.Serial)
                    Misc.Pause( 600 )
                    
def trainAnat():
    if dummy == None:
        trainingDummy()
    if Timer.Check('anat') == False:
        Player.UseSkill('Anatomy')
        Target.WaitForTarget(10000, False)
        Target.TargetExecute(dummy)
        Timer.Create('anat', 5000)
        
def attkHealTarget():
    if dummy == None:
        trainingDummy()
    if dummy.Hits < 25 and Misc.ReadSharedValue('bandageDone') == True:
        Items.UseItemByID(0x0E21, 0)
        Target.WaitForTarget(10000, False)
        Target.TargetExecute(dummy)
        Misc.Pause (500)
    if dummy.Hits < 10:
        Player.SetWarMode(False)
        while dummy.Hits < 25:
            Misc.Pause(100)
        Player.SetWarMode(True)
        Player.Attack(dummy)
        
def BandageSelf():
    if Misc.ReadSharedValue('bandageDone') == True:
        Items.UseItemByID(0x0E21, 0)
        Target.WaitForTarget(1500, False)
        Target.Self()
        Misc.Pause (500)
        
Journal.Clear()
while True:
    if Player.GetRealSkillValue('Healing') > 30 and (Player.Hits < 50 or Player.Poisoned):
        BandageSelf()
    if Player.GetRealSkillValue('Anatomy') > 30 and Player.GetRealSkillValue('Anatomy') < 100:
        trainAnat()
    if Player.GetRealSkillValue('Hiding') > 30 and Player.GetRealSkillValue('Hiding') < 100:
        trainHide()
    if Player.GetRealSkillValue('Healing') > 30 and Player.GetRealSkillValue('Healing') < 100:
        trainHealing()
    if Player.GetRealSkillValue('Alchemy') > 30 and Player.GetRealSkillValue('Alchemy') < 100:
        trainAlchy()
    
    Misc.Pause(100)
    if Target.HasTarget( ) == True:
        Target.Cancel()
<file_sep>Player.ChatSay(5, "Forward Left One")<file_sep># Adding an extra 200 ms in case of latency issues
hidingTimerMilliseconds = 10200
stealthTimerMilliseconds = 10200

Misc.SendMessage( 'Beginning Stealth training', 90 )

Timer.Create( 'hidingTimer', 1 )
Timer.Create( 'stealthTimer', 1 )

moveNorth = True

# while skill can increase and player is not dead
while Player.GetRealSkillValue( 'Stealth' ) < 80.0 and not Player.IsGhost: #Player.GetSkillCap( 'Stealth' )
    if Player.GetSkillValue( 'Hiding' ) < 80.0:
        if not Timer.Check( 'hidingTimer' ):
            Player.UseSkill( 'Hiding' )
            Timer.Create( 'hidingTimer', hidingTimerMilliseconds )
            Timer.Create( 'stealthTimer', stealthTimerMilliseconds )
        continue

    if not Player.BuffsExist( 'Hiding' ):
        if not Timer.Check( 'hidingTimer' ):
            Player.UseSkill( 'Hiding' )
            Timer.Create( 'hidingTimer', hidingTimerMilliseconds )
            Timer.Create( 'stealthTimer', stealthTimerMilliseconds )
    elif Player.BuffsExist( 'Hiding' ) and not Timer.Check( 'stealthTimer' ):
        Player.UseSkill( 'Stealth' )
        Timer.Create( 'stealthTimer', stealthTimerMilliseconds )
        Timer.Create( 'hidingTimer', hidingTimerMilliseconds )

    if Player.GetSkillValue( 'Stealth' ) > 40.0:
        # After skill reaches 50, start walking to trigger stealth more often
        for i in range( 0, 5 ):
            if moveNorth:
                Player.Walk( 'North' )
            else:
                Player.Walk( 'South' )
            Misc.Pause( 200 )
        moveNorth = not moveNorth
        Misc.Pause( 500 )

    # Pause to ease CPU usage
    Misc.Pause( 500 )
Misc.SendMessage( 'Stealth training complete!' )
<file_sep># Lightning Wand by MatsaMilla
# equips and uses Lightning wand, then unequips after

#[equip spellwand lightning

wandType = "Lightning"
wands = [0xdf5,0xdf3,0xdf4,0xdf2]
msgColor = 33
dragTime = 600
import sys
def getWands( itemID , container = Player.Backpack  ):
    '''
    Recursively looks through backpack for any wands in the wands list
    Returns a list with wand serials
    '''
    
    # Create the list
    wandList = []
    
    if isinstance( itemID, int ):

        # add wand serials to list
        for item in container.Contains:
            if item.ItemID == itemID:
                wandList.append(item.Serial)

    elif isinstance( itemID, list ):
        # add wand serials to list
        for item in container.Contains:
            if item.ItemID in itemID:
                wandList.append(item.Serial)
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    subcontainers = [ item for item in container.Contains if item.IsContainer ]

    # Iterate through each item in the given list
    for subcontainer in subcontainers:
        wandsInSubContainer = getWands( itemID, subcontainer )
        for i in wandsInSubContainer:
            wandList.append(i)

    return wandList
    
def findAndEquipWand (wandType):
    wandsInPack = getWands( wands )
    for i in wandsInPack:
        wand = Items.FindBySerial(i)
        Items.WaitForProps( wand, 500 )
        propList = Items.GetPropStringList( wand )
        charges = Items.GetPropValue(wand,"Charges")
        
        if any( wandType in s for s in propList ):
            Player.HeadMessage(78,"{} charges".format(int(charges)))
            #Misc.SendMessage(wandType + " found")
            
            Player.EquipItem( wand )
            Misc.Pause( dragTime )
            Items.UseItem( wand )
            Target.WaitForTarget( 2500 )
            while Target.HasTarget():
                Misc.Pause( 50 )
            Misc.Pause( dragTime )
            Player.UnEquipItemByLayer('RightHand')
            sys.exit()
                
    Player.HeadMessage( msgColor, "No wands found!" )
    
def checkHands(wandType):
    leftHand = Player.GetItemOnLayer('LeftHand')
    rightHand = Player.GetItemOnLayer('RightHand')
    if leftHand:
        Misc.SendMessage('lefthand')
        Player.UnEquipItemByLayer('LeftHand')
        Misc.Pause( dragTime )
        return False
    if rightHand:
        if rightHand.ItemID in wands:
            Items.WaitForProps(rightHand,500)
            propList = Items.GetPropStringList( rightHand )
            charges = Items.GetPropValue(rightHand,"Charges")
            if any( wandType in s for s in propList ):
                Player.HeadMessage(78,"{} charges".format(int(charges)))
                Items.UseItem( rightHand )
                Target.WaitForTarget( 2500 )
                while Target.HasTarget():
                    Misc.Pause( 50 )
                Misc.Pause( dragTime )
                Player.UnEquipItemByLayer('RightHand')
                return True
        else:
            Player.UnEquipItemByLayer('RightHand')
            Misc.Pause( dragTime )
            return False
        

if checkHands(wandType):
    Misc.NoOperation()
else:
    findAndEquipWand (wandType)
<file_sep># Target Closest, Attack and DROP Target on nearest target
#   aka sallos target aquire
# by MatsaMilla & contributions by <NAME>
# Last Update: 8/2/21
from System.Collections.Generic import List
from System import Byte
import sys

# true to attack, false will only set as last target
attack = True

# true for humanoid only, false excludes humaniods
humanoid = True

# true to also target red targets. (I keep false to not auto target bosses)
redTargets = True

# true to send target message to party
sendMessage = False

# true to display target overhead & over mobile
displayTarget = False

# range at which target will aquire
targetRange = 12

# filter
def find(notoriety, humanoid):
    fil = Mobiles.Filter()
    fil.Enabled = True
    fil.RangeMax = targetRange
    fil.IsHuman = humanoid
    fil.IsGhost = False
    fil.Friend = False
    fil.Notorieties = List[Byte](bytes(notoriety))
    list = Mobiles.ApplyFilter(fil)

    return list

# Possible Selections:
# 1 blue, 2 green, 3 grey, 4 grey(agro), 5 orange, 6 red, 7 invul
# Random, Nearest,Farthest, Weakest, Strongest, Next

# if your toon is blue, green, or gray or militia
if (Player.Notoriety == 1 or Player.Notoriety == 2 or Player.Notoriety == 3 or Player.Notoriety == 4):
    greyMobile = Mobiles.Select(find([3,4],humanoid),'Nearest',)
    orangeMobile = Mobiles.Select(find([5],humanoid),'Nearest')
    if redTargets:
        redMobile = Mobiles.Select(find([6],humanoid),'Nearest')
    else:
        redMobile = None
    if orangeMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + orangeMobile.Name)
        Target.SetLast(orangeMobile)
        Target.TargetExecute(orangeMobile)
        if attack:
            Player.Attack(orangeMobile)
        if displayTarget:
            Player.HeadMessage(47, "Target: " + orangeMobile.Name)
            Mobiles.Message(orangeMobile, 15, "*Target*")
    elif redMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + redMobile.Name)
        Target.SetLast(redMobile)
        Target.TargetExecute(redMobile)
        if attack:
            Player.Attack(redMobile)
        if displayTarget:
            Player.HeadMessage(33, "Target: " + redMobile.Name)
            Mobiles.Message(redMobile, 15, "*Target*")
    elif greyMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + greyMobile.Name)
        Target.SetLast(greyMobile)
        Target.TargetExecute(greyMobile)
        if attack:
            Player.Attack(greyMobile)
        if displayTarget:
            Player.HeadMessage(902, "Target: " + greyMobile.Name)
            Mobiles.Message(greyMobile, 15, "*Target*")
    else:
        Misc.SendMessage('No Targets', 33)

# if your toon is red
elif Player.Notoriety == 6:
    blueMobile = Mobiles.Select(find([1],humanoid),'Nearest')
    greyMobile = Mobiles.Select(find([3,4],humanoid),'Nearest')
    orangeMobile = Mobiles.Select(find([5],humanoid),'Nearest')
    if redTargets:
        redMobile = Mobiles.Select(find([6],humanoid),'Nearest')
    else:
        redMobile = None
    if blueMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + blueMobile.Name)
        Target.SetLast(blueMobile)
        Target.TargetExecute(blueMobile)
        if attack:
            Player.Attack(blueMobile)
        if displayTarget:
            Player.HeadMessage(1266, "Target: " + blueMobile.Name)
            Mobiles.Message(blueMobile, 15, "*Target*")
    elif greyMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + greyMobile.Name)
        Target.SetLast(greyMobile)
        Target.TargetExecute(greyMobile)
        if attack:
            Player.Attack(greyMobile)
        if displayTarget:
            Player.HeadMessage(902, "Target: " + greyMobile.Name)
            Mobiles.Message(greyMobile, 15, "*Target*")
    elif orangeMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + orangeMobile.Name)
        Target.SetLast(orangeMobile)
        Target.TargetExecute(orangeMobile)
        if attack:
            Player.Attack(orangeMobile)
        if displayTarget:
            Player.HeadMessage(47, "Target: " + orangeMobile.Name)
            Mobiles.Message(orangeMobile, 15, "*Target*")
    elif redMobile:
        if sendMessage:
            Player.ChatParty('Changing last target to ' + redMobile.Name)
        Target.SetLast(redMobile)
        Target.TargetExecute(redMobile)
        if attack:
            Player.Attack(redMobile)
        if displayTarget:
            Player.HeadMessage(33, "Target: " + redMobile.Name)
            Mobiles.Message(redMobile, 15, "*Target*")
    else:
        Misc.SendMessage('No Targets', 33)<file_sep># Use this to cast Mana Vampire on someone (or yourself) until you run out of regs.
# By MatsaMilla

#----------------------------------------------------

training = Target.PromptTarget("Target training dummy")
dummy = Mobiles.FindBySerial(training)

bows = [0x13B2,0x26C2,0x0F50,0x13FD]
leftHand = Player.GetItemOnLayer('LeftHand')
import sys
def equipBow():
    #Misc.Pause( config.dragDelayMilliseconds )
    if Player.GetRealSkillValue('Archery') > 80:
        player_bag = Items.FindBySerial(Player.Backpack.Serial)
        if not leftHand:
            for i in player_bag.Contains:
                if i.ItemID in bows:
                    Player.EquipItem(i.Serial)
                    Misc.Pause( 600 )

while True:
    dummy = Mobiles.FindBySerial(training)
    if Player.DistanceTo(dummy) < 12:
        Player.SetWarMode(False)
        Spells.CastMagery("Mana Vampire")
        Target.WaitForTarget(1500, False)
        Target.TargetExecute(dummy)
        Player.SetWarMode(True)
        Player.SetWarMode(False)
        Misc.Pause(2500)
    
    Player.SetWarMode(False)
    
    if Player.Mana < 40:
        Player.UseSkill('Meditation')
        while Player.Mana < Player.ManaMax:
            
            if not Player.BuffsExist('Meditation') and Timer.Check('med') == False:
                Misc.Pause(2000)
                Player.UseSkill('Meditation')
                Timer.Create('med', 7000)
            Misc.Pause(100)
                
    if Items.BackpackCount( 0x0F8D, -1) < 1:
        sys.exit()
    if Journal.Search('Did it, got it') == 50:
        sys.exit()
            
<file_sep># This will use a moongate within 2 tiles, and accept the gump if there is one.
# By MatsaMilla, updated 4/25/20

# must import list to use it in the filters
from System.Collections.Generic import List 

# Items filter for finding moongate
gate = Items.Filter()
gate.Enabled = True
gate.OnGround = True
gate.Movable = False
gate.RangeMax = 1
gate.Graphics = List[int]( [ 0x0F6C ] )
moongate = Items.ApplyFilter(gate)

# if a moongate is found, continue
if moongate:
    # select the nearest item from list
    m = Items.Select( moongate , 'Nearest' )
    
    # Double click on the moongate found 
    Items.UseItem(m) 
    # wait for gump pop up
    Gumps.WaitForGump(3716879466, 1500)
    # click yes
    Gumps.SendAction(3716879466, 1)
else:
    # if not gates in range send message
    Misc.SendMessage('No Gate In Range',33)
<file_sep>from System.Collections.Generic import List
import sys
# Empty Potion Keg Maker by MatsaMilla Version 1.1
# Target restock container, then container for empty potion kegs
# will make as many as maxToMake, or until mats run out
maxToMake = 120

journalPause = 120
dragTime = 600

kegGump1 = 15
kegGump2 = 163
lidGump1 = 1
lidGump2 = 9
stavesGump1 = 1
stavesGump2 = 2
hoopGump1 = 15
hoopGump2 = 37
barrelTap1 = 15
barrelTap2 = 16
potionKegGump1 = 43
potionKegGump2 = 44
tinkKitGump1 = 8
tinkKigGump2 = 23
sawGump1 = 8
sawGump2 = 51
ignot = 0x1BF2
wood = 0x1BD7
tink = 0x1EB8
saw = 0x1034
bottle = 0x0F0E
hoop = 0x1DB7
stave = 0x1EB1
lid = 0x1DB8
tap = 0x1004

def tinkCraft (gump1, gump2):
    Gumps.CloseGump(949095101)
    currentTink = FindItem(tink,Player.Backpack)
    if Gumps.CurrentGump() != 949095101:
        Items.UseItem(currentTink)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, gump1)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, gump2)
    Gumps.WaitForGump(949095101, 1500)
    Misc.Pause(journalPause)
    
def carpCraft (gump1, gump2):
    Gumps.CloseGump(949095101)
    currentsaw = FindItem(saw,Player.Backpack)
    if Gumps.CurrentGump() != 949095101:
        Items.UseItem(currentsaw)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, gump1)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, gump2)
    Gumps.WaitForGump(949095101, 1500)
    Misc.Pause(journalPause)
    
def craftKegs(i):
    for i in range( 0, i ):
        craftKeg()

def craftKeg():
    checkMats ()
    while Items.BackpackCount(stave,-1) < 3:
        carpCraft(stavesGump1, stavesGump2)
        checkMats ()
    while Items.BackpackCount(lid,-1) < 2:
        carpCraft(lidGump1, lidGump2)
        checkMats ()
    if Items.BackpackCount(hoop,-1) < 1:
        tinkCraft(hoopGump1, hoopGump2)
    checkMats ()
    if Items.BackpackCount(tap,-1) < 1:
        tinkCraft(barrelTap1, barrelTap2)
    checkMats ()
    carpCraft(kegGump1, kegGump2)
    checkMats ()
    tinkCraft(potionKegGump1, potionKegGump2)
    moveKegs(potionKegContainer)
    
def restock(container):
    restockWood = FindItem(wood, container,0x0000)
    if Items.BackpackCount(wood, -1) < 19:
        if restockWood:
            Items.Move(restockWood, Player.Backpack, 500)
        Misc.Pause(dragTime)
    restockIgnots = FindItem(ignot, container)
    if Items.BackpackCount(ignot, -1) < 10:
        if restockIgnots:
            Items.Move(restockIgnots, Player.Backpack, 100)
            Misc.Pause(dragTime)
    restockBottle = FindItem(bottle, container)
    if Items.BackpackCount(bottle, -1) < 10:
        if restockBottle:
            Items.Move(restockBottle, Player.Backpack, 100)
            Misc.Pause(dragTime)
        
def moveKegs(container):
    potionKeg = FindItem(0x1940, Player.Backpack)
    while potionKeg:
        Items.Move(potionKeg, container, 0)
        Misc.Pause(dragTime)
        potionKeg = FindItem(0x1940, Player.Backpack)
        if Journal.Search('That container cannot hold more weight.'):
            Player.HeadMessage(33, 'Potion container full, stopping')
            sys.exit()
    
def checkMats ():
    # Stop if low on iron
    if Items.BackpackCount(ignot, -1) < 10:
        restock(restockContainer)
        Misc.Pause(journalPause)
        if Items.BackpackCount(ignot, -1) < 10:
            Misc.SendMessage('Out of Ignots',33)
            sys.exit()
    # Stop if low on wood
    if Items.BackpackCount(wood, -1) < 19:
        restock(restockContainer)
        Misc.Pause(journalPause)
        if Items.BackpackCount(wood, -1) < 19:
            Misc.SendMessage('Out of Wood',33)
            sys.exit()
            
    # Stop if low on bottles
    if Items.BackpackCount(bottle, -1) < 10:
        restock(restockContainer)
        Misc.Pause(journalPause)
        if Items.BackpackCount(bottle, -1) < 10:
            Misc.SendMessage('Out of Bottles',33)
            sys.exit()
    # always have 2 tinker kits
    if Items.BackpackCount(tink, -1) < 2:
        tinkCraft (tinkKitGump1, tinkKigGump2)
    # craft saw
    if Items.BackpackCount(saw, -1) < 1:
        tinkCraft (sawGump1, sawGump2)
        

        
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
    
    
restockContainer = Items.FindBySerial( Target.PromptTarget('Target Restock Container') )
potionKegContainer = Items.FindBySerial( Target.PromptTarget('Target Bag for Potion Kegs'))
Items.UseItem(restockContainer)
Misc.Pause(dragTime)
Journal.Clear()
craftKegs(maxToMake)
<file_sep>'''
Author: TheWarDoctor95
Other Contributors:
Last Contribution By: MatsaMilla - May 22, 2020

Description: Uses the instruments from the player's backpack to train Musicianship to GM
'''

musichianshipTimerMilliseconds = 6500

def FindItem( itemsToLookFor, items ):
    '''
    Recursively looks through a container for any items in the provided list
    Returns the first item found from the list
    '''
    # Iterate through each item in the given list
    for item in items:
        if item.ItemID in itemsToLookFor:
            return item
        elif item.IsContainer:
            # If the list of items contains a container, look in that container for the item too
            itemToReturn = FindItem( itemsToLookFor, item.Contains )
            if itemToReturn != None:
                return itemToReturn
    return None


def FindInstrument():
    '''
    Uses FindItem to find an instrument in the player's backpack
    Returns the first instrument found
    '''
    instruments = [
        0xe9c,  # Drum
        0x2805,  # Flute
        0xeb3,  # Lute

        # Harps
        0xeb2,  # Lap Harp
        0xeb1,  # Standing Harp

        # Tambourines
        0xe9e,  # Tambourine
        0xe9d   # Tambourine with red tassle
    ]

    instrument = FindItem( instruments, Player.Backpack.Contains )
    return instrument


def TrainMusicianship():
    '''
    Trains Musicianship by using the instruments in the player's bag
    Transitions to a new instrument if the one being used runs out of uses
    '''
    global instrument
    global musichianshipTimerMilliseconds

    Misc.SendMessage( 'Training with: %s' % instrument )

    Items.UseItem( instrument )
    Timer.Create( 'musichianshipTimer', musichianshipTimerMilliseconds )

    while instrument != None and Player.GetSkillValue( 'Musicianship' ) < 100 and not Player.IsGhost:
        if not Timer.Check( 'musichianshipTimer' ):
            Items.UseItem( instrument )
            Timer.Create( 'musichianshipTimer', musichianshipTimerMilliseconds )
            instrument = Items.FindBySerial( instrument.Serial )
            if instrument == None:
                # Our instrument broke, we need to find a new one if possible
                instrument = FindInstrument()
                if instrument != None:
                    Misc.SendMessage( 'Training with: %s' % instrument )

    if instrument == None:
        Misc.SendMessage( 'Ran out of instruments to train with', 1100 )


instrument = FindInstrument()

if instrument == None:
    Player.HeadMessage( 1100, 'No instrument found' )
else:
    TrainMusicianship()
<file_sep># train meditation to GM by Mastamilla
# purchase magical wizard hat from mage shop


#check backpack for wizard hat
wizardHat = Items.FindByID( 0x1718 , -1 , Player.Backpack.Serial )

# not in pack? Check head layer
if not wizardHat:
    wizardHat = Player.GetItemOnLayer('Head')
    
# hat found
if wizardHat:
    #loop until GM
    while Player.GetRealSkillValue("Meditation") < 100:
        if Player.Mana >= Player.ManaMax:
            Items.Move(wizardHat, Player.Backpack.Serial, 0)
            Misc.Pause(2000)
            Player.EquipItem(wizardHat)
            Misc.Pause(600)

# no hat found            
else:
    Player.HeadMessage(33,'No wizard hat found.')
<file_sep># Sort selected runebook alphabetically
# By MatsaMilla
# must have ToolTips enabled
# don't have any other runes in back, bag them before starting

runebook = Items.FindBySerial(Target.PromptTarget('target book'))
runelist = []

def GetNamesOfRunesInBook( runebook ):
    Items.UseItem( runebook )

    # Pause here since the next part goes pretty quick
    Misc.Pause( 600 )

    Gumps.WaitForGump( 1431013363, 5000 )
    while Gumps.CurrentGump() != 1431013363:
        Player.HeadMessage( 33, 'Too far from runebook to copy, please move closer.' )
        Misc.Pause( 1000 )
        Items.UseItem( runebook )
        Gumps.WaitForGump( 1431013363, 5000 )

    runeNames = []
    lineList = Gumps.LastGumpGetLineList()

    # Remove the default 3 lines from the top of the list
    lineList = lineList[ 3 : ]

    # Remove the items before the names of the runes
    endIndexOfDropAndDefault = 0
    for i in range( 0, len( lineList ) ):
        if lineList[ i ] == 'Set default' or lineList[ i ] == 'Drop rune':
            endIndexOfDropAndDefault += 1
        else:
            break

    # Add two for the charge count and max charge numbers
    endIndexOfDropAndDefault += 2
    runeNames = lineList[ endIndexOfDropAndDefault : ( endIndexOfDropAndDefault + 16 ) ]
    runeNames = [ name for name in runeNames if name != 'Empty' ]

    return runeNames
    
def GetNumberOfRunesInBook( runebook ):
    return len( GetNamesOfRunesInBook( runebook ) )

def dropRunes():
    numberOfRunesInBook = GetNumberOfRunesInBook( runebook ) +1
    Items.UseItem(runebook)
    for i in range( 0 , numberOfRunesInBook):
        # drop runebook runes
        #Items.UseItem(runebook)
        Gumps.WaitForGump(1431013363, 1000)
        Gumps.SendAction(1431013363, 3)
        Misc.Pause(600)
    
    Gumps.WaitForGump(1431013363, 1000)
    Gumps.SendAction(1431013363, 0)
    
def getSortKey(list):
    return list[0]
    
def compileRunes():
    for i in Player.Backpack.Contains:
        if i.ItemID == 0x1F14:
            Items.WaitForProps(i, 1000)
            runeName = Items.GetPropStringByIndex(i, 0)
            if runeName:
                #Misc.SendMessage(runeName)
                runelist.append((runeName,i.Serial))
        #Misc.Pause(200)
    #Misc.SendMessage('____', 33)
    runelist.sort(key=getSortKey)
    
    for l in runelist:
        Items.Move(l[1], runebook.Serial, 0)
        #Misc.SendMessage(l[0])
        Misc.Pause(600)

dropRunes()       
compileRunes()
<file_sep># Automatic Potion Butler Filler by MatsaMilla 
#   - Version 3, updated 4/10/21 - Can fill if not Owner or CoOwner of house

# NEED: Restock Chest (containing BARBED leather / tailor kits (or ignots if you have tinkering))

# False if not owner or co-owned to house
houseOwner = True

#*******************************************************************#

Player.HeadMessage(66,'Target Butler')
butler = Target.PromptTarget('Target Butler')
Player.HeadMessage(66,'Target Restock Chest')
restockChest = Items.FindBySerial( Target.PromptTarget('Target Restock Chest') )

fillStopNumber = 50
dragTime = 800
butlerGump = 989312372
import sys

def setValues( armorValue , gump ):
    global armorID
    global gumpAction
    armorID = armorValue
    gumpAction = gump


def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''
    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
def craftArmor(armor, amount):
    sewKit = FindItem( 0x0F9D , Player.Backpack )
    if not sewKit:
        restock()
        
    if armor == 'cap':
        setValues( 0x1DB9 , 9 )
    elif armor == 'gorget':
        setValues( 0x13C7 , 2)
    elif armor == 'arms':
        setValues( 0x13CD , 23 )
    elif armor == 'gloves':
        setValues( 0x13C6 , 16 )
    elif armor == 'chest':
        setValues( 0x13CC , 37 )
    elif armor == 'legs':
        setValues( 0x13CB , 30 )
    else:
        Misc.SendMessage('potType not defined, stopping', 33)
        sys.exit()
    while amount > 0:
        worldSave()
        restock()
        
        if Gumps.CurrentGump() != 949095101:
            sewKit = FindItem( 0x0F9D , Player.Backpack )
            Items.UseItem(sewKit)
            Gumps.WaitForGump(949095101, dragTime)
            # change to barbed
            Gumps.WaitForGump(949095101, dragTime)
            Gumps.SendAction(949095101, 7)
            Gumps.WaitForGump(949095101, dragTime)
            Gumps.SendAction(949095101, 27)
            Gumps.WaitForGump(949095101, dragTime)
        Gumps.SendAction(949095101, 36)
        Gumps.WaitForGump(949095101, dragTime)
        Gumps.SendAction(949095101, gumpAction)
        Gumps.WaitForGump(949095101, dragTime)
        Misc.Pause(200)
        restock()
        # move crafted armor to butler
        craftedArmor = FindItem( armorID , Player.Backpack)
        while craftedArmor:
            Items.Move(craftedArmor, butler, 0)
            Misc.Pause(dragTime)
            craftedArmor = FindItem( armorID , Player.Backpack)
            amount = amount - 1
            if amount < 1:
                break
        if amount < 1:
            break
        
def restock():
    
    leather = FindItem( 0x1081 , Player.Backpack, 0x059d )
    if not leather or leather.Amount < 12:
        leatherRestock = FindItem( 0x1081 , restockChest, 0x059d)
        if leatherRestock:
            Items.Move( leatherRestock , Player.Backpack , 200 )
            Misc.Pause(dragTime)
        else:
            Misc.SendMessage( 'No more leather' , 33 )
            sys.exit()
        
    sewKit = FindItem( 0x0F9D , Player.Backpack )
    if sewKit == None:
        if Player.GetRealSkillValue('Tinkering') > 80:
            tinkTool = FindItem( 0x1EB8 , Player.Backpack )
            if tinkTool:
                Items.UseItem(tinkTool)
                Gumps.WaitForGump(949095101, dragTime)
                Gumps.SendAction(949095101, 8)
                Gumps.WaitForGump(949095101, dragTime)
                Gumps.SendAction(949095101, 44)
                Gumps.WaitForGump(949095101, dragTime)
                Misc.Pause(200)
                Gumps.CloseGump(949095101)
        else:
            restockSewKit = FindItem( 0x0F9D , restockChest )
            if restockSewKit:
                Items.Move( restockSewKit , Player.Backpack , 200 )
                Misc.Pause(dragTime)
            else:
                Misc.SendMessage( 'No more sewing kits' , 33 )
                sys.exit()
    
def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()
    
Journal.Clear()
Misc.Pause(1000)
Mobiles.UseMobile(butler)
Misc.Pause(1000)

if houseOwner:
    fillList = [('cap',4),('gorget',5),('arms',6),('gloves',7),('chest',8),('legs',9)]
else:
    fillList = [('cap',5),('gorget',7),('arms',9),('gloves',11),('chest',13),('legs',15)]

while True:
    # verify its butler gump
    if Gumps.CurrentGump() == butlerGump:
        # iterate through fillList
        
        for i in fillList:
            # read gump line
            fillNumber = fillStopNumber - int(float(Gumps.LastGumpGetLine(i[1])))
            while fillNumber > 0: #int(float(Gumps.LastGumpGetLine(i[1]))) < fillStopNumber:
                if Gumps.CurrentGump() == butlerGump:
                    Gumps.CloseGump(butlerGump)
                Misc.SendMessage('Filling ' + str(i[0])+ ', ' + str(fillNumber) + ' left', 66)
                Misc.Pause(dragTime)
                craftArmor (i[0], fillNumber)
                Mobiles.UseMobile(butler)
                Misc.Pause(dragTime)
                fillNumber = fillStopNumber - int(float(Gumps.LastGumpGetLine(i[1])))
        Misc.SendMessage('Butler is as full as we can get it!', 66)
        Gumps.CloseGump(butlerGump)
        sys.exit()
    else:
        Mobiles.UseMobile(butler)
        Misc.Pause(dragTime)
<file_sep># Simple mount macro by MatsaMilla
# must set mount every time Enhanced is opened, on each toon on account if needed

if Misc.CheckSharedValue('mount'+ str(Player.Serial)):
    mountSerial = Misc.ReadSharedValue('mount'+ str(Player.Serial))
else:
    mountSerial = None
    
if Player.Mount:
    Mobiles.UseMobile(Player.Serial)
else:
    if mountSerial != None:
        mount = Mobiles.FindBySerial(mountSerial)
        while Player.DistanceTo(mount) > 1:
            if Timer.Check('MountTimer') == False:
                Player.ChatSay(66, mount.Name + ' Come')
                Timer.Create('MountTimer', 500)
            Misc.Pause(50)
        Mobiles.UseMobile(mount)
    else:
        Player.HeadMessage(66,"Target Mount")
        mountSerial = Target.PromptTarget("Target Mount",33)
        mount = Mobiles.FindBySerial( mountSerial )
        if mount:
            Misc.SetSharedValue('mount'+ str(Player.Serial),mountSerial)
            while Player.DistanceTo(mount) > 1:
                if Timer.Check('MountTimer') == False:
                    Player.ChatSay(66, mount.Name + ' Come')
                    Timer.Create('MountTimer', 500)
                Misc.Pause(50)
            Mobiles.UseMobile(mount)
        else:
            Player.HeadMessage(33, 'Not Valid')
<file_sep>setTarget = Mobiles.FindBySerial( Target.PromptTarget() )
msgColor = 1

if setTarget:
    Target.SetLast(setTarget.Serial)
    Player.ChatParty('Changing last target to ' + setTarget.Name)
    if setTarget.Notoriety == 1:
        msgColor = 1266 #blue
    elif setTarget.Notoriety == 2:
        msgColor = 77 #green
    elif setTarget.Notoriety == 3 or setTarget.Notoriety == 4:
        msgColor = 902 #grey
    elif setTarget.Notoriety == 5:
        msgColor = 47 #orange
    elif setTarget.Notoriety == 6:
        msgColor = 33 #red
    Mobiles.Message( setTarget, 15 , '*Target*' )
    Player.HeadMessage( msgColor , 'Target: ' + setTarget.Name )<file_sep>Player.ChatSay(5, "Left")<file_sep>Player.ChatSay(5, "Stop")<file_sep># ItemID GM
# Targets dagger in bag until GM ItemID
# By MatsaMilla

def hide():
    if Player.GetRealSkillValue('Hiding') > 50:
        if Timer.Check('skill' + Player.Name) == False and not Player.BuffsExist('Hiding'):
            Player.UseSkill('Hiding')
            Timer.Create('skill' + Player.Name,11000)

def itemID():
    if Timer.Check('skill' + Player.Name) == False and Player.BuffsExist('Hiding'):
        dagger = Items.FindByID( 0x0F52 , -1 , Player.Backpack.Serial )
        Player.UseSkill( "Item ID" )
        Target.WaitForTarget( 10000  , True )
        Target.TargetExecute( dagger )
        Timer.Create('skill' + Player.Name,1000)


while Player.GetRealSkillValue( "Item ID" ) < 100:
    itemID()
    hide()
<file_sep># Craft Summon Water Elemental Scrolls, by MatsaMilla
#     - updated 3/10/22

# Put all crafting materials in a secured chest in your house, then target it.
# it will make as many as it can from the materials in the chest. 

Player.HeadMessage(66,'Target the OPENED Restock Chest')
restockChest = Target.PromptTarget()
dragTime = 600
bp = 0x0F7A
bm = 0x0F7B
mr = 0x0F86
ss = 0x0F8D
scroll = 0x0EF3
waterScroll = 0x1F6C
import sys

if Player.GetRealSkillValue('Inscription') < 100:
    Player.HeadMessage(33,"Wait, you arent even GM scribe? Git Gud")
    sys.exit()
        
def craftWaterEle():
    if not Gumps.CurrentGump() == 949095101:
        pen = Items.FindByID(0x0FBF,-1,Player.Backpack.Serial)
        if pen:
            Items.UseItem(pen)
        else:
            restock()
        Gumps.WaitForGump(949095101, 2000)
    Gumps.SendAction(949095101, 50)
    Gumps.WaitForGump(949095101, 2000)
    Gumps.SendAction(949095101, 51)
    Gumps.WaitForGump(949095101, 5000)
    
    # mana check
    if Player.Mana < 50:
        
        Player.UseSkill('Meditation')
        
        # dont do anything until full mana
        while Player.Mana < Player.ManaMax:
            Misc.Pause(100)

def unload():
    if Items.BackpackCount(waterScroll,-1) > 100:
        elescrolls = Items.FindByID(waterScroll, -1, Player.Backpack.Serial)
        if elescrolls:
            Items.Move(elescrolls, restockChest, 0)
            Misc.Pause(dragTime)
        

def restock():
    # restock pen, stop if out
    if Items.BackpackCount(0x0FBF, -1) < 1:
        restockPen = Items.FindByID (0x0FBF ,-1,restockChest, True)
        if restockPen:
            Items.Move(restockPen,Player.Backpack.Serial,1)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'Out of pens')
            sys.exit()

    # restock scrolls, stop if out
    if Items.BackpackCount(scroll, -1) < 1:
        scrolls = Items.FindByID (scroll ,-1,restockChest, True)
        if scrolls:
            Items.Move(scrolls, Player.Backpack.Serial, 100)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'Out of blank scrolls')
            sys.exit()
        
    # restock silk, stop if out
    if Items.BackpackCount(ss, -1) < 1:
        silk = Items.FindByID (ss ,-1,restockChest, True)
        if silk:
            Items.Move(silk, Player.Backpack.Serial, 100)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'Out of silk')
            sys.exit()
    
    # restock moss, stop if out
    if Items.BackpackCount(bm, -1) < 1:
        bloodmoss = Items.FindByID (bm ,-1,restockChest, True)
        if bloodmoss:
            Items.Move(bloodmoss, Player.Backpack.Serial, 100)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'Out of blood moss')
            sys.exit()
        
    # restock root, stop if out
    if Items.BackpackCount(mr, -1) < 1:
        root = Items.FindByID (mr ,-1,restockChest, True)
        if root:
            Items.Move(root, Player.Backpack.Serial, 100)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'Out of mandrake root')
            sys.exit()
        unload()
    
    
    unload()

while True:
    restock()    
    craftWaterEle()
   
<file_sep>Player.ChatSay(5, "Turn Left")<file_sep># Trap Box Maker by MatsaMilla
# make sure to have plenty of wood and some ignots on crafter
# place as many explostion pots on crafter as boxes you want to make
from System.Collections.Generic import List

type = 2 # 2 for box, 9 for crate
dragTime = 600
saw = 0x1034
tink = 0x1EB8
wood = 0x1BD7
ignot = 0x1BF2
expPot = 0x0F0D
amountToMake = Items.BackpackCount(expPot, -1)

trapBox = [0x9aa,0x9a9,0xe3e,0xe3c,0xe42,0xe43,0x280b,0xe7d,0xe7e,0xe3f,0xe3d,0x280c]

def craftTools():
    currentTink = Items.FindByID(tink, -1, -1)
    
    if Items.BackpackCount(ignot, -1) < 10:
        Misc.SendMessage('Out of Ignots',33)
        winsound.PlaySound(error, winsound.SND_FILENAME)
        sys.exit()
    
    if Items.BackpackCount(tink, -1) < 2:
        Items.UseItem(currentTink.Serial)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 8)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 23)

    if Items.BackpackCount(saw, -1) < 1:
        Items.UseItem(currentTink.Serial)
        Gumps.WaitForGump(949095101,1500)
        Gumps.SendAction(949095101, 8)
        Gumps.WaitForGump(949095101,1500)
        Gumps.SendAction(949095101, 51)
    
    Gumps.CloseGump(949095101)

# 2 for box, 9 for crate        
def craftBox(amount, type):
    i = 0
    while i < amount:
        currentSaw = Items.FindByID(saw, -1, -1)
        if currentSaw:
            if Gumps.CurrentGump != 949095101:
               Items.UseItem(currentSaw)
            
            Gumps.WaitForGump(949095101, 3000)
            Gumps.SendAction(949095101, 15)
            Gumps.WaitForGump(949095101, 3000)
            Gumps.SendAction(949095101, type)
            Gumps.WaitForGump(949095101, 3000)
            i = i + 1
        else:
            craftTools()
    Gumps.CloseGump(949095101)
            
# trap
def trapBoxes():
    trapList = []
    for i in Player.Backpack.Contains:
        if i.ItemID in trapBox:
            trapList.append( i.Serial )
    for t in trapList:
        currentTink = Items.FindByID( tink , -1 , -1 )
        if currentTink:
            if Gumps.CurrentGump != 949095101:
                Items.UseItem(currentTink)
            Gumps.WaitForGump(949095101, 3000)
            Gumps.SendAction(949095101, 50)
            Gumps.WaitForGump(949095101, 3000)
            Gumps.SendAction(949095101, 16)
            Target.WaitForTarget(8000, False)
            Target.TargetExecute(t)

craftBox(amountToMake, type)            
trapBoxes()
<file_sep>while not Player.IsGhost:
    Player.ChatSay(5, "Scan The Horizons")
    Misc.Pause(12500)<file_sep>Player.ChatSay(5, "Fire Right")<file_sep>while Player.GetRealSkillValue('Tracking') < 100:
    Player.UseSkill("Tracking")
    Gumps.WaitForGump(2976808305, 10000)
    Gumps.SendAction(2976808305, 4)
    Misc.Pause(500)
    Gumps.CloseGump(993494147)
    Misc.Pause(10500)
<file_sep># This script relys on Bandage_Timer.py, if you do not have it, it will not work
# Add the serials of pets you want to heal to the petList
from System.Collections.Generic import List
from System import Byte
import sys

#Pet list you can add to it by putting the Serial of the pet in the list. 
petList = [
 0x00120786,# Winged Snek
 0x003FAA39,# Kuzco
 0x00049A23,# Water Wyrm
 0x0016D74B,# Pacha
 0x001BF91B,# Matsa- Mare
 0x0028E693,# Crab
 0x000A1896,# Spida
 0x000263C0,# aragog - getold
 0x0014E207,# chicken test
 0x0011DB49,# roddy piper - donovan wolf
 0x000600B6,# TJ
 0x00190593,# gizmo - Draven
 0x001FA4BC,# rando mare
]

# quits if you have less than 80 HP
if Player.GetRealSkillValue('Veterinary') < 80:
    Misc.SendMessage('Not enough vet skill, stopping',33)
    sys.exit()
    
healing = None
while True:
    init = 0
    plist = []
    for i in petList:
        healPet = Mobiles.FindBySerial(i)
        if healPet:
            if healPet.Hits != int(0) and Player.InRangeMobile(healPet, int(1.5)):
                plist.append(healPet.Serial)
    for j in plist:
        if init == 0:
            healing = Mobiles.FindBySerial(j)
            init = 1
        healPet = Mobiles.FindBySerial(j)
        if healPet:
            if healPet.Hits <= healing.Hits or healPet.Poisoned:
                healing = Mobiles.FindBySerial(healPet.Serial)
    if healing:
        pet2Heal = Mobiles.FindBySerial(healing.Serial)
        if pet2Heal:
            if (pet2Heal.Hits < int(23) or pet2Heal.Poisoned) and Player.InRangeMobile(pet2Heal, int(1.5)):
                if Misc.ReadSharedValue('bandageDone') == True and Player.Visible:
                    prevTarget = Target.Last()
                    if Target.HasTarget( ) == False:
                        Misc.SendMessage("Healing " + pet2Heal.Name, 33)  
                        Items.UseItemByID(0x0E21, -1)
                        Target.WaitForTarget(1500)
                        Target.TargetExecute(pet2Heal)
                        Misc.Pause(600)
    
    Misc.Pause(10)
<file_sep>Player.ChatSay(5, "Back Right One")<file_sep>if not Target.HasTarget():
    if Player.Poisoned:
        Spells.CastMagery('Cure')
        Target.WaitForTarget(1500)
        Target.Self()
    else:
        Spells.CastMagery('Heal')
        Target.WaitForTarget(1500)
        Target.Self()
     
<file_sep>#para pouch popper
if Player.Paralized:
    Player.ChatSay (20, "[pouch")
    pouch = Items.FindByID( 0x0E79 , 0x0489 , Player.Backpack.Serial )
    if pouch:
        Items.WaitForProps(pouch, 500)
        Misc.Pause(120)
        charges = Items.GetPropValue(pouch, 'Charges')
    if charges > 0:
        Player.HeadMessage(0x0489,"{} charges".format(int(charges)))
<file_sep># Simple script to attack a target from a list and set it to last target
# Set up a targeting filter on the Targeting tab named enemy, example here https://imgur.com/a/f9rvEPe
# The example above will target the nearest grey non humanoid non friended mob within 12 tiles.

# set enemy variable from the targeting list 'enemy' 
enemy = Target.GetTargetFromList('enemy')

# check if there is an enemy, if there is continue
if enemy:
    Player.ChatSay(44,"All Kill")
    Target.WaitForTarget(1500)
    # this will target the enemy variable obtained from the list in the first line
    Target.TargetExecute(enemy)
    
# if no enemies, alert the player with a head message
else:
    Player.HeadMessage(44,"No Enemies")
<file_sep># Move big item to trap box & announce in party what drop is by MatsaMilla
# if key is in box, key gets locked in box...
# version 2.2 - fixed if you get drop after locked

#standard imports
from System.Collections.Generic import List
from System import Byte
import sys

lockBoxAfterDrop = True

# will not box item if serial in this list, like blessed relics
ignoreSerials = [0x402E5274]

# delay for login
Misc.Pause(2500)

msgColor = 66
dragtime = 600
backpack = Items.FindBySerial(Player.Backpack.Serial)
key = 0x100E
box = False

#dragon egg
eggList = [0x2a7c,0x47E6]

#meta relics
relicsList  = [0x2AA4]

#power scrolls
ps = 0x14F0

#skulls
skullList = [0x1AE1]

#crystals
crystalsList = [
0x35DA, #event crystal
0x0F21, #portal frag
]

perks = [ 0x2dd5,0x1f18,0x2da3,0x166e,0x26BB,0x139B,0x0FBE ]

# only boxes tame SSs, blaze color
ss = [ 0x2260 ]

#box types
trapBox = [0x9aa,0x9a9,0xe3e,0xe3c,0xe42,0xe43,0x280b,0xe7d,0xe7e,0xe3f,0xe3d,0x280c]


for b in backpack.Contains:
    if b.ItemID in trapBox:
        box = b
        Player.HeadMessage(msgColor, 'Trap Box Set to ' + box.Name)
        break
        
moveList = []

def dropWatch():
    for i in backpack.Contains:
        if i.ItemID in eggList:
            moveList.append(i.Serial)
        elif i.ItemID in relicsList:
            moveList.append(i.Serial)
        elif (i.ItemID == ps and i.Hue == 0x0481):
            moveList.append(i.Serial)
        elif i.ItemID in skullList and i.Hue == 0x0000:
            moveList.append(i.Serial)
        elif i.ItemID in crystalsList: 
            if i.Hue == 0x0489 or i.ItemID == 0x35DA:
                moveList.append(i.Serial)
        elif i.ItemID in perks:
            moveList.append(i.Serial)
        elif i.Hue == 0x0489 and i.ItemID in ss:
            moveList.append(i.Serial)
            
    for m in moveList:
        if m in ignoreSerials:
            moveList.remove(m)
            
    if len(moveList) > 0:
        boxItems()
        if lockBoxAfterDrop:
            lockBox()
        
def boxItems():
    Journal.Clear()
    for i in moveList:
        Items.Move(i, box, 0)
        Misc.Pause(dragtime)
        hotItem = Items.FindBySerial(i)
        Items.WaitForProps(hotItem, 500)
        itemName = Items.GetPropStringByIndex(hotItem, 0)
        if itemName:
            Player.HeadMessage(msgColor, itemName)
            hotItem = Items.FindBySerial(i)
            Misc.Pause(50)
            if hotItem.Container != box.Serial:
                Player.HeadMessage(33,'NOT IN BOX')
                if Journal.Search('It appears to be locked.'):
                    unlockBox()
            else:
                Player.ChatParty(itemName + ' In Box')
    del moveList[:]
        
def lockBox():
    Journal.Clear()
    boxKey = Items.FindByID(key,-1,Player.Backpack.Serial,True)
    if boxKey:
        Items.UseItem(boxKey)
        Target.WaitForTarget(1500)
        Target.TargetExecute(box)
        Misc.Pause(200)
        if Journal.Search('You lock it.'):
            Player.HeadMessage(msgColor, 'Box Locked!!')
            Player.ChatParty('Box Locked!!')
        else:
            lockBox()
    else:
        Player.HeadMessage(msgColor, 'No Key!\n!!NOT LOCKED!!')
        
def unlockBox():
    Journal.Clear()
    boxKey = Items.FindByID(key,-1,Player.Backpack.Serial,True)
    if boxKey:
        Items.UseItem(boxKey)
        Target.WaitForTarget(1500)
        Target.TargetExecute(box)
        Misc.Pause(dragtime)
        if Journal.Search('You unlock it.'):
            Player.HeadMessage(msgColor, 'Box unLocked!!')
            Player.ChatParty('Box unLocked!!')
    else:
        Player.HeadMessage(msgColor, 'No Key!\n!!Still UnLOCKED!!')
    
    boxItems()
    

Journal.Clear()
while True:
    if not box:
        Misc.Pause(500)
        Misc.SendMessage('No trap box, stopping script', 33)
        sys.exit()
    Misc.Pause(50)
    dropWatch()   
<file_sep># in dress agent create one that is your player name
# without spaces and all lowercase.
# Example: "Player Name" needs to be playername
msgcolor = 62
dresslist = Player.Name.lower().replace(' ', '')

#Player.HeadMessage(msgcolor, "Dressing")
Dress.ChangeList(dresslist)
Dress.DressFStart()<file_sep>leftHand = Player.GetItemOnLayer('LeftHand')
chugtime = 650
msgColor = 66
noBow = True
bows = [ 0x13B2,0x26C2,0x0F50,0x13FD,0x0A12,0x0F6B] # 0x0A12,0x0F6B = torch

if not leftHand:
    noBow = True
elif leftHand.ItemID in bows:
    noBow = False
elif leftHand:
    noBow = True
    
def cureDrink():
    Journal.Clear()
    if Player.Poisoned:
        if leftHand and noBow:
            Player.UnEquipItemByLayer('LeftHand')
            Misc.Pause(chugtime)
            Player.ChatSay( 1 , '[drink greatercurepotion')
            Misc.Pause(100)
            if Journal.Search( 'You do not have any of those potions.'):
                Player.HeadMessage(msgColor, "No Cure pots!")
            Misc.Pause(chugtime)
            Player.EquipItem(leftHand)
            Misc.Pause(50)
        else:
            Player.ChatSay( 1 , '[drink greatercurepotion')
            Misc.Pause(100)
            if Journal.Search( 'You do not have any of those potions.'):
                Player.HeadMessage(msgColor, "No Cure pots!")
            else:
                Misc.NoOperation()
    else:
        Player.HeadMessage(msgColor, "Not Poisoned")
        
def curePot():
    if Player.Poisoned:
        orangePot = Items.FindByID(0x0F07,0,Player.Backpack.Serial,True)
        if orangePot:
            if leftHand and noBow:
                Player.UnEquipItemByLayer('LeftHand')
                Misc.Pause(chugtime)
                Items.UseItem(orangePot)
                Misc.Pause(chugtime)
                Player.EquipItem(leftHand)
                Misc.Pause(50)
            else:
                Items.UseItem(orangePot)
        else:
            Player.HeadMessage(msgColor, "No Cure pots!")
            
    else:
        Player.HeadMessage(msgColor, "Not Poisoned")
        
if Misc.ShardName() == "Ultima Forever" or Misc.ShardName() == "UOForever":
    cureDrink()
else:
    curePot()
<file_sep># OG from AbelGoodwin https://github.com/hampgoodwin/razorenhancedscripts
# Modified by Matsamilla
#
# Last updated: 12/2/21

if Player.GetRealSkillValue('Lumberjacking') < 40:
    Misc.SendMessage('No skill, stopping',33)
    Stop

#********************
# serial of your beetle, logs go here when full
beetle = 0x00285C67

# Attack nearest grey script name (must be exact)
autoFightMacroName = 'pvm_AttackGrey.py'

# you want boards or logs?
logsToBoards = False

# Trees where there is no longer enough wood to be harvested will not be revisited until this much time has passed
treeCooldown = 1200000 # 1,200,000 ms is 20 minutes

# Want this script to alert you for humaniods?
alert = False
#********************

# Parameters
scanRadius = 15
treeStaticIDs = [ 0x0C95, 0x0C96, 0x0C99, 0x0C9B, 0x0C9C, 0x0C9D, 0x0C8A, 0x0CA6,
    0x0CA8, 0x0CAA, 0x0CAB, 0x0CC3, 0x0CC4, 0x0CC8, 0x0CC9, 0x0CCA, 0x0CCB,
    0x0CCC, 0x0CCD, 0x0CD0, 0x0CD3, 0x0CD6, 0x0CD8, 0x0CDA, 0x0CDD, 0x0CE0,
    0x0CE3, 0x0CE6, 0x0CF8, 0x0CFB, 0x0CFE, 0x0D01, 0x0D25, 0x0D27, 0x0D35,
    0x0D37, 0x0D38, 0x0D42, 0x0D43, 0x0D59, 0x0D70, 0x0D85, 0x0D94, 0x0D96,
    0x0D98, 0x0D9A, 0x0D9C, 0x0D9E, 0x0DA0, 0x0DA2, 0x0DA4, 0x0DA8, ]
    
if Misc.ShardName() == 'Ultima Forever':
    treeStaticIDsToRemove = [ 0x0C99, 0x0C9A, 0x0C9B, 0x0C9C, 0x0C9D, 0x0CA6, 0x0CC4, ]
    for treeStaticIDToRemove in treeStaticIDsToRemove:
        if treeStaticIDToRemove in treeStaticIDs:
            treeStaticIDs.remove( treeStaticIDToRemove )
    
#axeSerial = None
EquipAxeDelay = 1000
TimeoutOnWaitAction = 4000
ChopDelay = 1000
runebookBank = 0x41EA8DEE # Runebook for bank
runebookTrees = 0x41EA8DEE # Runebook for tree spots
recallPause = 3000
dragDelay = 600
logID = 0x1BDD
boardID = 0x1BD7
otherResourceID = [ 0x318F, 0x3199, 0x2F5F, 0x3190, 0x3191, ]
logBag = 0x401FA597 # Serial of log bag in bank
otherResourceBag = 0x40191C19 # Serial of other resource in bank
weightLimit = Player.MaxWeight - 10
bankX = 2051
bankY = 1343
axeList = [ 0x0F49, 0x13FB, 0x0F47, 0x1443, 0x0F45, 0x0F4B, 0x0F43 ]
rightHand = Player.CheckLayer( 'RightHand' )
leftHand = Player.CheckLayer( 'LeftHand' )


# System Variables
from System.Collections.Generic import List
from System import Byte
from math import sqrt
import clr
clr.AddReference('System.Speech')
from System.Speech.Synthesis import SpeechSynthesizer
tileinfo = List[Statics.TileInfo]
trees = []
treeCoords = None
blockCount = 0
lastRune = 5
onLoop = True

class Tree:
    x = None
    y = None
    z = None
    id = None
    
    def __init__ ( self, x, y, z, id ):
        self.x = x
        self.y = y
        self.z = z
        self.id = id


def RecallNextSpot():
    global lastRune

    Gumps.ResetGump()

    Misc.SendMessage('--> Recall to Spot', 77)

    Items.UseItem( runebookTrees )
    Gumps.WaitForGump( 1431013363, TimeoutOnWaitAction )
    Gumps.SendAction( 1431013363, lastRune )

    Misc.Pause( recallPause )

    lastRune = lastRune + 6
    if lastRune > 95:
        lastRune = 5

    EquipAxe()


def RecallBack():
    global lastRune

    Items.UseItem( runebookTrees )
    Gumps.WaitForGump( 1431013363, TimeoutOnWaitAction )
    Gumps.SendAction( 1431013363, lastRune )

    Misc.Pause( recallPause )

    EquipAxe()


def DepositInBank():
    global bankX
    global bankY
    while Player.Weight >= weightLimit:
        Gumps.ResetGump()
        Items.UseItem( runebookBank )
        Gumps.WaitForGump( 1431013363, 10000 )
        Gumps.SendAction( 1431013363, 71 )
        Misc.Pause( recallPause )

        Player.ChatSay( 77, 'bank' )
        Misc.Pause( 300 )

        if Items.BackpackCount( logID, -1 ) > 0:
            while Items.BackpackCount( logID, -1 ) > 0:
                Misc.SendMessage( '--> Moving Log', 77 )
                Items.Move( item, logBag, 0 )
                Misc.Pause( dragDelay )

        if Items.BackpackCount( boardID, -1 ) > 0:
            while Items.BackpackCount( boardID, -1 ) > 0:
                Misc.SendMessage( '--> Moving Log', 77 )
                Items.Move( item, logBag, 0 )
                Misc.Pause( dragDelay )

        for otherid in otherResourceID:
            if item.ItemID == otherid:
                Misc.SendMessage( '--> Moving Other', 77 )
                Items.Move( item, otherResourceBag, 0 )
                Misc.Pause( dragDelay )
            else:
                Misc.NoOperation()


def ScanStatic():
    global treenumber
    global trees
    Misc.SendMessage('--> Scan Tile Started', 77)
    minX = Player.Position.X - scanRadius
    maxX = Player.Position.X + scanRadius
    minY = Player.Position.Y - scanRadius
    maxY = Player.Position.Y + scanRadius

    x = minX
    y = minY

    while x <= maxX:
        while y <= maxY:
            staticsTileInfo = Statics.GetStaticsTileInfo( x, y, Player.Map )
            if staticsTileInfo.Count > 0:
                for tile in staticsTileInfo:
                    for staticid in treeStaticIDs:
                        if staticid == tile.StaticID and not Timer.Check( '%i,%i' % ( x, y ) ):
                            #Misc.SendMessage( '--> Tree X: %i - Y: %i - Z: %i' % ( minX, minY, tile.StaticZ ), 66 )
                            trees.Add( Tree( x, y, tile.StaticZ, tile.StaticID ) )
            y = y + 1
        y = minY
        x = x + 1

    trees = sorted( trees, key = lambda tree: sqrt( pow( ( tree.x - Player.Position.X ), 2 ) + pow( ( tree.y - Player.Position.Y ), 2 ) ) )
    Misc.SendMessage( '--> Total Trees: %i' % ( trees.Count ), 77 )


def RangeTree():
    playerX = Player.Position.X
    playerY = Player.Position.Y
    treeX = trees[ 0 ].x
    treeY = trees[ 0 ].y
    if ( ( treeX >= playerX - 1 and treeX <= playerX + 1 ) and ( treeY >= playerY - 1 and treeY <= playerY + 1 )  ):
        return True
    else:
        return False


def MoveToTree():
    global trees
    global treeCoords
    pathlock = 0
    Misc.SendMessage( '--> Moving to TreeSpot: %i, %i' % ( trees[ 0 ].x, trees[ 0 ].y ), 77 )
    Misc.Resync()
    treeCoords = PathFinding.Route()
    treeCoords.MaxRetry = 5
    treeCoords.StopIfStuck = False
    treeCoords.X = trees[ 0 ].x
    treeCoords.Y = trees[ 0 ].y + 1
    #Items.Message(trees[0], 1, "Here")
    
    
    if PathFinding.Go( treeCoords ):
        #Misc.SendMessage('First Try')
        Misc.Pause( 1000 )
    else:
        Misc.Resync()
        treeCoords.X = trees[ 0 ].x + 1
        treeCoords.Y = trees[ 0 ].y
        if PathFinding.Go( treeCoords ):
            Misc.SendMessage( 'Second Try' )
        else:
            treeCoords.X = trees[ 0 ].x - 1
            treeCoords.Y = trees[ 0 ].y
            if PathFinding.Go( treeCoords ):
                Misc.SendMessage( 'Third Try' )
            else:
                treeCoords.X = trees[ 0 ].x
                treeCoords.Y = trees[ 0 ].y - 1
                Misc.SendMessage( 'Final Try' )
                if PathFinding.Go( treeCoords ):
                    Misc.NoOperation()
                else:
                    return
                

    Misc.Resync()

    while not RangeTree():
        CheckEnemy()
        Misc.Pause( 100 )
        pathlock = pathlock + 1
        if pathlock > 350:
            Misc.Resync()
            treeCoords = PathFinding.Route()
            treeCoords.MaxRetry = 5
            treeCoords.StopIfStuck = False
            treeCoords.X = trees[ 0 ].x
            treeCoords.Y = trees[ 0 ].y + 1
            
            if PathFinding.Go( treeCoords ):
                #Misc.SendMessage('First Try')
                Misc.Pause( 1000 )
            else:
                treeCoords.X = trees[ 0 ].x + 1
                treeCoords.Y = trees[ 0 ].y
                if PathFinding.Go( treeCoords ):
                    Misc.SendMessage( 'Second Try' )
                else:
                    treeCoords.X = trees[ 0 ].x - 1
                    treeCoords.Y = trees[ 0 ].y
                    if PathFinding.Go( treeCoords ):
                        Misc.SendMessage( 'Third Try' )
                    else:
                        treeCoords.X = trees[ 0 ].x
                        treeCoords.Y = trees[ 0 ].y - 1
                        Misc.SendMessage( 'Final Try' )
                        PathFinding.Go( treeCoords )

            pathlock = 0
            return

    Misc.SendMessage( '--> Reached TreeSpot: %i, %i' % ( trees[ 0 ].x, trees[ 0 ].y ), 77 )


def EquipAxe():
    global axeSerial

    if not leftHand:
        for item in Player.Backpack.Contains:
            if item.ItemID in axeList:
                Player.EquipItem( item.Serial )
                Misc.Pause( 600 )
                axeSerial = Player.GetItemOnLayer( 'LeftHand' ).Serial
    elif Player.GetItemOnLayer( 'LeftHand' ).ItemID in axeList:
        axeSerial = Player.GetItemOnLayer( 'LeftHand' ).Serial
    else:
        Player.HeadMessage( 35, 'You must have an axe to chop trees!' )
        Misc.Pause( 1000 )


def CutTree():
    global blockCount
    global trees
    if Target.HasTarget():
        Misc.SendMessage( '--> Detected block, canceling target!', 77 )
        Target.Cancel()
        Misc.Pause( 500 )

    if Player.Weight >= weightLimit:
        MoveToBeetle()
        MoveToTree()

    CheckEnemy()

    Journal.Clear()

    Items.UseItem( Player.GetItemOnLayer( 'LeftHand' ) )
    Target.WaitForTarget( TimeoutOnWaitAction , True )
    Target.TargetExecute( trees[ 0 ].x, trees[ 0 ].y, trees[ 0 ].z, trees[ 0 ].id )
    Timer.Create('chopTimer', 10000)
    while not ( Journal.SearchByType( 'You hack at the tree for a while, but fail to produce any useable wood.', 'System' ) or 
        Journal.SearchByType( 'You chop some', 'System' ) or 
            Journal.SearchByType( 'There\'s not enough wood here to harvest.', 'System' ) or
            Timer.Check('chopTimer') == False ):
        Misc.Pause( 100 )

    if Journal.SearchByType( 'There\'s not enough wood here to harvest.', 'System' ):
        Misc.SendMessage( '--> Tree change', 77 )
        Timer.Create( '%i,%i' % ( trees[ 0 ].x, trees[ 0 ].y ), treeCooldown )
    elif Journal.Search( 'That is too far away' ):
        blockCount = blockCount + 1
        Journal.Clear()
        if blockCount > 3:
            blockCount = 0
            Misc.SendMessage( '--> Possible block detected tree change', 77 )
            Timer.Create( '%i,%i' % ( trees[ 0 ].x, trees[ 0 ].y ), treeCooldown )
        else:
            CutTree()
    elif Journal.Search( 'bloodwood' ):
        Player.HeadMessage( 1194, 'BLOODWOOD!' )
        Timer.Create('chopTimer', 10000)
        CutTree()
    elif Journal.Search( 'heartwood' ):
        Player.HeadMessage( 1193, 'HEARTWOOD!' )
        Timer.Create('chopTimer', 10000)
        CutTree()
    elif Journal.Search( 'frostwood' ):
        Player.HeadMessage( 1151, 'FROSTWOOD!' )
        Timer.Create('chopTimer', 10000)
        CutTree()
    elif Timer.Check('chopTimer') == False:
        Misc.SendMessage( '--> Tree change', 77 )
        Timer.Create( '%i,%i' % ( trees[ 0 ].x, trees[ 0 ].y ), treeCooldown )
    else:
        CutTree()

def CheckEnemy():
    enemy = Target.GetTargetFromList( 'enemywar' )
    if enemy != None:
        Misc.ScriptRun( autoFightMacroName )
        while enemy != None:
            Timer.Create('Fight', 2500)
            Misc.Pause( 1000 )
            enemy = Mobiles.FindBySerial( enemy.Serial )
            if enemy:
                if Player.DistanceTo( enemy ) > 1:
                    enemyPosition = enemy.Position
                    enemyCoords = PathFinding.Route()
                    enemyCoords.MaxRetry = 5
                    enemyCoords.StopIfStuck = False
                    enemyCoords.X = enemyPosition.X
                    enemyCoords.Y = enemyPosition.Y - 1
                    PathFinding.Go( enemyCoords )
                
                    Misc.ScriptRun( autoFightMacroName )
                elif Timer.Check('Fight') == False:
                    Misc.ScriptRun( autoFightMacroName )
                    Timer.Create('Fight', 2500)
            enemy = Target.GetTargetFromList( 'enemywar' )

        corpseFilter = Items.Filter()
        corpseFilter.Movable = False
        corpseFilter.RangeMax = 2
        corpseFilter.Graphics = List[int]( [ 0x2006 ] )
        corpses = Items.ApplyFilter( corpseFilter )
        corpse = None

        Misc.Pause( dragDelay )

        for corpse in corpses:
            for item in corpse.Contains:
                if item.ItemID == logID:
                    Items.Move( item.Serial, Player.Backpack.Serial, 0 )
                    Misc.Pause( dragDelay )
                    
        PathFinding.Go( treeCoords )


def GetNumberOfBoardsInBeetle():
    global beetle
    global boardID
    global dragDelay

    remount = False
    if not Mobiles.FindBySerial( beetle ):
        remount = True
        Mobiles.UseMobile( Player.Serial )
        Misc.Pause( dragDelay )

    numberOfBoards = 0
    for item in Mobiles.FindBySerial( beetle ).Backpack.Contains:
        if item.ItemID == boardID:
            numberOfBoards += item.Amount

    if remount:
        Mobiles.UseItem( beetle )
        Misc.Pause( dragDelay )

    return numberOfBoards


def GetNumberOfLogsInBeetle():
    global beetle
    global logID
    global dragDelay

    remount = False
    if not Mobiles.FindBySerial( beetle ):
        remount = True
        Mobiles.UseMobile( Player.Serial )
        Misc.Pause( dragDelay )

    numberOfBoards = 0
    for item in Mobiles.FindBySerial( beetle ).Backpack.Contains:
        if item.ItemID == boardID:
            numberOfBoards += item.Amount

    if remount:
        Mobiles.UseItem( beetle )
        Misc.Pause( dragDelay )

    return numberOfBoards

def filterItem(id,range=2, movable=True):
    fil = Items.Filter()
    fil.Movable = movable
    fil.RangeMax = range
    fil.Graphics = List[int](id)
    list = Items.ApplyFilter(fil)

    return list

def MoveToBeetle():
    # Chop logs into boards
    if logsToBoards:
        for item in Player.Backpack.Contains:
            if item.ItemID == logID:
                Items.UseItem( Player.GetItemOnLayer( 'LeftHand' ) )
                Target.WaitForTarget( 1500, False )
                Target.TargetExecute( item )
                Misc.Pause( dragDelay )

    if Player.Mount:
        Mobiles.UseMobile( Player.Serial )
        Misc.Pause( dragDelay )

    # Move boards to beetle, if they will fit in the beetle
    for item in Player.Backpack.Contains:
        if logsToBoards and item.ItemID == boardID:
            numberOfBoardsInBeetle = GetNumberOfBoardsInBeetle()
            if numberOfBoardsInBeetle + i.Amount < 16000:
                Items.Move( i, beetle, 0 )
                Misc.Pause( dragDelay )
        elif not logsToBoards and item.ItemID == logID:
            numberOfBoardsInBeetle = GetNumberOfLogsInBeetle()
            if numberOfBoardsInBeetle + item.Amount < 16000:
                Items.Move( item, beetle, 0 )
                Misc.Pause( dragDelay )
    groundItems = filterItem([boardID,logID])
    if groundItems:
        Player.HeadMessage(33, 'BEETLE FULL STOPPING')
        say('Your beetle is full, stop and unload')
        Stop

    if not Player.Mount:
        Mobiles.UseMobile( beetle )
        Misc.Pause( dragDelay )
        
toonFilter = Mobiles.Filter()
toonFilter.Enabled = True
toonFilter.RangeMin = -1
toonFilter.RangeMax = -1
toonFilter.IsHuman = True 
toonFilter.Friend = False
toonFilter.Notorieties = List[Byte](bytes([1,2,3,4,5,6,7]))

invulFilter = Mobiles.Filter()
invulFilter.Enabled = True
invulFilter.RangeMin = -1
invulFilter.RangeMax = -1
invulFilter.Friend = False
invulFilter.Notorieties = List[Byte](bytes([7]))
def say(text):
    spk = SpeechSynthesizer()
    spk.Speak(text)
        
def safteyNet():
    if alert:
        toon = Mobiles.ApplyFilter(toonFilter)
        invul = Mobiles.ApplyFilter(invulFilter)
        if toon:
            Misc.FocusUOWindow()
            say("Hey, someone is here. You should tab over and take a look")
            toonName = Mobiles.Select(toon, 'Nearest')
            if toonName:
                Misc.SendMessage('Toon Near: ' + toonName.Name, 33)
        elif invul:
            say("Hey, something invulnerable here. You should tab over and take a look")
            invulName = Mobiles.Select(invul, 'Nearest')
            if invulName:
                Misc.SendMessage('Uh Oh: Invul! Who the fuck is ' + invul.Name, 33)
        else:
            Misc.NoOperation()
Friend.ChangeList('lj')
Misc.SendMessage('--> Start up Woods', 77)
EquipAxe()
while onLoop:
    #RecallNextSpot()
    ScanStatic()
    i = 0
    while trees.Count > 0:
        safteyNet()
        MoveToTree()
        CutTree()
        trees.pop( 0 )
        trees = sorted( trees, key = lambda tree: sqrt( pow( ( tree.x - Player.Position.X ), 2 ) + pow( ( tree.y - Player.Position.Y ), 2 ) ) )
    trees = []
    Misc.Pause( 100 )
<file_sep>These scripts have all been written for the shard Ultima Online Forever. They may work for other shards, but if they don't you now know why :)

How to set up CUO + RE: 2 methods
  Method 1: Launch Razor Enhanced, point it to Classic UO, good to go? - Untested by me, this is a new addition to RazorEnhanced.
  Method 2 (what I use) with video!: https://www.youtube.com/watch?v=fSmFPxmZSOI
    - This assums you have downloaded the UOForver laucnher from uoforever.com and have the UO Files downloaded.
    
How to add scripts & some basic use of Enhanced:
  https://www.youtube.com/watch?v=W7s7ylopA0Q
  
Targeting Video Instructions: https://youtu.be/vqCYRl_IKME
  
Razor Enhanced Wiki: http://razorenhanced.net/dokuwiki/doku.php
ClassicUO: https://www.classicuo.eu/
www.uoforever.com
<file_sep>if Misc.ShardName() == "UO Ages":
    delaytime = 800
else:
    delayTime = 600

# add (Name, PlayerSerial, MountSerial, True/False) to list 
#   True if you want toon to DISMOUNT + ALL KILL + TARGET LAST
dismountList = [ 
#   (PlayerName, PlayerSerial, MountSerial, True/False)
    ("MGD" , 0x0000B71C , 0x003FAA39 , True ), 
    ("Moltar" , 0x003C518F , 0x0007E386 , True ), 
    ("EmGD" , 0x00255122 , 0x00215F22 , False),
    ("UselessGuy" , 0x0022FE20 , 0x0006EB2A , False ),
    ("Matsa" , 0x000470E6 , 0x0000 , False ),
    ("Matsa-" , 0x001DF0B7 , 0x0028E693 , False ),
    ("Thicc" , 0x0016218A , 0x0001E6B3 , False),
    ("MatsaAxa", 0x0000 , 0x00285C67 , False),
    ("Nalfein" , 0x000B519E , 0x00823AEA , False ),
    ("MatsaMilla" , 0x0002DC9C , 0x0007A37B , False ),
    ("useless", 0x000AE1A2 , 0x000803D8 , False),
] 
    
    
def dismount(mountSerial, attack):
    if Player.Mount:
        if attack:
            lastTarget = Mobiles.FindBySerial( Target.GetLast() )
            if lastTarget:
                if lastTarget != Player.Serial:
                    if Player.DistanceTo(lastTarget) < 12:
                        Mobiles.UseMobile(Player.Serial)
                        Misc.Pause(100)
                        Player.ChatSay(33, 'All Kill')
                        Target.WaitForTarget(1500)
                        Target.TargetExecute(lastTarget)
    
        else:
            Mobiles.UseMobile(Player.Serial)
            Misc.Pause(120)
            mount = Mobiles.FindBySerial(mountSerial)
            #Misc.Pause(120)
            if mount:
                if mount.Body == 0x0317:
                    Misc.WaitForContext(mount, 1500)
                    Misc.Pause(150)
                    if Player.Visible:
                        #Misc.ContextReply(mount, 10)
                        Misc.ContextReply(mountSerial, "Open Backpack")
                    else:
                        #Misc.ContextReply(mount, 0)
                        Misc.ContextReply(mountSerial, "Open Backpack")
    
    elif mountSerial != None:
        mount = Mobiles.FindBySerial(mountSerial)
        if mount:
            while Player.DistanceTo(mount) > 1:
                if Timer.Check('MountTimer') == False:
                    Player.ChatSay(66, mount.Name + ' Come')
                    Timer.Create('MountTimer', 500)
                Misc.Pause(50)
            Mobiles.UseMobile(mountSerial)
        else:
            Player.HeadMessage(33,'Mount not found')

        
for d in dismountList: 
    if Player.Serial == d[1]:
        dismount(d[2], d[3])
        break

<file_sep>Player.ChatSay(5, "Back Left One")<file_sep># Sallos SmartPot by MatsaMilla
# Drinks cure if poisoned, otherwise drinks heal

def potDrink():
    if Player.Poisoned:
        Player.ChatSay( 1 , '[drink greatercurepotion')
        Misc.Pause(100)
        if Journal.Search( 'You do not have any of those potions.'):
            Player.HeadMessage(33, "No Cure pots!")
    else:
        Player.ChatSay( 1 , '[drink greaterhealpotion')
        Misc.Pause(100)
        if Journal.Search( 'You do not have any of those potions.'):
            Player.HeadMessage(33, "No Heal pots!")

def usePot():
    if Player.Poisoned:
        orangePot = Items.FindByID(0x0F07,0,Player.Backpack.Serial,True)
        if orangePot:
            Items.UseItem(orangePot)
        else:
            Player.HeadMessage(33, "No Cure pots!")
    else:
        yellowPot = Items.FindByID(0x0F0C,0,Player.Backpack.Serial,True)
        if yellowPot:
            Items.UseItem(orangePot)
        else:
            Player.HeadMessage(33, "No Heal pots!")

if Misc.ShardName() == "Ultima Forever" or Misc.ShardName() == "UOForever":
    potDrink()
else:
    usePot()
<file_sep># Spellbook Filler by MatsaMilla
# Just open any chests containing scrolls, hit play, target a book.
# script should find any scrolls and add them to book.
from System.Collections.Generic import List

spellBook = Target.PromptTarget('Target Spell Book to Fill')

scrolls = [0x1f2d,0x1f2e,0x1f2f,0x1f30,0x1f31,0x1f32,0x1f33,0x1f34,0x1f35,0x1f36,0x1f37,0x1f38,0x1f39,
0x1f3a,0x1f3b,0x1f3c,0x1f3d,0x1f3e,0x1f3f,0x1f40,0x1f41,0x1f42,0x1f43,0x1f44,0x1f45,0x1f46,0x1f47,0x1f48,
0x1f49,0x1f4a,0x1f4b,0x1f4d,0x1f4e,0x1f4f,0x1f50,0x1f51,0x1f52,0x1f53,0x1f54,0x1f55,0x1f56,0x1f57,0x1f58,
0x1f59,0x1f5a,0x1f5b,0x1f5c,0x1f5d,0x1f5e,0x1f5f,0x1f60,0x1f61,0x1f62,0x1f63,0x1f64,0x1f65,0x1f66,0x1f67,
0x1f68,0x1f69,0x1f6a,0x1f6b,0x1f6c]


if Misc.ShardName() == "UO Ages":
    contextResponse = 0
else:
    contextResponse = 1

for l in scrolls:
    currentScroll = Items.FindByID(l,-1,-1)
    if currentScroll:
        Misc.WaitForContext(currentScroll, 1000)
        Misc.ContextReply(currentScroll, contextResponse)
        Target.WaitForTarget(1000, False)
        Target.TargetExecute(spellBook)
<file_sep>Player.ChatSay(5, "Forward Right One")<file_sep>'''
Author: TheWarDoctor95
Other Contributors:
    Last Contribution By: MatsaMilla - 7/19/21

Description: Train fishing, Fishing up MIBs, nets, maps & scales
Fishing pole must be in bag
'''

#############    Setup Section    ################

cutCorpse = True # True if you want to cut corpses

#update for MAGE heal macro - use MatsaMilla Bandage_Self.py if you have healing
healMacroName = 'cast_BigHeal.py' #found in MatsaMilla github

# true to attack serpents - will attack by magery if no tactics
attack = True
    
###########  End  Setup Section    ###############

from System.Collections.Generic import List
from System import Byte
import sys
dragTime = 600
journalEntryDelay = 200

fishIDs = [ 0x09CF, 0x09CE, 0x09CC, 0x09CD ]
player_bag = Items.FindBySerial(Player.Backpack.Serial)

hornedFilter = Items.Filter()
hornedFilter.OnGround = 1
hornedFilter.Movable = True
hornedFilter.RangeMin = 0
hornedFilter.RangeMax = 2
hornedFilter.Graphics = List[int]( [ 0x1079 , 0x1081 ] ) #cut leather graphic 0x1081
hornedFilter.Hues = List[int]( [ 0x0900 ] )

fishsteakFilter = Items.Filter()
fishsteakFilter.OnGround = 1
fishsteakFilter.Movable = True
fishsteakFilter.RangeMin = 0
fishsteakFilter.RangeMax = 2
fishsteakFilter.Graphics = List[int]( [ 0x097A ] )

# mobile filter
def find(notoriety):
    fil = Mobiles.Filter()
    fil.Enabled = True
    fil.RangeMax = 12
    fil.IsHuman = False
    fil.IsGhost = False
    fil.Friend = False
    fil.Notorieties = List[Byte](bytes(notoriety))
    list = Mobiles.ApplyFilter(fil)

    return list
    
def Fish( fishingPole, x, y ):
    '''
    Casts the fishing pole and returns True while the fish are biting
    '''
    
    global fishIDs
    
    # eats special fish
    if Items.BackpackCount(0x0DD6,-1) > 0:
        spFish = Items.FindByID(0x0DD6,-1,Player.Backpack.Serial)
        Items.UseItem(spFish)
        Misc.Pause( dragTime )

    Journal.Clear()
    Items.UseItemByID(0x0DBF,-1)
    
    Target.WaitForTarget( 2000, True )
    
    statics = Statics.GetStaticsTileInfo( x, y, 0 )
    if len( statics ) > 0:
        water = statics[ 0 ]
        Target.TargetExecute( x, y, water.StaticZ, water.StaticID )
    else:
        Target.TargetExecute( x, y, -5, 0x0000 )
        
    
    Misc.Pause( dragTime )
    Target.Cancel()
        
    Timer.Create( 'timeout', 20000 )
    while not ( Journal.SearchByType( 'You pull', 'System' ) or
            Journal.SearchByType( 'You fish a while, but fail to catch anything.', 'System' ) or
            Journal.SearchByType( 'Your fishing pole bends as you pull a big fish from the depths!', 'System' ) or
            Journal.SearchByType( 'Uh oh! That doesn\'t look like a fish!', 'System' )):
        
        if not Timer.Check( 'timeout' ):
            return False
        
        if (Journal.SearchByType( 'The fish don\'t seem to be biting here', 'System' ) or
            Journal.SearchByType( 'You need to be closer to the water to fish!', 'System' )):
            return False
        
        enemy = Mobiles.Select(find([3,4]),'Nearest')
        if enemy != None:
            FightEnemy()
        Misc.Pause( 50 )

    
    if Player.Weight >= Player.MaxWeight - 20 :
        for fish in player_bag.Contains:
            # cuts fish
            if fish.ItemID in fishIDs:
                Items.UseItemByID( 0x0F52 )
                Target.WaitForTarget( 2000, True )
                Target.TargetExecute( fish )
                Misc.Pause( dragTime )
            # cuts up leather
            if fish.ItemID == 0x1079:
                Items.UseItemByID( 0x0F9F )
                Target.WaitForTarget( 2000, True )
                Target.TargetExecute( fish )
                Misc.Pause( dragTime )
        stackItem(0x097A, -1, fishsteakFilter) #stacks fish to feet
        stackItem(0x1081, -1, hornedFilter) #stacks cut leather to feet
        stackItem(0x1079, -1, hornedFilter) #stacks leather to feet if not cut
    
    return True



def FightEnemy():
    enemy = Mobiles.Select(find([3,4]),'Nearest')
    if attack == False:
        return
    if Player.GetRealSkillValue('Tactics') > 60:
        if enemy != None:
            Timer.Create('fishattack', 60000)
            Misc.ScriptRun( autoFightMacroName )
            while enemy != None:
                enemy = enemy.serial
                Misc.Pause( 100 )
                if Timer.Check('fishattack') == False:
                    for i in range( 0, 3 ):
                        Player.ChatSay( 0, 'back one' )
                        Misc.Pause( 320 )
                    break
                    
    elif Player.GetRealSkillValue('Magery') > 70:
        while enemy!= None:
            enemy = Mobiles.FindBySerial( enemy.Serial )
            if enemy == None:
                break
            while Player.Mana > 20 and enemy != None:
                enemy = Mobiles.FindBySerial( enemy.Serial )
                if enemy == None:
                    break
                Spells.CastMagery( 'Energy Bolt' )
                Target.WaitForTarget( 2000, False )
                Target.TargetExecute( enemy )
                Misc.Pause( 1600 )
            if Player.Hits < 40:
                Misc.ScriptRun(healMacroName)
            Player.UseSkill( 'Meditation' )
            while Player.Mana < 34:
                Misc.Pause( 100 )
                if Player.Hits < 40:
                    Misc.ScriptRun(healMacroName)
            if enemy == None:
                break
                    
def scoopCorpse():
    for i in range( 0, 3 ):
        Player.ChatSay( 0, 'back one' )
        Misc.Pause( 320 )
        
    for i in range( 0, 4 ):
        Player.ChatSay( 0, 'forward one' )
        Misc.Pause( 320 )
        
    for i in range( 0, 5 ):    
        Player.ChatSay( 0, 'left one' )
        Misc.Pause( 320 )
    
    for i in range( 0, 10 ):
        Player.ChatSay( 0, 'right one' )
        Misc.Pause( 320 )
        
    for i in range( 0, 5 ):    
        Player.ChatSay( 0, 'left one' )
        Misc.Pause( 320 )

    corpseFilter = Items.Filter()
    corpseFilter.Movable = False
    corpseFilter.RangeMax = 2
    corpseFilter.Graphics = List[int]( [ 0x2006 ] )
    corpseFilter.CheckIgnoreObject = True
    corpses = Items.ApplyFilter( corpseFilter )
    corpse = None
    
    for corpse in corpses:
        if cutCorpse:
            Items.UseItemByID( 0x0F52 )
            Target.WaitForTarget( 2000, True )
            Target.TargetExecute( corpse.Serial )
            Misc.Pause( dragTime )
            Misc.IgnoreObject( corpse.Serial )
        
        #if Items.BackpackCount( 0x1079 , -1 ) > 0:
        leather = Items.FindByID( 0x1079 , -1 , Player.Backpack.Serial) 
        if leather:
            Items.UseItemByID( 0x0F9F )
            Target.WaitForTarget( 2000, True )
            Target.TargetExecute( leather )
            Misc.Pause( dragTime )
            stackItem(0x1081, -1, hornedFilter) #stacks cut leather to feet

def UseFishing():
    global moveForwardBackward
    
    fishingPole = Items.FindByID( 0x0DBF, -1 , Player.Backpack.Serial )
    
    if fishingPole == None:
        Misc.SendMessage('No fishing poles!!', 33)
        sys.exit()
            
    while True:
        x = Player.Position.X - 3
        y = Player.Position.Y - 3
        while Fish( fishingPole, x, y ):
            enemy = Mobiles.Select(find([3,4]),'Nearest')
            if enemy != None:
                FightEnemy()
                
        x = Player.Position.X + 3
        y = Player.Position.Y - 3
        while Fish( fishingPole, x, y ):
            enemy = Mobiles.Select(find([3,4]),'Nearest')
            if enemy != None:
                FightEnemy()

        x = Player.Position.X + 3
        y = Player.Position.Y + 3
        while Fish( fishingPole, x, y ):
            enemy = Mobiles.Select(find([3,4]),'Nearest')
            if enemy != None:
                FightEnemy()
        
        x = Player.Position.X - 3
        y = Player.Position.Y + 3
        while Fish( fishingPole, x, y ):
            enemy = Mobiles.Select(find([3,4]),'Nearest')
            if enemy != None:
                FightEnemy()

        Misc.Pause( 320 )
        
        scoopCorpse()
        
        for i in range( 0, 20 ):
            Player.ChatSay( 0, 'Forward one')
            Misc.Pause( 320 )
        Misc.Pause( 320 )

        Misc.Pause( journalEntryDelay )
        
        if Journal.Search( 'Ar, we\'ve stopped sir.' ):
            Misc.Beep()
            Journal.Clear()
                    
def stackItem ( item , hue , filter):
    itemOnGround = Items.ApplyFilter( filter )
    if Items.BackpackCount( item , hue ) > 0:
        itemInPack = Items.FindByID( item , hue , Player.Backpack.Serial )
        if not itemOnGround:
            Items.DropItemGroundSelf( itemInPack , 0 )
        else:
            itemStack = itemOnGround[ 0 ]
            Items.Move( itemInPack , itemStack , 0 )
    Misc.Pause( dragTime )
    
def hide():
    if Player.GetRealSkillValue('Hiding') > 50:
        if Timer.Check('hideskill' + Player.Name) == False and not Player.BuffsExist('Hiding'):
            if Journal.SearchByType('You can\'t seem to hide right now.' , 'System' ):
                Player.ChatSay( 22 , 'Forward' )
                Misc.Pause(10000)
            Player.UseSkill('Hiding')
            Timer.Create('hideskill' + Player.Name,11000)
            

# Start Fishing

UseFishing()
<file_sep># Dragon Armor Crafter by MatsaMilla
# ToolTips must be enabled and must have a beetle
# updated 5/27/22 - fixed tossing exceptional stuffs
####################################################

scaleColor = 'blue' #pick color of scales, red, yellow, black, green, white, blue or blue2

fillBags = True # if true: Fill a bag with as many 
                # bags as you want to fill with armor sets.
                # Make sure bag is on beetle, lot of weight.

beetle = 0x00215F22
beetlePack = 0x434C292B # beetle container ID (inspect object in beetle pack for container ID

#####################################################
from System.Collections.Generic import List
import sys

noColor = 0x0000
self_pack = Player.Backpack.Serial
self = Player.Serial
dragTime = 600
gmCheckDelay = 200
craftTime = 1000
gumpTimeout = 4000

dragonLegs = 0x2647
dragonTunic = 0x2641
dragonSleeves = 0x2657
dragonGloves = 0x2643
dragonHelm = 0x2645
dragonGorget = 0x2B69
dragonSuit = [(44,0x2643),(51,0x2B69),(58,0x2645),(65,0x2647),(72,0x2657),(79,0x2641)]

dragonScales = 0x26B4

smithHammer = 0x13E3

if scaleColor == 'red':
    scaleColorGumpAction = 6
elif scaleColor == 'yellow':
    scaleColorGumpAction = 13
elif scaleColor == 'black':
    scaleColorGumpAction = 20
elif scaleColor == 'green':
    scaleColorGumpAction = 27
elif scaleColor == 'white':
    scaleColorGumpAction = 34
elif scaleColor == 'blue':
    scaleColorGumpAction = 41
elif scaleColor == 'blue2':
    scaleColorGumpAction = 48

player_bag = Items.FindBySerial(Player.Backpack.Serial)


if fillBags:
    baseBag = Target.PromptTarget('Target bag with bags to fill')

bags = [ 0xe76, 0xe75 , 0xe74 , 0xe78 , 0xe77 , 0x0E79 ]

# Use neraby trashcan
trashBarrelFilter = Items.Filter()
trashBarrelFilter.OnGround = 1
trashBarrelFilter.Movable = False
trashBarrelFilter.RangeMin = 0
trashBarrelFilter.RangeMax = 2
trashBarrelFilter.Graphics = List[int]( [ 0x0E77 ] )
trashBarrelFilter.Hues = List[int]( [ 0x03B2 ] )
trashcanhere = Items.ApplyFilter( trashBarrelFilter )

if not trashcanhere:
    Player.HeadMessage( 1100, 'No trashcan nearby!' )
    sys.exit()
else:
    global trashcan
    trashcan = trashcanhere[ 0 ]
    
if Player.GetRealSkillValue('Tinkering') < 80:
    craftOwnTools = False
else:
    craftOwnTools = True
def restockScales():
    if Items.BackpackCount(dragonScales,-1) < 50:
        if Player.Mount:
            Mobiles.UseMobile(Player.Serial)
            Misc.WaitForContext(beetle, 1500)
            if Player.Visible:
                Misc.ContextReply(beetle, 10)
            else:
                Misc.ContextReply(beetle, 0)
            Misc.Pause(dragTime)
        beetleScales = Items.FindByID( dragonScales , -1  , beetlePack, True )
        if beetleScales:
            Items.Move( beetleScales , self_pack , 300 )
            Misc.Pause(dragTime)
        else:
            Misc.SendMessage('Out of scales',33)
            sys.exit()
        
def craftTools():
    if craftOwnTools:
        currentTink = Items.FindByID(0x1EB8, -1, Player.Backpack.Serial, True )
        
        if Items.BackpackCount(0x1BF2, noColor) < 10:
            Misc.SendMessage('Out of Ignots',33)
            sys.exit()
        
        if Items.BackpackCount(0x1EB8, noColor) < 2:
            Items.UseItem(currentTink.Serial)
            Gumps.WaitForGump(949095101, 1500)
            Gumps.SendAction(949095101, 8)
            Gumps.WaitForGump(949095101, 1500)
            Gumps.SendAction(949095101, 23)

        if Items.BackpackCount( smithHammer, noColor) < 1: 
            Items.UseItem(currentTink.Serial)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 8)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 93)
    
def craftDragArmor(bag):
    Items.UseItem(bag)
    Misc.Pause(dragTime)
    for i in dragonSuit:
        while True:
            restockScales()
            craftTools()
            hammer = Items.FindByID(smithHammer,-1,Player.Backpack.Serial,True)
            if Items.FindByID( i[1] , -1 , bag.Serial ):
                break
            if hammer:
                if Gumps.CurrentGump() != 949095101:
                    Items.UseItem(hammer)
                Gumps.WaitForGump(949095101, gumpTimeout)
                Gumps.SendAction(949095101, 22) #Platemail Menu
                Gumps.WaitForGump(949095101, gumpTimeout)
                Gumps.SendAction(949095101, i[0])
                Gumps.WaitForGump(949095101, gumpTimeout)
                Misc.Pause(gmCheckDelay)
                craftedArmor = Items.FindByID(i[1],-1,Player.Backpack.Serial)
                if craftedArmor:
                    Items.WaitForProps(craftedArmor,500)
                    if 'exceptional' in Items.GetPropStringByIndex(craftedArmor,0):
                        moveToBag(craftedArmor,bag)
                        break
                    else:
                        trashItem(craftedArmor)
            else:
                Player.HeadMessage(33,'No Smith Hammers!')
                sys.exit()
        
def trashItem(item):
    Items.Move(item, trashcan, 0)
    Misc.Pause(dragTime)
        
def moveToBag(item,container):
    if Player.Mount:
        Mobiles.UseMobile(Player.Serial)
        Misc.WaitForContext(beetle, 1500)
        if Player.Visible:
            Misc.ContextReply(beetle, 10)
        else:
            Misc.ContextReply(beetle, 0)
        Misc.Pause(dragTime)
    Items.Move(item, container, 0)
    Misc.Pause(dragTime)
        
def setColor():
    Items.UseItemByID(smithHammer,-1)
    Gumps.WaitForGump(949095101, gumpTimeout)
    Gumps.SendAction(949095101, 56)
    Gumps.WaitForGump(949095101, gumpTimeout)
    Gumps.SendAction(949095101, scaleColorGumpAction)
    Misc.Pause(dragTime)
        
Journal.Clear()
setColor()
fillBag = Items.FindBySerial(baseBag)
Items.UseItem(fillBag)
Misc.Pause(dragTime)

for b in fillBag.Contains:
    currentBag = Items.FindBySerial(b.Serial)
    if currentBag.IsContainer:
        craftDragArmor(currentBag)
if not Player.Mount:
    Mobiles.UseMobile(beetle)
            
Misc.SendMessage('All Done Crafting Dragon Armor')
        

        
<file_sep>################## Constants #################

tongs = 0x0FBB
sewingkit=0x0F9D
regs = [0x0F7A, 0x0F86, 0x0F7B, 0x0F8C, 0x0F84, 0x0F85, 0x0F8D, 0x0F88]
rune = [6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96] #only works with gate
book = [0,1,2,3,4,5,6]
deedstorag= 0x4079777D
deedstosort = 0x41B89F04
deedmodel = 0x14EF
deedcolor = 0x044e
garbagecontainer =0x403C2A3E
smithgarbotxt = 'smithgarbo'


invasion = False

invasion2 = False



##################Variables #################

smithbodbag = 0x41B89F04 #commpdity deed box at home to dump shit in
tailorbodbag = 0x40349B3A #commodity deed box to dump shit.

botname = Player.Name
pname = Player.Name.lower().replace(' ', '')
if pname == 'knightbot':   #1
    glow = False
    NPC = 0x00198AD9
    if glow == True:
        tailornpc =  0x0002B253      
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD
    book[0] = 0x434717C5

elif pname == 'fisheye': #2
    book[0] = 0x423D325C
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD
        
elif pname == 'crystalmetheny': #3
    book[0] = 0x423D3CC0
    glow = False
    NPC = 0x00198AD9
    if glow == True: 
        tailornpc =  0x0002B253        
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
        
elif pname == 'louzar': #4
    book[0] = 0x423D4195
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD    

elif pname == 'wendywacko': #5
    book[0] = 0x423D4783
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
        
elif pname == 'terrybull': #6
    book[0] = 0x423D2CF6
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'aimbotexe': #7
    book[0] = 0x43466393
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x000610FA       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'ctrlaltdel': #8
    book[0] = 0x423D3136
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x000610FA       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  

elif pname == 'kitkatkattle': #9
    book[0] = 0x423D25EC
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD

elif pname == 'bodybuilder': #10
    book[0] = 0x423D2FE5
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD

elif pname == 'bodgod': #11
    book[0] = 0x423D358F
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD    

elif pname == 'rambod':   #12
    book[0] = 0x423D2EE9
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'wyrmtwig': #13
    book[0] = 0x423D4A9B
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'saltsniffer': #14
    book[0] = 0x423D40A6
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'nightbod': #15
    book[0] = 0x423D3D78
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  
elif pname == 'blackfox': #16
    book[0] = 0x423D3679
    glow = False
    NPC = 0x00198AD9
    if glow == True:  
        tailornpc =  0x0002B253       
        tailorrune = 3
    else:
        tailorrune = 6
        tailornpc = 0x00008CCD  



        
def worldSave():
    if Journal.SearchByType('The world will save in 1 minute.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(500)
        Misc.Pause(2500)
        Misc.SendMessage('Continuing run', 33)
        Journal.Clear()       
    
def webhook(msg):
    URI = 'https://discordapp.com/api/webhooks/<KEY>'
    alert = msg
    report = "content="+ alert
    PARAMETERS=report
    from System.Net import WebRequest
    request = WebRequest.Create(URI)
    request.ContentType = "application/x-www-form-urlencoded"
    request.Method = "POST"
    from System.Text import Encoding
    bytes = Encoding.ASCII.GetBytes(PARAMETERS)
    request.ContentLength = bytes.Length
    reqStream = request.GetRequestStream()
    reqStream.Write(bytes, 0, bytes.Length)
    reqStream.Close()
    response = request.GetResponse()
    from System.IO import StreamReader
    result = StreamReader(response.GetResponseStream()).ReadToEnd().replace('\r', '\n')        
    
def recall(book, rune):
    mana(30)
    worldSave()
    caststr()
    rune = 5+6*rune
    currentlocation = Player.Position
    Misc.Pause( 750 )
    Items.UseItem(book)
    Misc.Pause( 500 )
    Gumps.WaitForGump( 1431013363, 5000 )
    Misc.Pause( 500 )
    Gumps.SendAction( 1431013363, rune )       
    Misc.Pause( 500 )
    Misc.Pause(1500)
        
def mana(mana_req):
    if Player.Mana < mana_req:
        Player.UseSkill( 'Meditation' )
        while Player.Mana < ( Player.ManaMax ):
            Misc.Pause( 50 )
def castincog():
    if Player.BuffsExist('Incognito'):
        Player.HeadMessage(54,'incog already on')
    else:
        Spells.CastMagery( 'Incognito' )
        Misc.Pause(1500)
        
def gohome():
    if str(Player.Position) == '(6215, 3410, 35)':
        webhook('home already')
        return  
    recall(book[0],0)
    Misc.Pause(500)
    Player.Walk("North")
    Player.Walk("North")
    Player.Walk("North")

    Misc.Pause(2000)
    if str(Player.Position) != '(6215, 3410, 35)':
        webhook("failed to go home")    
        gohome()        
    else:
        webhook("I am at home")        
        
def caststr():
    if Player.Weight > 375 and not Player.BuffsExist( 'Strength' ):
            Spells.CastMagery( 'Strength' )
            Target.WaitForTarget( 10000, False )
            Target.Self()
            Misc.Pause( 1000 ) 

       
def comparetolist(bod, input):
    filepath = 'C:/Users/Jason/PycharmProjects/BodBot/' + input + ".txt"
    f = open(filepath, 'r')        
    allinlist = f.readlines()
    f.close()
  
    #Player.HeadMessage(54, str(len(allinlist)))
    for i in range(0, len(allinlist)):
        #Player.HeadMessage(54, str(allinlist[i]))
        #Player.HeadMessage(54, str(getstringofbod(0x44D90146)))
        if getstringofbod(bod) == allinlist[i]:
            Player.HeadMessage(54, "Match found from list")
            return True
        else:
            Misc.Pause(5)
    return False
                    
def getstringofbod(bod):
        result= ""
        bodList = Items.GetPropStringList(bod)
        for i in range(0, len(bodList)):
            result = result + bodList[i]
            
        result = result.replace("[","")
        result = result.replace("]","")
        result = result.replace(" deedBlessed<BASEFONT COLOR=#585868> Hue: 1102 <BASEFONT COLOR=#FFFFFF>Weight: 1 stone","")
        result = result.replace("bulk orderAll items must be","")
        result = result.replace(".All items must be made with","")
        result = result.replace(".amount to make:","")
        result = result.replace("a bulk order","")
        
        result = result + '\n'
        return result
        
  
def checkgarbo(bod):
    if comparetolist(bod, smithgarbotxt ):
        Player.HeadMessage(54, "Sending to garbage")
        Items.Move(bod, garbagecontainer, 0)
        return True
    else:
        return False       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
            
def regcount():
    webhook('Pearl: ' + str(Items.BackpackCount(0x0F7A,0)) +'/Root: ' + str(Items.BackpackCount(0x0F86,0)) + '/Moss: ' + str(Items.BackpackCount(0x0F7B,0)) + '/Sulf: ' + str(Items.BackpackCount(0x0F8C,0)) + '/Gar: ' + str(Items.BackpackCount(0x0F84,0)) + '/Gin: ' + str(Items.BackpackCount(0x0F85
    ,0))+'/Silk: ' + str(Items.BackpackCount(0x0F8D,0)) + '/Shade: ' + str(Items.BackpackCount(0x0F88,0))            )
     
def checkregs():
    #if Items.BackpackCount(0x0F7A,0) <50 or Items.BackpackCount(0x0F86,0) <50 or Items.BackpackCount(0x0F7B,0) < 50 orItems.BackpackCount(0x0F8C,0) < 50 or Items.BackpackCount(0x0F84,0) <50 or Items.BackpackCount(0x0F85,0)<50 or Items.BackpackCount(0x0F8D,0) <50 orItems.BackpackCount(0x0F88,0):
     for reg in regs:
         if Items.BackpackCount(reg,0)<50:
            restock() 

def restock():
    webhook('Need Regs')
    recall(book[0], 1) 
    Misc.Pause(1500)
    Mobiles.UseMobile(0x000E0470)
    Misc.Pause(1000)
    Gumps.WaitForGump(989312372, 10000)
    Gumps.SendAction(989312372, 4)
    Gumps.WaitForGump(989312372, 10000)
    Gumps.SendAction(989312372, 8)
    Misc.Pause(1000)
    regcount()
    Misc.Pause(1000) 
 
def smithbodready():
    Journal.Clear()
    Misc.Pause(1000)
    Misc.WaitForContext(0x000BB73D, 10000)
    Misc.ContextReply(0x000BB73D, 1)
    Misc.Pause(1000)
    if Journal.Search("can get"):
        Player.HeadMessage(54, "can get an order") 
        Misc.Pause(1000)
        return True
    else:
        webhook(botname + ' ended up at smith bod before its read')
        return False


def invasionsmithbods():
    Misc.Pause(1000)
    abortcounter = 0
    webhook('Getting smith Bod')   
    Items.UseItem(0x4083A7E1)
    Misc.Pause(1000)
    Spells.CastMagery("Recall")
    Target.WaitForTarget(10000, False)
    Misc.Pause(600)
    Target.TargetExecute(0x459A5682)
    Misc.Pause(15000)
    Misc.Pause(2000)
    Misc.Resync()
    Player.Walk("North")
    #Player.Walk("North")
    #Misc.Resync()
    #Journal.Clear()
    Misc.Pause(3000)
    Misc.WaitForContext(0x00029397, 10000)
    Misc.Pause(1000)
    Misc.ContextReply(0x00029397, 1)
    Misc.Pause(1000)
    if Journal.Search("can get"):
        Player.HeadMessage(54, "can get an order") 
        Misc.Pause(1000)
        smithrdy = True
    else:
        webhook(botname + ' ended up at smith bod before its read')
        smithrdy = False
    
    
    if smithrdy:
        while not Gumps.HasGump():
            abordcounter = abortcounter +1
            if abortcounter > 25:
                gohome()
            if Items.FindByID(tongs, -1, Player.Backpack.Serial):
                Misc.WaitForContext(0x00029397, 10000) #sell 
                Misc.ContextReply(0x00029397, 3)
            else:
                Misc.WaitForContext(0x00029397, 10000)
                Misc.ContextReply(0x00029397, 2)
                Misc.Pause(1000)
        while Items.FindByID(tongs, -1, Player.Backpack.Serial):
            Misc.WaitForContext(0x00029397, 10000) #sell 
            Misc.ContextReply(0x00029397, 3)
                
        Gumps.WaitForGump(3188567326, 2000)
        Gumps.SendAction(3188567326, 1)
        Gumps.WaitForGump(2611865322, 2000)
        Gumps.SendAction(2611865322, 1)        
        
def invasionsmithbods2():
    Misc.Pause(1000)
    abortcounter = 0
    webhook('Getting smith Bod')   
    Items.UseItem(0x4083A7E1)
    Misc.Pause(1000)
    Spells.CastMagery("Recall")
    Target.WaitForTarget(10000, False)
    Misc.Pause(600)
    Target.TargetExecute(0x419BD34E)
    Misc.Pause(15000)


    Misc.WaitForContext(0x000013B7, 10000)
    Misc.Pause(1000)
    Misc.ContextReply(0x000013B7, 1)
    Misc.Pause(1000)
    if Journal.Search("can get"):
        Player.HeadMessage(54, "can get an order") 
        Misc.Pause(1000)
        smithrdy = True
    else:
        webhook(botname + ' ended up at smith bod before its read')
        smithrdy = False
    
    
    if smithrdy:
        while not Gumps.HasGump():
            abordcounter = abortcounter +1
            if abortcounter > 25:
                gohome()
            if Items.FindByID(tongs, -1, Player.Backpack.Serial):
                Misc.WaitForContext(0x000013B7, 10000) #sell 
                Misc.ContextReply(0x000013B7, 3)
            else:
                Misc.WaitForContext(0x000013B7, 10000)
                Misc.ContextReply(0x000013B7, 2)
                Misc.Pause(1000)
        while Items.FindByID(tongs, -1, Player.Backpack.Serial):
            Misc.WaitForContext(0x000013B7, 10000) #sell 
            Misc.ContextReply(0x000013B7, 3)
                
        Gumps.WaitForGump(3188567326, 2000)
        Gumps.SendAction(3188567326, 1)
        Gumps.WaitForGump(2611865322, 2000)
        Gumps.SendAction(2611865322, 1)                 
def smithbods():
    abortcounter = 0
    webhook('Getting smith Bod')   
    recall(book[0],2)
    if smithbodready():
        while not Gumps.HasGump():
            abordcounter = abortcounter +1
            if abortcounter > 25:
                gohome()
            if Items.FindByID(tongs, -1, Player.Backpack.Serial):
                Misc.WaitForContext(0x000BB73D, 10000) #sell 
                Misc.ContextReply(0x000BB73D, 3)
            else:
                Misc.WaitForContext(0x000BB73D, 10000)
                Misc.ContextReply(0x000BB73D, 2)
                Misc.Pause(1000)
        while Items.FindByID(tongs, -1, Player.Backpack.Serial):
            Misc.WaitForContext(0x000BB73D, 10000) #sell 
            Misc.ContextReply(0x000BB73D, 3)
                
        Gumps.WaitForGump(3188567326, 2000)
        Gumps.SendAction(3188567326, 1)
        Gumps.WaitForGump(2611865322, 2000)
        Gumps.SendAction(2611865322, 1)

def tailorbodready():
    Journal.Clear()
    Misc.Pause(500)
    Misc.WaitForContext(tailornpc, 10000)
    Misc.ContextReply(tailornpc, 1)
    Misc.Pause(1000)
    if Journal.Search("can get"):
        Player.HeadMessage(54, "can get an order") 
        Misc.Pause(1000)
        return True
    else:
        webhook(botname + ' ended up at tailor bod before its read')
        return False   

def tailorbods():
    webhook('Getting Tailor Bod')
    abortcounter = 0
    recall(book[0],tailorrune)   
    
    if tailorbodready():
        while not Gumps.HasGump():
            abordcounter = abortcounter + 1
            if abortcounter > 25:
                gohome()
            if Items.FindByID(sewingkit, -1, Player.Backpack.Serial):
                Misc.WaitForContext(tailornpc, 10000)
                Misc.ContextReply(tailornpc, 3)
                Misc.Pause(750)
            else:
                Misc.WaitForContext(tailornpc, 10000)
                Misc.ContextReply(tailornpc, 2)
                Misc.Pause(1000)
        while Items.FindByID(sewingkit, -1, Player.Backpack.Serial):
            Misc.WaitForContext(tailornpc, 10000)
            Misc.ContextReply(tailornpc, 3)
            Misc.Pause(100)   
        
        Gumps.WaitForGump(3188567326, 2000)
        Gumps.SendAction(3188567326, 1)
        Gumps.WaitForGump(2611865322, 2000)
        Gumps.SendAction(2611865322, 1)
        Misc.Pause(2000)


def discordbod(bod):
        result = ''
        bodList = Items.GetPropStringList(bod)
        for i in range(0, len(bodList)):
            #if i > (z -1):
                result = result + bodList[i]

        result = result.replace("bulk orderAll items must be",'')
        result = result.replace('.amount to make','')
        result = result.replace(': 0','')
        result = result.replace('.All items must be made with','')
        result = result.replace('<BASEFONT COLOR=#204018>Hue: Rusty Green (1155)<BASEFONT COLOR=#FFFFFF>Weight: 1','')
        result = result.replace('a bulk order deedBlessed stonelarge','')
        result = result.replace('a bulk order deedBlessed<BASEFONT COLOR=#606070> Hue: 1102 <BASEFONT COLOR=#FFFFFF>Weight: 1 stonesmall ','')
        result = result.replace('a bulk order deedBlessed<BASEFONT COLOR=#606070> Hue: 1102 <BASEFONT COLOR=#FFFFFF>Weight: 1 stonelarge','')
        result = result.replace('a bulk order deedBlessed stonesmall ','')
        
        webhook(result)
   
    
def unload():    
    gohome()
    Misc.Pause(1000)

    while Items.FindByID(0x14EF, 0x0483, Player.Backpack.Serial): #tailor bods
        currenttarget = Items.FindByID(0x14EF, 0x0483, Player.Backpack.Serial)
        Items.Move(currenttarget, tailorbodbag, -1) 
        Misc.Pause(1000)   
    while Items.FindByID(0x14EF, 0x044E, Player.Backpack.Serial): #smith bods
        currenttarget = Items.FindByID(0x14EF, 0x044E, Player.Backpack.Serial)
        if checkgarbo(currenttarget):
            Player.HeadMessage(54, "garbage")
            Misc.Pause(500)
        else:
            Items.Move(currenttarget, smithbodbag, 0)
        Misc.Pause(1000)           
 
def writetime(text):
    f = open('C:/Users/Jason/PycharmProjects/BodBot/MastBodStatus.txt', 'w')        
    f.write(str(text))
    f.close()
    
def readtime(file):
    f = open('C:/Users/Jason/PycharmProjects/BodBot/MastBodStatus.txt', 'r')
    x = f.read()
    return x    
    
    
    
    
    
restock()

Misc.Pause(3000)   
if BuyAgent.Status( ) == False:
    Player.HeadMessage(54, "Starting buy agent")
    BuyAgent.Enable()
Misc.Pause(500)
if SellAgent.Status( ) == False:
    Player.HeadMessage(54, "Starting sell agent")
    SellAgent.Enable()
    Misc.Pause(1000)

writetime('start')

temp = botname + " is getting bods"
webhook(temp)    
checkregs()
if invasion:
    invasionsmithbods()
elif invasion2:
    invasionsmithbods2()
else:
    smithbods()
tailorbods()
Misc.Pause(2000)
unload()
Misc.Pause(2000)
writetime('done')


<file_sep>
# Wep crafter by MatsaMilla; Last edit: Matsamilla 5/27/22 - fixed tossing exceptionals
#
# Only have 1 type of wood on you at a time, it adjusts wood type automagically
#
# will restock same wood type from beetle
#
# crafts weps for fletching and carpentry, wep list below (comment out ones not crafting)
#
# Moves good weps to beetle *must be exceptional, trashes all non exceptional

################## SETUP SECTION ####################################

# Will automatically ID items if toon has ItemID skill
useIDWands = True # true to use ID wands to ID magic items as
                  # you craft, otherwise move all to beetle
                  # Wands must be in backpack, not in bag in pack

# update with your beetles serial to move good weps to
beetle = 0x00215F22

#inspect an item in the bag of your beetle, copy root container serial here. used to restock wood
beetleContainer = 0x434C292B

# turn to true if client has tool tips enabled, more reliable
toolTipsOn = True

# Set wep choice below (comment out others)

weapToCraft = 'comp'
#weapToCraft = 'bow'
#weapToCraft = 'xbow'
#weapToCraft = 'qstaff'
#weapToCraft = 'club'

################ Items to keep Setup Section #########################

# Anything in this list will be moved to beetle
keepProps = ['Vanquishing','Power']

# slayer props, take out the ones you dont want to keep, if you want. Will keep all slayers in list.
slayerProps = ['Silver','Elemental Ban','Undead','Dragon Slaying',
    'Reptilian Death','Terathan','Exorcism','Repond','Fey',
    'Orc Slaying','Ogre Trashing','Balron Damnation','Daemon Dismissal',
    'Water Dissipation','Earth Shatter','Arachnid', 'Blood Drinking']
# You can move slayers you do not want to keep down here, or just delete them. 
# Just make sure they have a # in front so the code will ignore them.
# 'Lizardman Slaughter','Scorpion\'s Bane','Vacuum','Gargoyle\'s Foe','Troll Slaughter','Flame Dousing','Summer Wind','Spider\'s Death','Elemental Health','Ophidian','Snake\'s Bane'

#Any item in this list will be kept if paired with a durability or accuracy mod, does not count if on other side of #
wepDmgMods = ['Vanquishing','Power', 'Force'] # 'Ruin','Might'

######################### Do not touch anything below here# #######################################
from System.Collections.Generic import List
#disregaurd list below
wepDurabilityMods = ['Indestructable', 'Fortified', 'Massive', 'Substantial', 'Durable']
wepAccuracyMods = ['Supremely Accurate','Exceedingly Accurate','Eminently Accurate', 'Surpassingly Accurate', 'Accurate']

#the order of these is the order of how wood will be used
woodHues = [ 1193 , 1194 , 1151 , 1192 , 1191 ,2010 ] # heartwood, bloodwood, frostwood, yew, ash, oak
 
dragTime = 600
fletchTool = 0x1022
saw = 0x1034
tink = 0x1EB8
wood = 0x1BD7
logs = 0x1BDD
ignot = 0x1BF2
comp = 0x26C2
xbow = 0x0F50
bow = 0x13B2
qstaff = 0x0E89
club = 0x13B4
noColor = 0x0000
self_pack = Player.Backpack.Serial
self = Player.Serial
rightHand = Player.CheckLayer('RightHand')
leftHand = Player.CheckLayer('LeftHand')
wands = [0xdf5,0xdf3,0xdf4,0xdf2]

# Will use ID Wand if skill Item ID below 75
if Player.GetRealSkillValue('Item ID') > 75:
    idItems = True
    useIDWands = False
elif useIDWands:
    idItems = True
else:
    idItems = False
    
# Use neraby trashcan
trashBarrelFilter = Items.Filter()
trashBarrelFilter.OnGround = 1
trashBarrelFilter.Movable = False
trashBarrelFilter.RangeMin = 0
trashBarrelFilter.RangeMax = 2
trashBarrelFilter.Graphics = List[int]( [ 0x0E77 ] )
trashBarrelFilter.Hues = List[int]( [ 0x03B2 ] )
trashcanhere = Items.ApplyFilter( trashBarrelFilter )

if trashcanhere:
    global trashcan
    for t in trashcanhere:
        trashcan = t
else:
    Misc.SendMessage('No trashcan nearby, stopping',33)
    Misc.Beep()
    Stop

# sets wep to craft
if weapToCraft == 'comp':
    wepType = 16
    craftWepID = comp
    carp = False
    fletch = True
    Player.HeadMessage(33, 'Crafting '+weapToCraft)
elif weapToCraft == 'xbow':
    wepType = 9
    craftWepID = xbow
    carp = False
    fletch = True
    Player.HeadMessage(33, 'Crafting '+weapToCraft)
elif weapToCraft == 'bow':
    wepType = 2
    craftWepID = bow
    carp = False
    fletch = True
elif weapToCraft == 'qstaff':
    wepType = 9
    craftWepID = qstaff
    carp = True
    fletch = False
elif weapToCraft == 'club':
    wepType = 30
    craftWepID = club
    carp = True
    fletch = False
    
def setWood():
    global woodHue
    worldSave()
    # check for tools    
    if Items.BackpackCount(fletchTool, noColor) < 1:
        craftTools()
    # sets wood type
    packWood = FindItem(wood, Player.Backpack)
    packLogs = FindItem(logs, Player.Backpack)
    if packWood:
        if packWood.Hue == 0:
            woodGumpAction = 6
            woodType = 'Regular Wood'
        elif packWood.Hue == 2010:
            woodType = 'oak'
            woodGumpAction = 13
        elif packWood.Hue == 1191:
            woodType = 'ash'
            woodGumpAction = 20
        elif packWood.Hue == 1192:
            woodType = 'yew'
            woodGumpAction = 27
        elif packWood.Hue == 1193:
            woodType = 'heartwood'
            woodGumpAction = 34
        elif packWood.Hue == 1194:
            woodType = 'bloodwood'
            woodGumpAction = 41
        elif packWood.Hue == 1151:
            woodType = 'frostwood'
            woodGumpAction = 48
        woodHue = packWood.Hue
    elif packLogs:
        if packLogs.Hue == 0:
            woodGumpAction = 6
            woodType = 'Regular Wood'
        elif packLogs.Hue == 2010:
            woodType = 'oak'
            woodGumpAction = 13
        elif packLogs.Hue == 1191:
            woodType = 'ash'
            woodGumpAction = 20
        elif packLogs.Hue == 1192:
            woodType = 'yew'
            woodGumpAction = 27
        elif packLogs.Hue == 1193:
            woodType = 'heartwood'
            woodGumpAction = 34
        elif packLogs.Hue == 1194:
            woodType = 'bloodwood'
            woodGumpAction = 41
        elif packLogs.Hue == 1151:
            woodType = 'frostwood'
            woodGumpAction = 48
        woodHue = packLogs.Hue
    else:
        Misc.SendMessage('NO WOOD, Stopping!', 33)
        Misc.Beep()
        Stop
    Misc.SendMessage('Crafting with ' + woodType, 33)
    if fletch:
        currentFletch =  FindItem( fletchTool , Player.Backpack )
        if currentFletch:
            if Gumps.CurrentGump() != 949095101:
                Items.UseItem(currentFletch)
                Misc.Pause(dragTime)
            Gumps.WaitForGump(949095101, 2000)
            Gumps.SendAction(949095101, 7)
            Gumps.WaitForGump(949095101, 2000)
            Gumps.SendAction(949095101, woodGumpAction)
            Gumps.WaitForGump(949095101, 2000)
            Misc.Pause(dragTime)
        else:
            craftTools()
    elif carp:
        currentSaw =  FindItem( saw , Player.Backpack )
        if currentSaw:
            Items.UseItem(currentSaw)
            Misc.Pause(120)
            Gumps.WaitForGump(949095101, 10000)
            Gumps.SendAction(949095101, 7)
            Gumps.WaitForGump(949095101, 10000)
            Gumps.SendAction(949095101, woodGumpAction)
            Misc.Pause(dragTime)
        else:
            craftTools()
        
def moveToBeetle(item):
    if Player.Mount:
        Mobiles.UseMobile(self)
        Misc.Pause(dragTime)
    Items.Move(item, beetle, 1)
    Misc.Pause(dragTime)
    Mobiles.UseMobile(beetle)
    Misc.Pause(dragTime)
    
def restockWood( color ):
    global restocked
    if Player.Mount:
        Mobiles.UseMobile(self)
        Misc.Pause(dragTime)
        Mobiles.SingleClick(beetle)
        Misc.WaitForContext(beetle, 1500)
        if Player.Visible:
            Misc.ContextReply(beetle, 10)
        else:
            Misc.ContextReply(beetle, 0)
        Misc.Pause(dragTime)
        beetleLogs = Items.FindByID(logs, color, beetleContainer)
        beetleWood = Items.FindByID(wood, color, beetleContainer)
        if beetleLogs:
            Player.HeadMessage (66, 'Restocking')
            Items.Move(beetleLogs, self_pack, 1000)
            Misc.Pause(dragTime)
            restocked = True
        elif beetleWood:
            Player.HeadMessage (66, 'Restocking')
            Items.Move(beetleWood, self_pack, 1000)
            Misc.Pause(dragTime)
            restocked = True
        else:
            restocked = False
    
    if not Player.Mount:
        Mobiles.UseMobile(beetle)
        Misc.Pause(dragTime)

        
def trashItem(item):
    if trashcan:
        Items.Move(item, trashcan.Serial, 1)
        Misc.Pause(dragTime)
    else:
        Misc.SendMessage('No trashcan nearby, stopping',33)
        Misc.Beep()
        Stop
    
# Checks to see if you have enough materials, stopps if not.
def checkMats():
    worldSave()
    if fletch:
        # check for tools 
        if Items.BackpackCount(fletchTool, noColor) < 1:
            craftTools()
        # check for wood
        if weapToCraft == 'comp':
            if Items.BackpackCount(wood, -1) < 12 and Items.BackpackCount(logs, -1) < 12:
                restockWood( woodHue )
                if Items.BackpackCount(wood, -1) < 12 and Items.BackpackCount(logs, -1) < 12:
                    Misc.SendMessage('Out of Wood',33)
                    Gumps.CloseGump(949095101)
                    Stop
        else:
            if Items.BackpackCount(wood, -1) < 7 and Items.BackpackCount(logs, -1) < 7:
                restockWood (woodHue)
                if Items.BackpackCount(wood, -1) < 7 and Items.BackpackCount(logs, -1) < 7:
                    Misc.SendMessage('Out of Wood',33)
                    Gumps.CloseGump(949095101)
                    Stop
        
    elif carp:
        # check for tools 
        if Items.BackpackCount(saw, noColor) < 1:
            craftTools()
        # check for wood
        if Items.BackpackCount(wood, -1) < 6 and Items.BackpackCount(logs, -1) < 7:
                restockWood (woodHue)
                if Items.BackpackCount(wood, -1) < 6 and Items.BackpackCount(logs, -1) < 7:
                    Misc.SendMessage('Out of Wood',33)
                    Gumps.CloseGump(949095101)
                    Misc.Beep()
                    Stop
            
def craftTools():
    worldSave()
    currentTink = FindItem( tink , Player.Backpack )
    # stops script if not enough ignots to craft tools
    packIgnots = FindItem (ignot , Player.Backpack)
    if packIgnots == None or packIgnots.Amount < 10:
        Misc.SendMessage('Need more ignots for tools', 33)
        Misc.Beep()
        Stop
    # crafts tinker set if you only have 1
    if Items.BackpackCount(tink, noColor) < 2:
        Items.UseItem(currentTink.Serial)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 8)
        Gumps.WaitForGump(949095101, 1500)
        Gumps.SendAction(949095101, 23)
        Gumps.WaitForGump(949095101, 2000)
        Gumps.CloseGump(949095101)
    if fletch:
        # crafts fletch
        if Items.BackpackCount(fletchTool, noColor) < 1:
            Items.UseItem(currentTink.Serial)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 8)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 142)
            Gumps.WaitForGump(949095101, 2000)
            Gumps.CloseGump(949095101)
            Misc.Pause(2000)
    elif carp:
        # crafts saw
        if Items.BackpackCount(saw, noColor) < 1:
            Items.UseItem(currentTink.Serial)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 8)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 51)
            Gumps.WaitForGump(949095101, 2000)
            Gumps.CloseGump(949095101)
            Misc.Pause(2000)

def craftWep():
    worldSave()
    trashcanhere = Items.ApplyFilter( trashBarrelFilter )

    if trashcanhere:
        global trashcan
        for t in trashcanhere:
            trashcan = t
    else:
        Misc.SendMessage('No trashcan nearby, stopping',33)
        Misc.Beep()
        Stop
    # makes sure you stay mounted
    if not Player.Mount:
        Mobiles.UseMobile(beetle)
        Misc.Pause(dragTime)
    if fletch:
        # find fletch tools in bag
        currentFletch = FindItem( fletchTool , Player.Backpack )
        if currentFletch:
            checkMats()
            Items.UseItem(currentFletch)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 15)
            Gumps.WaitForGump(949095101, 1500)
            Gumps.SendAction(949095101, wepType)
            Gumps.WaitForGump(949095101, 3000)
            Misc.Pause(dragTime)
    elif carp:
        # find saw in bag, uses & crafts qstaff
        currentSaw = FindItem( saw , Player.Backpack )
        if currentSaw:
            Items.UseItem(currentSaw)
            Gumps.WaitForGump(949095101,1500)
            Gumps.SendAction(949095101, 22)
            Gumps.WaitForGump(949095101, 1500)
            Gumps.SendAction(949095101, wepType)
            Misc.Pause(2000)
        
    
# IDs items as you craft, if applicable
# otherwise moves to beetle    
def idItem(item):
    worldSave()
    Journal.Clear() 
    if idItems:
        idTarget()
        Target.WaitForTarget(1500)
        Target.TargetExecute(item)
        Items.SingleClick(item)
        Misc.Pause(dragTime)
        if Journal.Search('You are not certain'):
            idItem(item)
        if Journal.Search('Exceptional'):
            if any(Journal.Search(keep) for keep in keepProps):
                #** moves to beetle if has property in keepProps **
                moveToBeetle(item)
            elif any(Journal.Search(keep) for keep in slayerProps):
                #** moves slayers to beetle **
                moveToBeetle(item) 
            elif any(Journal.Search(slash) for slash in wepDmgMods):
                if any(Journal.Search(sub) for sub in wepAccuracyMods):
                    #** moves deedable weps to beetle **
                    moveToBeetle(item)
                if any(Journal.Search(sub) for sub in wepDurabilityMods):
                    #** Good Stuff Move **
                    moveToBeetle(item)
                else:
                    #** Trash **
                    trashItem(item)
            else:
                #** Trash **
                trashItem(item)
        else:
            #** Trash **
            trashItem(item)
    else:
        moveToBeetle(item)
        
def idItemToolTips(item):
    worldSave()
    if idItems:
        idTarget()
        Target.WaitForTarget(1500)
        Target.TargetExecute(item)
        Misc.Pause(dragTime)
        if Journal.Search('You are not certain'):
            idItem(item)
        Items.WaitForProps(item, 2000)
        props = Items.GetPropStringList(item)
        if 'exceptional' in Items.GetPropStringByIndex(item,0):
            if any(elim in keepProps for elim in props):
            #if any(Journal.Search(keep) for keep in keepProps):
                #** moves to beetle if has property in keepProps **
                moveToBeetle(item)
            elif any(elim in slayerProps for elim in props):
            #elif any(Journal.Search(keep) for keep in slayerProps):
                #** moves slayers to beetle **
                moveToBeetle(item)
            elif any(elim in wepDmgMods for elim in props):
            #elif any(Journal.Search(slash) for slash in wepDmgMods):
                if any(elim in wepAccuracyMods for elim in props):
                #if any(Journal.Search(sub) for sub in wepAccuracyMods):
                    #** moves deedable weps to beetle **
                    moveToBeetle(item)
                if any(elim in wepDurabilityMods for elim in props):
                #if any(Journal.Search(sub) for sub in wepDurabilityMods):
                    #** Good Stuff Move **
                    moveToBeetle(item)
                else:
                    #** Trash **
                    trashItem(item)
            else:
                #** Trash **
                trashItem(item)
        else:
            #** Trash **
            trashItem(item)
    else:
        moveToBeetle(item)

# equips a wand, hopefully ID wand
def equipWand():
    global wandSerial
    if Player.CheckLayer('LeftHand') :
        Player.UnEquipItemByLayer('LeftHand')
        Misc.Pause(600)
    if not Player.CheckLayer('RightHand'):
        for i in Player.Backpack.Contains:
            if i.ItemID in wands:
                Items.WaitForProps(i, 500)
                if Items.GetPropValue(i, "Identification"):
                    Player.EquipItem(i.Serial)
                    Misc.Pause(600)
                    wandSerial = Player.GetItemOnLayer('RightHand').Serial
                    break
                else:
                    Player.ChatSay(33, "No Wands Found, No longer IDing")
                    Stop
    elif Player.GetItemOnLayer('RightHand').ItemID in wands:
        wandSerial = Player.GetItemOnLayer('RightHand').Serial
    else:
        Player.ChatSay(33, "No Wands Found, No longer IDing")
        Stop
        

# brings up ItemID Target, with wand or skill    
def idTarget():
    worldSave()
    if useIDWands:
        equipWand()
        Items.UseItem(wandSerial)
        Misc.Pause(200)
    else:
        Player.UseSkill('Item ID')
        Misc.Pause(dragTime)
    if not Target.HasTarget():
        idTarget()

# checks pack for wep you are crafting
# checks journal for special item, slayer or magic
# if special, ids item
def wepCheck():
    worldSave()
    craftedItem = FindItem( craftWepID , Player.Backpack )
    if toolTipsOn:
        if Journal.SearchByType('You have successfully crafted a slayer', 'System'):
            idItemToolTips(craftedItem)
        elif Journal.SearchByType('Your material and skill have added magical properties to this weapon.', 'System'):
            idItemToolTips(craftedItem)
        else:
            trashItem(craftedItem)
    else:
        if Journal.SearchByType('You have successfully crafted a slayer', 'System'):
            idItem(craftedItem)
        elif Journal.SearchByType('Your material and skill have added magical properties to this weapon.', 'System'):
            idItem(craftedItem)
        else:
            trashItem(craftedItem)
    Journal.Clear()

# pauses during world save
def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'System' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'System'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()
        
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem

setWood()
#restockWood (woodHue)     
while True:
    Journal.Clear() 
    worldSave()
    checkMats()           
    craftWep()
    while Items.BackpackCount(craftWepID, -1) > 0:
        wepCheck()
<file_sep># disarm steal wep by MatsaMilla
# updated 4/2/2022
# have fun


Player.HeadMessage(66, "Select your Target")
disarmTarget = Mobiles.FindBySerial(Target.PromptTarget())

def stealCheck():
    Misc.Pause(120)
    if Journal.SearchByType( 'You fail to steal the item.' , 'Regular' ):
        Player.HeadMessage(33, 'FAILED')
    elif Journal.SearchByType( 'You successfully steal the item.' , 'Regular' ):
        Player.HeadMessage(66, 'Wep Stolen!')

if disarmTarget:
    rightHand = disarmTarget.GetItemOnLayer('RightHand')
    leftHand = disarmTarget.GetItemOnLayer('LeftHand')
    
    if rightHand:
        stealTarget = rightHand
    
    elif leftHand:
        stealTarget = leftHand
        
    else:
        Player.HeadMessage(66, "They are unarmed")
        stealTarget = None
        
    if stealTarget != None:
        
        Journal.Clear()
        Player.WeaponDisarmSA( )
        Misc.Pause(120)

        if Journal.SearchByType("You decide to not try to disarm anyone.",'System'):
            Player.WeaponDisarmSA( )

        while Player.DistanceTo(disarmTarget) > 1:
            Misc.Pause(10)

        Player.Attack(disarmTarget)
        if not Target.HasTarget():
            Player.UseSkill('Stealing')
        Target.WaitForTarget(1500)
        Target.TargetExecute(stealTarget)
            
        stealCheck()
    
else:
    Player.HeadMessage(66, "You didn't target a mobile")
        

        
<file_sep># Place blank scrolls in pack, have only how many you want to make (or can hold) on you.
# Target a container you want to transfer them into after it makes them.

# uncomment the type you would like to make
deedtype = 'smith'
#deedtype = 'tailor'
#deedtype = 'carp'
#deedtype = 'fletch'

hammerID = 0x13E3
tongID = 0x0FBB
scrollID = 0x0EF3
fletchID = 0x1022
sawID = 0x1034
backpack = Player.Backpack.Serial

def repairDeed(type):
    
    hammer = Items.FindByID(hammerID, -1, backpack)
    tong = Items.FindByID(tongID, -1, backpack)
    scrolls = Items.FindByID(scrollID,-1, backpack)
    sewKit = Items.FindByID(0x0F9D,-1, backpack) 
    fletch = Items.FindByID(fletchID,-1, backpack) 
    saw = Items.FindByID(sawID,-1, backpack) 
    scrolls = Items.FindByID(scrollID,-1, backpack)
    
    if type == 'smith':
        Misc.SendMessage('Crafting Smith Repair Deeds')
        if tong:
            tool = tong
        elif hammer:
            tool = hammer
        else:
            Misc.SendMessage('No Tools')
    elif type == 'tailor':
        Misc.SendMessage('Crafting Tailor Repair Deeds')
        if sewKit:
            tool = sewKit
        else:
            Misc.SendMessage('No Tools')
    elif type == 'carp':
        Misc.SendMessage('Crafting Carp Repair Deeds')
        if saw:
            tool = saw
        else:
            Misc.SendMessage('No Tools')
    elif type == 'fletch':
        Misc.SendMessage('Crafting Fletch Repair Deeds')
        if fletch:
            tool = fletch
        else:
            Misc.SendMessage('No Tools')

    
    while scrolls:
        if not Gumps.HasGump():      
            Items.UseItem(tool)
        Gumps.WaitForGump(949095101, 50)
        Gumps.SendAction(949095101, 42)
        Target.WaitForTarget(1000, False)
        Target.TargetExecute(scrolls)
        Misc.Pause(100)
        scrolls = Items.FindByID(scrollID,-1, backpack)


def moveScrolls():
    if Target.HasTarget():
        Target.Cancel()
        
    repairDeeds = Items.FindByID(0x14F0, 0x01bc, backpack)
    if repairDeeds:
        Player.HeadMessage(66, 'Target Container to Move deeds to')
        deedContainer = Target.PromptTarget()
        while repairDeeds:
            Items.Move(repairDeeds,deedContainer,0)
            Misc.Pause(600)
            repairDeeds = Items.FindByID(0x14F0, 0x01bc, backpack)
            
    
repairDeed(deedtype)
moveScrolls()
<file_sep>while Player.IsGhost == False:
    Player.UseSkill("Hiding")
    Misc.Pause(10000)
<file_sep># This script relys on Bandage_Timer.py, if you do not have it, it will not work
# Bandages any guilded pet if within 1 tile
from System.Collections.Generic import List
from System import Byte
import sys

def find(notoriety):
    fil = Mobiles.Filter()
    fil.Enabled = True
    fil.RangeMax = 1.5
    fil.IsHuman = False
    fil.IsGhost = False
    fil.Notorieties = List[Byte](bytes([notoriety]))
    list = Mobiles.ApplyFilter(fil)

    return list
    
# quits if you have less than 80 HP
if Player.GetRealSkillValue('Veterinary') < 80:
    Misc.SendMessage('Not enough vet skill, stopping',33)
    sys.exit()
    
healing = None
broodlings = [ 0x02D9,0x0014 ]
while True:
    petList = find(2)
    init = 0
    plist = []
    for i in petList:
        healPet = Mobiles.FindBySerial(i.Serial)
        if healPet:
            if healPet.Hits != int(0) and Player.InRangeMobile(healPet, int(1.5)) and healPet.Body not in broodlings:
                plist.append(healPet.Serial)
    for j in plist:
        if init == 0:
            healing = Mobiles.FindBySerial(j)
            init = 1
        healPet = Mobiles.FindBySerial(j)
        if healPet:
            if healPet.Hits <= healing.Hits or healPet.Poisoned:
                healing = Mobiles.FindBySerial(healPet.Serial)
    if healing:
        pet2Heal = Mobiles.FindBySerial(healing.Serial)
        if pet2Heal:
            if (pet2Heal.Hits < int(23) or pet2Heal.Poisoned) and Player.InRangeMobile(pet2Heal, int(1.5)):
                if Misc.ReadSharedValue('bandageDone') == True and Player.Visible:
                    if Target.HasTarget( ) == False:
                        Misc.SendMessage("Healing " + pet2Heal.Name, 33)  
                        Items.UseItemByID(0x0E21, -1)
                        Target.WaitForTarget(1500)
                        Target.TargetExecute(pet2Heal)
                        Misc.Pause(600)
    
    Misc.Pause(10)
<file_sep>'''
Author: Aga - original author of the uosteam script
Other Contributors: TheWarDoctor95 - converted to Razor Enhanced script
                    MatsaMilla - Converted to be all-in-1 script
Last Contribution By: MatsaMilla - 8-28-21
Description: Tames nearby animals to train Animal Taming to GM
'''

########## Script options ###############
Misc.ClearIgnore()

# True to kill tame, false to not
killTame = False
# Change to the name that you want to rename the tamed animals to
if killTame:
    renameTamedAnimalsTo = 'kill me'
    killList = []
else:
    renameTamedAnimalsTo = 'Thanks Matsa'
    
# Change to the number of followers you would like to keep.
# The script will auto-release the most recently tamed animal if the follower number exceeds this number
# Some animals have a follower count greater than one, which may cause them to be released if this number is not set high enough
numberOfFollowersToKeep = 0

# Set to the maximum number of times to attempt to tame a single animal. 0 == attempt until tamed
maximumTameAttempts = 10

# Set the minimum taming difficulty to use when finding animals to tame
minimumTamingDifficulty = 31

# Set this to how you would like to heal your character if they take damage
# Options are:
# 'Healing' = use bandages (you should just use my Bandage_Self.py instead)
# 'Magery' = uses the Heal and Greater Heal ability depending on how much health is missing
# 'None' = do not auto-heal
healUsing = 'None'

# True or False to use Peacemaking if needed
enablePeacemaking = False

# True or False to track the animal being tamed
enableFollowAnimal = True

# Change depending on the latency to your UO shard
journalEntryDelayMilliseconds = 100
targetClearDelayMilliseconds = 100

################ END SETUP SECTION ######################
import sys

if not Misc.CurrentScriptDirectory() in sys.path:
    sys.path.append(Misc.CurrentScriptDirectory())

from System.Collections.Generic import List
from System import Byte
import math

noAnimalsToTrainTimerMilliseconds = 10000
playerStuckTimerMilliseconds = 5000
catchUpToAnimalTimerMilliseconds = 20000
animalTamingTimerMilliseconds = 12500
peacemakingTimerMilliseconds = 5000
bandageTimerMilliseconds = 10000

if Player.GetRealSkillValue('Animal Taming') < 35:
    Misc.SendMessage('Buy Taming Skill Up, stopping', 33)
    sys.exit()
    
from System.Collections.Generic import List

class Animal:
    name = ''
    mobileID = 0
    color = 0
    minTamingSkill = -1
    maxTamingSkill = -1
    packType = None

    def __init__ ( self, name, mobileID, color, minTamingSkill, maxTamingSkill, packType ):
        self.name = name
        self.mobileID = mobileID
        self.color = color
        self.minTamingSkill = minTamingSkill
        self.maxTamingSkill = maxTamingSkill

animals = {
    # Organized based on taming difficulty with no previous owners according to uo.com, then alphabetically by and within species
    # https://uo.com/wiki/ultima-online-wiki/skills/animal-taming/tameable-creatures/#mobs

    ### Min skill 0, Max skill 10 ###
    'dog': Animal( 'dog', 0x00D9, 0x0000, 0, 10, [ 'canine' ] ),
    'gorilla': Animal( 'gorilla', 0x001D, 0x0000, 0, 10, None ),
    'parrot': Animal( 'parrot', 0x033F, 0x0000, 0, 10, None ),

    # Rabbits
    'rabbit (brown)': Animal( 'rabbit', 0x00CD, 0x0000, 0, 10, None ),
    'rabbit (black)': Animal( 'rabbit', 0x00CD, 0x090E, 0, 10, None ),
    'jack rabbit': Animal( 'jack rabbit', 0x00CD, 0x01BB, 0, 10, None ),

    'skittering hopper': Animal( 'skittering hopper', 0x012E, 0x0000, 0, 10, None ),
    'squirrel': Animal( 'squirrel', 0x0116, 0x0000, 0, 10, None ),


    ### Min skill 0, Max skill 20 ###
    'mongbat': Animal( 'mongbat', 0x0027, 0x0000, 0, 20, None ),


    ### Min skill 10, Max skill 20 ###
    # Birds
    # Note: the following share a color code:
    # 0x0835: Finch, hawk
    # 0x0847: Tern, Towhee
    # 0x0851: Nuthatch, woodpecker
    # 0x0901: Crow, Magpie, raven
    'chickadee': Animal( 'chickadee', 0x0006, 0x0840, 10, 20, None ),
    'crossbill': Animal( 'crossbill', 0x0006, 0x083A, 10, 20, None ),
    'crow': Animal( 'crow', 0x0006, 0x0901, 10, 20, None ),
    'finch': Animal( 'finch', 0x0006, 0x0835, 10, 20, None ),
    'hawk': Animal( 'hawk', 0x0006, 0x0835, 10, 20, None ),
    'kingfisher': Animal( 'kingfisher', 0x0006, 0x083F, 10, 20, None ),
    'lapwing': Animal( 'lapwing', 0x0006, 0x0837, 10, 20, None ),
    'magpie': Animal( 'magpie', 0x0006, 0x0901, 10, 20, None ),
    'nuthatch': Animal( 'nuthatch', 0x0006, 0x0851, 10, 20, None ),
    'plover': Animal( 'plover', 0x0006, 0x0847, 10, 20, None ),
    'raven': Animal( 'raven', 0x0006, 0x0901, 10, 20, None ),
    'skylark': Animal( 'skylark', 0x0006, 0x083C, 10, 20, None ),
    'starling': Animal( 'starling', 0x083E, 0x0845, 10, 20, None ),
    'swift': Animal( 'swift', 0x0006, 0x0845, 10, 20, None ),
    'tern': Animal( 'tern', 0x0006, 0x0847, 10, 20, None ),
    'towhee': Animal( 'towhee', 0x0006, 0x0847, 10, 20, None ),
    'woodpecker': Animal( 'woodpecker', 0x0006, 0x0851, 10, 20, None ),
    'wren': Animal( 'wren', 0x0006, 0x0850, 10, 20, None ),

    'cat': Animal( 'cat', 0x00C9, 0x0000, 10, 20, [ 'feline' ] ),
    'chicken': Animal( 'chicken', 0x00D0, 0x0000, 10, 20, None ),
    'mountain goat': Animal( 'mountain goat', 0x0058, 0x0000, 10, 20, None ),
    'rat': Animal( 'rat', 0x00EE, 0x0000, 10, 20, None ),
    'sewer rat': Animal( 'sewer rat', 0x00EE, 0x0000, 10, 20, None ),


    ### Min skill 20, Max skill 30 ###
    'cow (brown)': Animal( 'cow', 0x00E7, 0x0000, 20, 30, None ),
    'cow (black)': Animal( 'cow', 0x00D8, 0x0000, 20, 30, None ),
    'goat': Animal( 'goat', 0x00D1, 0x0000, 20, 30, None ),
    'pig': Animal( 'pig', 0x00CB, 0x0000, 20, 30, None ),
    'sheep': Animal( 'sheep', 0x00CF, 0x0000, 20, 30, None ),


    ### Min skill 20, Max skill 50 ###
    'giant beetle': Animal( 'giant beetle', 0x0317, 0x0000, 20, 50, None ),
    'slime': Animal( 'slime', 0x0033, 0x0000, 20, 50, None ),


    ### Min skill 30, Max skill 40 ###
    'eagle': Animal( 'eagle', 0x0005, 0x0000, 30, 40, None ),
    'bouraRuddy': None, # Not on UO Forever


    ### Min skill 40, Max skill 50 ###
    'boar': Animal( 'boar', 0x0122, 0x0000, 40, 50, None ),
    'bullfrog': Animal( 'bullfrog', 0x0051, 0x0000, 40, 50, None ),
    'lowland boura': None, # Not on UO Forever
    'ferret': Animal( 'ferret', 0x0117, 0x0000, 40, 50, None ),
    'giant rat': Animal( 'giant rat', 0x00D7, 0x0000, 40, 50, None ),
    'hind': Animal( 'hind', 0x00ED, 0x0000, 40, 50, None ),

    # Horses
    'horse': Animal( 'horse', 0x00C8, 0x0000, 40, 50, None ),
    'horse2': Animal( 'horse', 0x00E2, 0x0000, 40, 50, None ),
    'horse3': Animal( 'horse', 0x00CC, 0x0000, 40, 50, None ),
    'horse4': Animal( 'horse', 0x00E4, 0x0000, 40, 50, None ),
    'horsePack': Animal( 'pack horse', 0x0123, 0x0000, 40, 50, None ),
    'horsePalomino': None,
    'horseWar': None,

    # Llamas
    'pack llama': Animal( 'pack llama', 0x0124, 0x0000, 40, 50, None ),
    'llamaRideable': None,

    # Ostards
    'ostard': Animal( 'desert ostard', 0x00D2, 0x0000, 40, 50, [ 'ostard' ] ),
    'forest ostard (green)': Animal( 'forest ostard', 0x00DB, 0x88A0, 40, 50, [ 'ostard' ] ),
    'forest ostard (red)': Animal( 'forest ostard', 0x00DB, 0x889D, 40, 50, [ 'ostard' ] ),

    'timber wolf': Animal( 'timber wolf', 0x00E1, 0x0000, 40, 50, [ 'canine' ] ),
    'rideable wolf': Animal( 'rideable wolf', 0x0115, 0x0000, 40, 50, [ 'canine' ] ),


    ### Min skill 50, Max skill 60 ###
    'black bear': Animal( 'black bear', 0x00D3, 0x0000, 50, 60, [ 'bear' ] ),
    'polar bear': Animal( 'polar bear', 0x00D5, 0x0000, 50, 60, [ 'bear' ] ),
    'deathwatch beetle': None,
    'llama': Animal( 'llama', 0x00DC, 0x0000, 50, 60, None ),
    'walrus': Animal( 'walrus', 0x00DD, 0x0000, 50, 60, None ),


    ### Min skill 60, Max skill 70 ###
    'alligator': Animal( 'alligator', 0x00CA, 0x0000, 60, 70, None ),
    'brown bear': Animal( 'brown bear', 0x00A7, 0x0000, 60, 70, [ 'bear' ] ),
    'high plains boura': None, # Not on UO Forever
    'cougar': Animal( 'cougar', 0x003F, 0x0000, 60, 70, [ 'feline' ] ),
    'paralithode': None, # Not on UO Forever
    'scorpion': Animal( 'scorpion', 0x0030, 0x0000, 60, 70, None ),


    ### Min skill 70, Max skill 80 ###
    'rideable polar bear': Animal( 'rideable polar bear', 0x00D5, 0x0000, 70, 80, [ 'bear' ] ),
    'grizzly bear': Animal( 'grizzly bear', 0x00D4, 0x0000, 70, 80, [ 'bear' ] ),
    'young dragon': Animal( 'young dragon', 0x003C, 0x0000, 70, 80, None ),
    'great hart': Animal( 'great hart', 0x00EA, 0x0000, 70, 80, None ),
    'snow leopard': Animal( 'snow leopard', 0x0040, 0x0000, 70, 80, [ 'feline' ] ),
    'snow leopard2': Animal( 'snow leopard', 0x0041, 0x0000, 70, 80, [ 'feline' ] ),
    'panther': Animal( 'panther', 0x00D6, 0x0000, 70, 80, [ 'feline' ] ),
    'snake': Animal( 'snake', 0x0034, 0x0000, 70, 80, None ),
    'giant spider': Animal( 'giant spider', 0x001C, 0x0000, 70, 80, None ),
    'grey wolf (light grey)': Animal( 'grey wolf', 0x0019, 0x0000, 70, 80, [ 'canine' ] ),
    'grey wolf (dark grey)': Animal( 'grey wolf', 0x001B, 0x0000, 70, 80, [ 'canine' ] ),


    ### Min skill 80, Max skill 90 ###
    'gaman': None,
    'slithStone': None,
    'white wolf (dark grey)': Animal( 'white wolf', 0x0022, 0x0000, 80, 90, [ 'canine' ] ),
    'white wolf (light grey)': Animal( 'white wolf', 0x0025, 0x0000, 80, 90, [ 'canine' ] ),


    ### Min skill 90, Max skill 100 ###
    'bull (solid, brown)': Animal( 'bull', 0x00E8, 0x0000, 90, 100, [ 'bull' ] ),
    'bull (solid, black)': Animal( 'bull', 0x00E8, 0x0901, 90, 100, [ 'bull' ] ),
    'bull (spotted, brown)': Animal( 'bull', 0x00E9, 0x0000, 90, 100, [ 'bull' ] ),
    'bull (spotted, black)': Animal( 'bull', 0x00E9, 0x0901, 90, 100, [ 'bull' ] ),
    'foxBlood': None,
    'hellcat (small)': Animal( 'hellcat', 0x00C9, 0x0647, 90, 100, [ 'feline' ] ),
    'mongbatGreater': None,
    'frenzied ostard': Animal( 'frenzied ostard', 0x00DA, 0x0000, 90, 100, [ 'ostard' ] ),
    'osseinRam': None,
    'frost spider': Animal( 'frost spider', 0x0014, 0x0000, 90, 100, None ),
    'giant toad': Animal( 'giant toad', 0x0050, 0x0000, 90, 100, None ),
    'unicorn': None,
    'giant ice worm': Animal( 'giant ice worm', 0x0050, 0x0000, 90, 100, None ),


    ### Min skill 100, Max skill 110 ###
    # Drakes
    # pathaleo drake: 0x003C
    'drake (brown)': Animal( 'drake', 0x003C, 0x0000, 100, 110, None ),
    'drake (red)': Animal( 'drake', 0x003D, 0x0000, 100, 110, None ),
    'drakeCrimson': None,
    'drakePlatinum': None,
    'drakeStygian': None,

    'hellcat (large)': Animal( 'hellcat', 0x007F, 0x0000, 100, 110, [ 'feline' ] ),
    'hellhound': Animal( 'hellhound', 0x0062, 0x0000, 100, 110, [ 'canine' ] ),
    'imp': Animal( 'imp', 0x004A, 0x0000, 100, 110, [ 'daemon' ] ),
    'kitsuneBake': None,
    'lava lizard': Animal( 'lava lizard', 0x00CE, 0x0000, 100, 110, None ),

    # ridgebacks
    'ridgeback': Animal( 'ridgeback', 0x00BB, 0x0000, 100, 110, None ),
    'savage ridgeback': Animal( 'savage ridgeback', 0x00BC, 0x0000, 100, 110, None ),

    'slith': None,
    'dire wolf': Animal( 'dire wolf', 0x0017, 0x0000, 100, 110, [ 'canine' ] ),


    ### Min skill 110, Max skill 120 ###
    'beetleDeath': None,
    'beetleFire': None,
    'rune beetle': Animal( 'rune beetle', 0x00F4, 0x0000, 110, 120, None ),

    'dragon': Animal( 'dragon', 0x003B, 0x0000, 110, 120, None ),
    'dragonSwamp': None,
    'dragonWater': None,
    'dragonDeepWater': None,

    'drakeCold': None,

    'hiryu': None,
    'hiryuLesser': None,

    'lion': None,
    'kiRin': None,
    'nightbear': None,
    'nightdragon': None,
    'nightfrenzy': None,
    'nightmare': None,
    'nightllama': None,
    'nightridge': None,
    'nightwolf': None,
    'skree': None,
    'dread spider': Animal( 'dread spider', 0x000B, 0x0000, 110, 120, None ),
    'unicorn': None,
    'wolfTsuki': None,
    'white wyrm': Animal( 'white wyrm', 0x00B4, 0x0000, 110, 120, None ),


    ### Challenging ###
    'cuSidhe': None,

    'dimetrosaur': None, # Not on UO Forever

    # Dragons
    'dragonBane': None,
    'dragonFrost': None,
    'a greater dragon': None, #0x000C
    'dragonSerpentine': None,

    'gallusaurus': None,

    # Horses
    'steedFire': None, # Pack type: Daemon, Equine
    'steedSkeletal': None, # Pack type: Daemon, Equine
    'horseDreadWar': None,

    'miteFrost': None,
    'najasaurus': None, # Not on UO Forever
    'phoenix': None,
    'raptor': None, # Pack type: Raptor
    'reptalon': None, # Not on UO Forever
    'saurosurus': None, # Not on UO Forever

    # Tigers
    'tigerWild': None,
    'tigerSabreToothed': None,

    'triceratops': None, # Not on UO Forever
    'turtleHatchlingDragon': None,
    'wolfDragon': None,
    'shadow wyrm': Animal( 'shadow wyrm', 0x006A, 0x0000, 120, 120, None )
}


def GetAnimalIDsAtOrOverTamingDifficulty( minimumTamingDifficulty ):
    '''
    Looks through the list of tameables for animals at or over the minimum taming level
    '''
    global animals

    animalList = List[int]()
    for animal in animals:
        if ( not animals[ animal ] == None and
                not animalList.Contains( animals[ animal ].mobileID ) and
                animals[ animal ].minTamingSkill >= minimumTamingDifficulty ):
            animalList.Add( animals[ animal ].mobileID )

    return animalList


def FindAnimalToTame():
    '''
    Finds the nearest tameable animal nearby
    '''
    global renameTamedAnimalsTo
    global minimumTamingDifficulty

    animalFilter = Mobiles.Filter()
    animalFilter.Enabled = True
    animalFilter.Bodies = GetAnimalIDsAtOrOverTamingDifficulty( minimumTamingDifficulty )
    animalFilter.RangeMin = 0
    animalFilter.RangeMax = 12
    animalFilter.IsHuman = 0
    animalFilter.IsGhost = 0
    animalFilter.CheckLineOfSite = True
    animalFilter.Friend = False
    animalFilter.CheckIgnoreObject = True

    tameableMobiles = Mobiles.ApplyFilter( animalFilter )

    # Exclude animals that have already been tamed by this player
    tameableMobilesTemp = tameableMobiles[:]
    for tameableMobile in tameableMobiles:
        if tameableMobile.Name == renameTamedAnimalsTo:
            tameableMobilesTemp.Remove( tameableMobile )

    tameableMobiles = tameableMobilesTemp

    if len( tameableMobiles ) == 0:
        return None
    elif len( tameableMobiles ) == 1:
        return tameableMobiles[ 0 ]
    else:
        return Mobiles.Select( tameableMobiles, 'Nearest' )


def PlayerWalk( direction ):
    '''
    Moves the player in the specified direction
    '''

    playerPosition = Player.Position
    if Player.Direction == direction:
        Player.Walk( direction )
    else:
        Player.Walk( direction )
        Player.Walk( direction )
    return
    


def FollowMobile( mobile, maxDistanceToMobile = 2, startPlayerStuckTimer = False ):
    '''
    Uses the X and Y coordinates of the animal and player to follow the animal around the map
    Returns True if player is not stuck, False if player is stuck
    '''

    if not Timer.Check( 'catchUpToAnimalTimer' ):
        return False

    mobilePosition = mobile.Position
    playerPosition = Player.Position
    directions = []
    if mobilePosition.X > playerPosition.X and mobilePosition.Y > playerPosition.Y:
        directions.append( 'Down' )
    if mobilePosition.X < playerPosition.X and mobilePosition.Y > playerPosition.Y:
        directions.append( 'Left' )
    if mobilePosition.X > playerPosition.X and mobilePosition.Y < playerPosition.Y:
        directions.append( 'Right' )
    if mobilePosition.X < playerPosition.X and mobilePosition.Y < playerPosition.Y:
        directions.append( 'Up' )
    if mobilePosition.X > playerPosition.X and mobilePosition.Y == playerPosition.Y:
        directions.append( 'East' )
    if mobilePosition.X < playerPosition.X and mobilePosition.Y == playerPosition.Y:
        directions.append( 'West' )
    if mobilePosition.X == playerPosition.X and mobilePosition.Y > playerPosition.Y:
        directions.append( 'South' )
    if mobilePosition.X == playerPosition.X and mobilePosition.Y < playerPosition.Y:
        directions.append( 'North' )

    if startPlayerStuckTimer:
        Timer.Create( 'playerStuckTimer', playerStuckTimerMilliseconds )

    playerPosition = Player.Position
    for direction in directions:
        PlayerWalk( direction )

    newPlayerPosition = Player.Position
    if playerPosition == newPlayerPosition and not Timer.Check( 'playerStuckTimer' ):
        # Player has been stuck in the same position for a while, try to find them a way out of the stuck position
        if Player.Direction == 'Up':
            for i in range ( 5 ):
                Player.Walk( 'Down' )
        elif Player.Direction == 'Down':
            for i in range( 5 ):
                Player.Walk( 'Up' )
        elif Player.Direction == 'Right':
            for i in range( 5 ):
                Player.Walk( 'Left' )
        elif Player.Direction == 'Left':
            for i in range( 5 ):
                Player.Walk( 'Right' )
        Timer.Create( 'playerStuckTimer', playerStuckTimerMilliseconds )
    elif playerPosition != newPlayerPosition:
        Timer.Create( 'playerStuckTimer', playerStuckTimerMilliseconds )

    if Player.DistanceTo( mobile ) > maxDistanceToMobile:
        # This pause may need further tuning
        # Dont want to create a ton of infinite calls if the player is stuck, but also dont want to not be able to catch up to animals
        Misc.Pause( 100 )
        FollowMobile( mobile, maxDistanceToMobile )
        #pathfindToMobile( mobile )

    return True
        
def pathfindToMobile(mobile):
    mobilePosition = mobile.Position
    mobileCoords = PathFinding.Route()
    mobileCoords.MaxRetry = 5
    mobileCoords.StopIfStuck = True
    mobileCoords.UseResync = True
    mobileCoords.X = mobilePosition.X - 1
    mobileCoords.Y = mobilePosition.Y

    if PathFinding.Go(mobileCoords):
        Misc.NoOperation()
    else:
        mobileCoords.X = mobilePosition.X + 1
        if PathFinding.Go(mobileCoords):
            Misc.NoOperation()
        else:
            mobileCoords.X = mobilePosition.X
            mobileCoords.Y = mobilePosition.Y - 1
            if PathFinding.Go(mobileCoords):
                Misc.NoOperation()
            else:
                mobileCoords.Y = mobilePosition.Y + 1
                PathFinding.Go(mobileCoords)
                
def makePeace():
    enemyFilter = Mobiles.Filter()
    enemyFilter.Enabled = True
    enemyFilter.CheckIgnoreObject = False
    enemyFilter.Notorieties = GetEnemyNotorieties()
    enemyFilter.RangeMin = 0
    enemyFilter.RangeMax = 12
    enemyFilter.Friend = False
    enemies = Mobiles.ApplyFilter( enemyFilter )

    enemyAtWar = False
    enemyToPutToPeace = None
    for enemy in enemies:
        if enemy.WarMode:
            enemyAtWar = True
            enemyToPutToPeace = enemy
            break

    while enemyAtWar:
        if not Timer.Check( 'skillTimer' ):
            try:
                enemyToPutToPeace = Mobiles.FindBySerial(enemyToPutToPeace.Serial)
                if enemyToPutToPeace == None or enemyToPutToPeace.WarMode == False :
                    break
                
                # Clear any previously selected target and the target queue
                Target.ClearLastandQueue()
                # Wait for the target to finish clearing
                Misc.Pause( targetClearDelayMilliseconds )

                Player.UseSkill( 'Peacemaking' )
                # Wait for journal entry to come up
                Misc.Pause( journalEntryDelayMilliseconds )
                if Journal.SearchByType( 'What instrument shall you play?', 'System' ):
                    instrument = findInstrument()
                    if instrument == None:
                        Misc.SendMessage( 'No instruments to peacemake with.', 1100 )
                        break
                    else:
                        Target.WaitForTarget( 2000, False )
                        Target.TargetExecute( instrument.Serial )

                if Journal.SearchByType( 'Whom do you wish to calm?', 'System' ):
                    Target.WaitForTarget( 2000, False )
                    Target.TargetExecute( enemyToPutToPeace )
                    Timer.Create( 'skillTimer', peacemakingTimerMilliseconds )

                enemyAtWar = False
                enemyToPutToPeace = None
#                for enemy in enemies:
#                    if enemy.WarMode:
#                        enemyAtWar = True
#                        enemyToPutToPeace = enemy
#                        break
            except:
                break

        # Wait a little bit so that the while loop does not consume as much CPU
        Misc.Pause( 50 )
        if killTame == False:
            if Player.WarMode:
                Player.SetWarMode( False )

def heal():           
    if healUsing != 'None':
        if healUsing == 'Healing' and not Timer.Check( 'bandageTimer' ):
            # Clear any previously selected target and the target queue
            Target.ClearLastandQueue()
            # Wait for the target to finish clearing
            Misc.Pause( targetClearDelayMilliseconds )

            bandage = Items.FindByID(0x0E21, 0, Player.Backpack.Serial)
            Items.UseItem( bandage )
            Target.WaitForTarget(1500)
            Target.Self()

            Timer.Create( 'bandageTimer', bandageTimerMilliseconds )
        elif healUsing == 'Magery':
            if ( Player.HitsMax - Player.Hits ) > 30:
                if not Target.HasTarget():
                    if Player.Poisoned:
                        Spells.CastMagery('Cure')
                        Target.WaitForTarget(1500)
                        Target.Self()
                        Misc.Pause(500)
                    else:
                        Spells.CastMagery('Greater Heal')
                        Target.WaitForTarget(1500)
                        Target.Self()
                        Misc.Pause(500)
            elif ( Player.HitsMax - Player.Hits ) > 10:
                if not Target.HasTarget():
                    if Player.Poisoned:
                        Spells.CastMagery('Cure')
                        Target.WaitForTarget(1500)
                        Target.Self()
                        Misc.Pause(500)
                    else:
                        Spells.CastMagery('Heal')
                        Target.WaitForTarget(1500)
                        Target.Self()
                        Misc.Pause(500)
            
def TrainAnimalTaming():
    '''
    Trains Animal Taming to GM
    '''

    # User variables
    global renameTamedAnimalsTo
    global numberOfFollowersToKeep
    global maximumTameAttempts
    global enablePeacemaking
    global enableFollowAnimal
    global journalEntryDelayMilliseconds
    global targetClearDelayMilliseconds

    # Script variables
    global noAnimalsToTrainTimerMilliseconds
    global playerStuckTimerMilliseconds
    global catchUpToAnimalTimerMilliseconds
    global animalTamingTimerMilliseconds
    global peacemakingTimerMilliseconds
    global bandageTimerMilliseconds

    if Player.GetRealSkillValue( 'Animal Taming' ) == Player.GetSkillCap( 'Animal Taming' ):
        Misc.SendMessage( 'You\'ve already maxed out Animal Taming!', 65 )
        return

    # Initialize variables
    animalBeingTamed = None
    tameHandled = False
    tameOngoing = False
    timesTried = 0
    bandageBeingApplied = False

    # Initialize skill timers
    Timer.Create( 'skillTimer', 1 )

    if healUsing == 'Healing':
        Timer.Create( 'bandageTimer', 1 )
    elif healUsing == 'Magery':
        Timer.Create( 'healSpellTimer', 1 )

    # Initialize the journal and ignore object list
    Journal.Clear()
    

    # Toggle war mode to make sure the player isn not going to kill the animal being tamed
    if killTame == False:
        Player.SetWarMode( True )
        Player.SetWarMode( False )

    while not Player.IsGhost:
        
        if not maximumTameAttempts == 0 and timesTried > maximumTameAttempts:
            if killTame:
                Mobiles.Message( animalBeingTamed, 1100, 'Tried more than %i times to tame. Killing animal' % maximumTameAttempts )
                Player.Attack( animalBeingTamed )
                Misc.Pause(600)
                Misc.IgnoreObject( animalBeingTamed )
            else:
                Mobiles.Message( animalBeingTamed, 1100, 'Tried more than %i times to tame. Ignoring animal' % maximumTameAttempts )
                Misc.IgnoreObject( animalBeingTamed )
                Misc.Pause(600)
            animalBeingTamed = None
            timesTried = 0
            tameHandled = False
            tameOngoing = False

        if enablePeacemaking:
            makePeace()
            
        if Player.Hits != Player.HitsMax:
            heal()

        # If there is no animal being tamed, try to find an animal to tame
        if animalBeingTamed == None:
            animalBeingTamed = FindAnimalToTame()
            if animalBeingTamed == None:
                # No animals in the area. Pause for a while so that this is constantly running until something is available to tame
                Misc.Pause( 500 )
                continue
            else:
                Mobiles.Message( animalBeingTamed, 90, 'Found animal to tame' )

        # Check if animal is close enough to tame
        if Player.DistanceTo( animalBeingTamed ) > 12:
            Misc.SendMessage( 'Animal moved too far away, ignoring for now', 1100  )
            animalBeingTamed = None
            continue
        elif animalBeingTamed != None and Player.DistanceTo( animalBeingTamed ) > 1:
            if enableFollowAnimal:
                Timer.Create( 'catchUpToAnimalTimer', catchUpToAnimalTimerMilliseconds )
                playerStuck = not FollowMobile( animalBeingTamed, 2, True )
                if playerStuck:
                    Player.HeadMessage( 1100, 'Player stuck!' )
                    return
            elif Timer.Check('notclose') == False:
                while Player.DistanceTo( animalBeingTamed ) > 2:
                    if enablePeacemaking:
                        makePeace()
                    if Timer.Check('notclose') == False:
                        Mobiles.Message( animalBeingTamed, 34, 'Not close enough!' )
                        Timer.Create('notclose', 2000)
                    Misc.Pause( 500 )

        # If peacemaking is enabled, make sure the animal being tamed is calm
        if enablePeacemaking:
            makePeace()

        # Tame the animal if a tame is not currently being attempted and enough time has passed since last using Animal Taming
        if not tameOngoing and not Timer.Check( 'skillTimer' ):
            # Clear any previously selected target and the target queue
            Target.ClearLastandQueue()
            # Wait for the target to finish clearing
            Misc.Pause( targetClearDelayMilliseconds )

            # Hey, we are finally using the Animal Taming skill! about time!
            Player.UseSkill( 'Animal Taming' )
            Target.WaitForTarget( 2000, False )
            Target.TargetExecute( animalBeingTamed )

            # Check if Animal Taming was successfully triggered
            if Journal.Search( 'Tame which animal?' ):
                timesTried += 1
                
                # Restart the timer so that it will go off when we will be able to use the skill again
                Timer.Create( 'skillTimer', animalTamingTimerMilliseconds )

                # Set tameOngoing to true to start the journal checks that will handle the result of the taming
                tameOngoing = True
            else:
                continue

        if tameOngoing:
            try:
                animalBeingTamed = Mobiles.FindBySerial(animalBeingTamed.Serial)
                if animalBeingTamed == None:
                    break
            except:
                break
            if ( Journal.SearchByName( 'It seems to accept you as master.', animalBeingTamed.Name ) or
                    Journal.Search( 'That wasn\'t even challenging.' ) ):
                # Animal was successfully tamed
                if animalBeingTamed.Name != renameTamedAnimalsTo:
                    Misc.PetRename( animalBeingTamed, renameTamedAnimalsTo )
                    Misc.Pause(200)
                if Player.Followers > numberOfFollowersToKeep:
                    # Release recently tamed animal
                    #Player.ChatSay(55,animalBeingTamed.Name + " release")
                    Misc.WaitForContext( animalBeingTamed.Serial, 2000 )
                    Misc.ContextReply( animalBeingTamed.Serial, 'Release')
                    Gumps.WaitForGump( 2426193729, 10000 )
                    Gumps.SendAction( 2426193729, 2 )
                    Misc.Pause(600)
                
                if killTame:
                    Player.Attack(animalBeingTamed)
                    Misc.Pause(600)
                    
                Misc.IgnoreObject( animalBeingTamed )
                animalBeingTamed = None
                timesTried = 0
                tameHandled = True
            elif ( Journal.SearchByName( 'You fail to tame the creature.', animalBeingTamed.Name ) or
                    Journal.SearchByName( 'The animal is too angry to continue taming.', animalBeingTamed.Name ) or
                    Journal.SearchByType( 'You must wait a few moments to use another skill.', 'System' ) ):
                tameHandled = True
                Misc.SendMessage('Tame attempt ' + str(timesTried),66)
                
            elif ( Journal.SearchByType( 'That is too far away.', 'System' ) or
                    Journal.SearchByName( 'You are too far away to continue taming.', animalBeingTamed.Name ) ):
                # Animal moved too far away, set to None so that another animal can be found
                animalBeingTamed = None
                timesTried = 0
                Timer.Create( 'skillTimer', 1 )
                #Timer.Create( 'animalTamingTimer', 1 )
                tameHandled = True
                
            elif ( Journal.SearchByName( 'You have no chance of taming this creature', animalBeingTamed.Name ) or
                    Journal.SearchByName( 'already taming', animalBeingTamed.Name ) or
                    Journal.SearchByType( 'Target cannot be seen', 'System' ) or
                    Journal.SearchByType( 'not have a clear path to the animal','System' ) or
                    Journal.Search( 'This animal has had too many owners' ) or
                    Journal.Search( 'That animal looks tame already' ) ):
                # Ignore the object and set to None so that another animal can be found
                Misc.IgnoreObject( animalBeingTamed )
                animalBeingTamed = None
                timesTried = 0
                Timer.Create( 'skillTimer', 1 )
                tameHandled = True

            if tameHandled:
                Journal.Clear()
                tameHandled = False
                tameOngoing = False

        # Wait a little bit so that the while loop does not consume as much CPU
        Misc.Pause( 50 )
        
def findInstrument():
    instruments = [0xe9e, 0x2805, 0xe9c, 0xeb3, 0xeb1, 0x0eb2, 0x0E9D ] 
    #instrument check
    for i in Player.Backpack.Contains:
        if i.ItemID in instruments:
            Target.TargetExecute(i)
            Player.HeadMessage(msgColour, "Instrument Found")
            Journal.Clear()
            Misc.Pause(200)
            break
            
class Notoriety:
    byte = Byte( 0 )
    color = ''
    description = ''

    def __init__ ( self, byte, color, description ):
        self.byte = byte
        self.color = color
        self.description = description

notorieties = {
    'innocent': Notoriety( Byte( 1 ), 'blue', 'innocent' ),
    'ally': Notoriety( Byte( 2 ), 'green', 'guilded/ally' ),
    'attackable': Notoriety( Byte( 3 ), 'gray', 'attackable but not criminal' ),
    'criminal': Notoriety( Byte( 4 ), 'gray', 'criminal' ),
    'enemy': Notoriety( Byte( 5 ), 'orange', 'enemy' ),
    'murderer': Notoriety( Byte( 6 ), 'red', 'murderer' ),
    'npc': Notoriety( Byte( 7 ), '', 'npc' )
}

def GetNotorietyList ( notorieties ):
    '''
    Returns a byte list of the selected notorieties
    '''
    notorietyList = []
    for notoriety in notorieties:
        notorietyList.append( notoriety.byte )

    return List[Byte]( notorietyList )

def GetEnemyNotorieties( minRange = 0, maxRange = 12 ):
    '''
    Returns a list of the common enemy notorieties
    '''
    global notorieties

    return GetNotorietyList( [
        notorieties[ 'attackable' ],
        notorieties[ 'criminal' ],
        notorieties[ 'enemy' ],
        notorieties[ 'murderer' ]
    ] )


def GetEnemies( Mobiles, minRange = 0, maxRange = 12, notorieties = GetEnemyNotorieties(), IgnorePartyMembers = False ):
    '''
    Returns a list of the nearby enemies with the specified notorieties
    '''

    if Mobiles == None:
        raise ValueError( 'Mobiles was not passed to GetEnemies' )

    enemyFilter = Mobiles.Filter()
    enemyFilter.Enabled = True
    enemyFilter.RangeMin = minRange
    enemyFilter.RangeMax = maxRange
    enemyFilter.Notorieties = notorieties
    enemyFilter.CheckIgnoreObject = True
    enemies = Mobiles.ApplyFilter( enemyFilter )

    if IgnorePartyMembers:
        partyMembers = [ enemy for enemy in enemies if enemy.InParty ]
        for partyMember in partyMembers:
            enemies.Remove( partyMember )

    return enemies

# Start Animal Taming
TrainAnimalTaming()
<file_sep>
restockchest = 0x448B879A
garbagecontainer = 0x467098AD
smithgarbotxt="smithgarbo" #text file containing all the smith garbage data
bodstorage = 0x43A2140A
fullbodz = 0x448B879A #storage for bods ready to be turned in
frombook = 0x4BAB2CC4

#####COLORS######
iron=0x0000
dc=0x0415
shadow=0x0455
copper =0x045f
bronze=0x06d8
gold=0x06b7
aggy=0x097e
ver=0x07d2
val=0x0544

##### CONSTANTS #####
tinktool = 0x1EB8
ingotmodel = 0x1BF2
hammermodel = 0x13E3
deedmodel = 0x14EF
deedcolor = 0x044e


def worldSave():
    if Journal.SearchByType('The world will save in 1 minute.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(500)
        Misc.Pause(2500)
        Misc.SendMessage('Continuing run', 33)
        Journal.Clear()  
        
def checktools():
    if Items.BackpackCount(tinktool , -1) < 3:
        Misc.SendMessage('Out of Tink Tools',33)
        craftTink()
    Misc.Pause(1000)    
    if Items.BackpackCount(hammermodel , -1) < 3:
        Misc.SendMessage('Out of hammers',33)
        craftsmithtool()
        
def craftTink():    
    UseTinkTool = Items.FindByID(tinktool, -1, Player.Backpack.Serial)
    Items.UseItem(UseTinkTool.Serial)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, 8)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, 23)
    Misc.Pause(2000)
        
        
def craftsmithtool():
    UseTinkTool = Items.FindByID(tinktool, -1, Player.Backpack.Serial)
    Items.UseItem(UseTinkTool.Serial)
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, 8)
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, 93)
    Gumps.WaitForGump(949095101, 10000)
    Misc.Pause(2000)
    Gumps.SendAction(949095101, 0) 
 
def unstock():
    Player.HeadMessage(54, "Unstocking")
    while Items.FindByID(ingotmodel,-1, Player.Backpack.Serial):
        moveitem = Items.FindByID(ingotmodel,-1, Player.Backpack.Serial)
        Items.Move(moveitem, restockchest, 0)
        Misc.Pause(750)
    stock(iron, 20)   

def stock(color,qtyreq):
    Player.HeadMessage(54, "Checking ingot stock")
    inbag = Items.BackpackCount(ingotmodel, color)
    if inbag < qtyreq:
        Items.UseItem(restockchest)
        Misc.Pause(750)
        instock = Items.ContainerCount(restockchest,ingotmodel,color) #how many of that ingot do we have in stock
        if instock >= qtyreq:
            qty = qtyreq-inbag
            moveitem = Items.FindByID(ingotmodel,color, restockchest)
            Items.Move(moveitem, Player.Backpack.Serial, qty)
            return True
        elif instock <= qtyreq:
            Player.HeadMessage(54, "Not enough of that ingot color sorry")
            return False
            
                
        
def craftinglogic(bod):
    
    #Legend
    #bodarray = [first menue, second menue, total qty, menue for color, actual color, exeptional(t/f), full? (t/f), use special hammer)
    
    
    bodarray = [0,0,0,0,0,0,0,0]
    tempx = Items.GetPropStringList(bod)
    
    #Trim string list a bit
    x = ""
    for i in range(0, len(tempx)):
        x = x + tempx[i]            
        x = x.replace("<BASEFONT COLOR=#585868> Hue: 1102 <BASEFONT COLOR=#FFFFFF>","")

    
    
    Player.HeadMessage(54, str(x))
    
######## shields ################    
    if "buckler" in str(x):
        prop1 = 36
        prop2 = 2
    if "bronze shield" in str(x):
        prop1 = 36
        prop2 = 9
    if "heater shield" in str(x):
        prop1 = 36
        prop2 = 16
    if "metal shield" in str(x):
        prop1 = 36
        prop2 = 23
    if "metal kite shield" in str(x):
        prop1 = 36
        prop2 = 30
    if "tear kite shield" in str(x):
        prop1 = 36
        prop2 = 37
######## helmets ################    
    if "bascinet" in str(x):
        prop1 = 29
        prop2 = 2

    if "helmet" in str(x):
        if "close" in str(x):
            prop1 = 29
            prop2 = 9
        else:
            prop1 = 29
            prop2 = 16
    if "norse helm" in str(x):
        prop1 = 29
        prop2 = 23
    if "plate helm" in str(x):
        prop1 = 29
        prop2 = 30
                                      
######## ringmail ################    
    if "ringmail gloves" in str(x):
        prop1 = 8
        prop2 = 2
    if "ringmail leggings" in str(x):
        prop1 = 8
        prop2 = 9
    if "ringmail sleeves" in str(x):
        prop1 = 8
        prop2 = 16
    if "ringmail tunic" in str(x):
        prop1 = 8
        prop2 = 23
    if "ringmail tunic" in str(x):
        prop1 = 8
        prop2 = 23        
######## chain ################    
    if "chainmail coif" in str(x):
        prop1 = 15
        prop2 = 2
    if "chainmail leggings" in str(x):
        prop1 = 15
        prop2 = 9
    if "chainmail tunic" in str(x):
        prop1 = 15
        prop2 = 16
######## plate ################    
    if "platemail arms" in str(x):
        prop1 = 22
        prop2 = 2
    if "platemail gloves" in str(x):
        prop1 = 22
        prop2 = 9
    if "platemail gorget" in str(x):
        prop1 = 22
        prop2 = 16
    if "platemail legs" in str(x):
        prop1 = 22
        prop2 = 23
    if "platemail tunic" in str(x):
        prop1 = 22
        prop2 = 30
    if "female plate" in str(x):
        prop1 = 22
        prop2 = 37
######QTY#######        
    if "amount to make: 20" in x:
        prop3 = 20
    if "amount to make: 15" in x:
        prop3 = 15
    if "amount to make: 10" in x:
        prop3 = 10
        
######color#######         
    if "All items must be made with valorite ingots." in x:
        prop4 = 62
        prop5 = val
    if "All items must be made with verite ingots." in x:
        prop4 = 55
        prop5 = ver
    if "All items must be made with agapite ingots." in x:
        prop4 = 48
        prop5 = aggy
    if "All items must be made with gold ingots." in x:
        prop4 = 41
        prop5 = gold
    if "All items must be made with bronze ingots." in x:
        prop4 = 34
        prop5 = bronze
    if "All items must be made with copper ingots." in x:
        prop4 = 27
        prop5 = copper
    if "All items must be made with shadow iron ingots." in x:
        prop4 = 20
        prop5 = shadow
    if "All items must be made with dull copper ingots." in x:
        prop4 = 13
        prop5 = dc
    if "All items must be made with iron ingots." in x:
        prop4 = 6
        prop5 = iron
    if "All items must be exceptional." in x:
        prop6 = True
    Player.HeadMessage(54, str(prop3))    
    if str(x).count(str(prop3)) > 1:
        prop7 = True #True = bod is full
    else:
        prop7 = False
    if "Large" in x:
        prop8 = True
    else:
        prop8 = False


        
    bodarray[0]= prop1 #first menue option
    bodarray[1] = prop2 #second menue option
    bodarray[2] = prop3 #Req Qty
    bodarray[3] = prop4 #Menue for color
    bodarray[4] = prop5 #color idtag
    bodarray[5] = prop6 #Exceptional ? T/F 
    bodarray[6] = prop7 # Full? T/F
    bodarray[7] = prop8 #Lbod? T/F
    #prop8 = need hammer? 
    return bodarray    


    
def bagindexing():
    inventory = []
    for item in Player.Backpack.Contains: 
        inventory.append(item.Serial)
        Misc.Pause(15)
    return inventory    

def findnewitem(inv): #works but the string is weird if you print it. 
        for item in Player.Backpack.Contains:
            if item.Serial not in inv:
                return item.Serial
                

def setingotcolor(craftcolor):
    Misc.Pause(500)
    UseTool = Items.FindByID(hammermodel, -1, Player.Backpack.Serial) 
    Items.UseItem(UseTool.Serial)
    Misc.Pause(500)
    Player.HeadMessage(54, "setting crafting ingot type") 
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, 7)
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, craftcolor) 
    Misc.Pause(1000)
 
                
def craftitems(bod):
    logicarray = craftinglogic(bod) #prime
    Player.HeadMessage(54, "starting to craft")
    setingotcolor(logicarray[3])
    Player.HeadMessage(54, "is it full?" + str(logicarray[6]))
    while logicarray[6] == False:
        worldSave()
        checktools()
        if stock(logicarray[4],100) is False: #stocks 100 of ingot color if it fails it stores bod
            sortbod(bod)
            return
        Misc.Pause(1000)    
        inventory = bagindexing()
        Misc.Pause(1000)        
                        
        UseTool = Items.FindByID(hammermodel, -1, Player.Backpack.Serial) 
        Items.UseItem(UseTool.Serial)

        Misc.Pause(250)
        Gumps.WaitForGump(949095101, 10000)
        Gumps.SendAction(949095101, logicarray[0])
        Gumps.WaitForGump(949095101, 10000)
        Gumps.SendAction(949095101, logicarray[1])
        Misc.Pause(2000)  
        item = findnewitem(inventory)
        if item != None:
            Journal.Clear()
            Items.SingleClick(item)
            Misc.Pause(800)
            if Journal.Search("Exceptional"):
                Player.HeadMessage(54, "Exceptional")
                Items.UseItem(bod)
                Misc.Pause(750)
                Gumps.SendAction(1526454082, 2)
                Misc.Pause(750)
                Target.TargetExecute(item)       
                Misc.Pause(750)
            else:
                Player.HeadMessage(54, "Shitty craft bro")
                Misc.Pause(500)
                UseTool = Items.FindByID(hammermodel, -1, Player.Backpack.Serial) 
                Items.UseItem(UseTool.Serial)
                Misc.Pause(500)
                Gumps.WaitForGump(949095101, 10000)
                Gumps.SendAction(949095101, 14)
                Misc.Pause(750)
                Target.TargetExecute(item)
                Misc.Pause(1000) 
        logicarray = craftinglogic(bod)      
    #craft loop finished
    
############################################################################        
####################################### SORTING ############################

def comparetolist(bod, input):
    filepath = 'C:/Users/Jason/PycharmProjects/BodBot/' + input + ".txt"
    f = open(filepath, 'r')        
    allinlist = f.readlines()
    f.close()
  
    #Player.HeadMessage(54, str(len(allinlist)))
    for i in range(0, len(allinlist)):
        #Player.HeadMessage(54, str(allinlist[i]))
        #Player.HeadMessage(54, str(getstringofbod(0x44D90146)))
        if getstringofbod(bod) == allinlist[i]:
            Player.HeadMessage(54, "Match found from list")
            return True
        else:
            Misc.Pause(5)
    return False
                    
def getstringofbod(bod):
        result= ""
        bodList = Items.GetPropStringList(bod)
        for i in range(0, len(bodList)):
            result = result + bodList[i]
            
        result = result.replace("[","")
        result = result.replace("]","")
        result = result.replace(" deedBlessed<BASEFONT COLOR=#585868> Hue: 1102 <BASEFONT COLOR=#FFFFFF>Weight: 1 stone","")
        result = result.replace("bulk orderAll items must be","")
        result = result.replace(".All items must be made with","")
        result = result.replace(".amount to make:","")
        result = result.replace("a bulk order","")
        
        result = result + '\n'
        return result
        
def stringtest(x):
    f = open('C:/Users/Jason/PycharmProjects/BodBot/test.txt', 'a')        
    f.write(str(x))
    f.close()
  
def checkgarbo(bod):
    if comparetolist(bod, smithgarbotxt ):
        Player.HeadMessage(54, "Sending to garbage")
        Items.Move(bod, garbagecontainer, 0)
        return True
    else:
        return False
        
def sortbod(bod): #soem sort of logic to sort bods, this is called if we run out of ingots for a bod
    logicarray = craftinglogic(bod)
    if logicarray[6] is True: #ie bod is full
        Items.Move(bod, fullbodz, 0)
        Player.HeadMessage(54, "Congrats Bod is ready to be turned in")
    else:    
        Items.Move(bod, bodstorage, 0)
    
 
def grabbod():
        
        Items.UseItem(frombook)
        Misc.Pause(1000)
        Gumps.SendAction(1425364447, 5)
        Misc.Pause(1000)
        x = Items.FindByID(deedmodel, deedcolor, Player.Backpack.Serial)
        return x     
    
    
    
####################################### SORTING ############################
############################################################################        
                
def main():
    Journal.Clear()
    logicarray =  [0,0,0,0,0] #initializing 
    #bod = grabbod()
    while Items.FindByID(deedmodel,deedcolor, Player.Backpack.Serial):
        bod=Items.FindByID(deedmodel,deedcolor, Player.Backpack.Serial)
        Player.HeadMessage(54, "mark1")
        if checkgarbo(bod) is True:
          return
        else:  
            #bod = 0x47079787
            #bod = 0x43F14045 #half full bod
            
            #stringtest(logicarray)
            #stringtest(Items.GetPropStringList(bod))
            #Player.HeadMessage(54, str(logicarray))
            craftitems(bod)
            Misc.Pause(1000)
            unstock()
        sortbod(bod)

        
        
        
#Player.HeadMessage(54, str(craftinglogic(0x4050F4EF))   )     
        
while True: 
    #unstock()   
    main()
    Misc.Pause(1000)<file_sep>if Player.GetItemOnLayer("RightHand"):
    item = Player.GetItemOnLayer("RightHand")
elif Player.GetItemOnLayer("LeftHand"):
    item = Player.GetItemOnLayer("LeftHand")
else:
    Misc.SendMessage("No Weapon in Hand",48)

Items.WaitForProps(item,2000)
charges = Items.GetPropValue(item,"Charges")
if charges > 0:
    Player.HeadMessage(78,"{} poison charges".format(int(charges)))
if charges < 1:
    Player.HeadMessage(48,"Repoisoning, {} potions left".format(int(Items.BackpackCount(0x0F0A))))
    pot = Items.FindByID(0x0F0A,-1,Player.Backpack.Serial)
    if pot:
        Player.UseSkill("Poisoning")
        Target.WaitForTarget(2000)
        Target.TargetExecute(pot)
        Target.WaitForTarget(2000)
        Target.TargetExecute(item)
        Player.HeadMessage(48,"{} potions left".format(int(Items.BackpackCount(0x0F0A))))
    else:
        Misc.SendMessage("No Poison Pots",48)
<file_sep>Player.ChatSay(5, "Forward")<file_sep>Player.ChatSay(5, "Left One")<file_sep># ItemID script by MatsaMilla v2
# Item ID
from System.Collections.Generic import List
import sys
import winsound
#**********************************************************


# turn to true if client has tool tips enabled
toolTipsOn = True

# True if you want to keep scrolls
sortScrolls = False

#if you mark sortScrolls true and this false all lvl8 scrolls go in scroll chest
keeplvl8Scrolls = False

# True to place all junk in trash barrel, else leaves in chest
tossJunk = False

# path to sound when overweight
sound = "D:\\Program Files\\CUO Launcher\\ClassicUO\\Data\\Plugins\\Razor-Enhanced\\Sounds\\pssst.wav"

# Servers drag delay
dragTime = 650
    
#**********************************************************

# constant chests
regChest = 0x43510513
netChest = 0x4012EC5A
goldChest = 0x463A35DB
gemChest = 0x4208D8F2
lvl8bag = 0x424A881A #where to put lvl 8 scrolls
scrollChest = 0x41FF4A29 #chest for all other scrolls

# bags inside scrollChest, from 1-8 for lvls
scrollBags = [ 0x424A8818,0x424A881B,0x424A8817,0x424A8816,0x424A8819,0x424A8815,0x424A8814,0x424A881A]

#**********************************************************

containerToOrganize = Target.PromptTarget('Select container to ID stuff in')
sellBag = Target.PromptTarget('Select Sell to NPC Bag')
goodChest = Target.PromptTarget('Select KEEPER container (GOOD SHIT)')

# Will use ID Wand if skill Item ID below 80
if Player.GetRealSkillValue('Item ID') < 80:
    idWand = True
else:
    idWand = False
##############################################################
# Use neraby trashcan
##############################################################
 
trashBarrelFilter = Items.Filter()
trashBarrelFilter.OnGround = 1
trashBarrelFilter.Movable = False
trashBarrelFilter.RangeMin = 0
trashBarrelFilter.RangeMax = 2
trashBarrelFilter.Graphics = List[int]( [ 0x0E77 ] )
trashBarrelFilter.Hues = List[int]( [ 0x03B2 ] )
trashcanhere = Items.ApplyFilter( trashBarrelFilter )

if not trashcanhere:
    Player.HeadMessage( 1100, 'No trashcan nearby!' )
    sys.exit()
else:
    global trashCan
    trashCan = trashcanhere[ 0 ]

msgColor = 45
stopWeight = 380
rightHand = Player.CheckLayer('RightHand')
leftHand = Player.CheckLayer('LeftHand')

# I do not know what this is
loot = [0x2260,0x2831] #0x2831 = Recipe Scroll

perk = [0x2dd5,0x1f18,0x2da3,0x166e,0x26BB,0x139B]
gold = [0xeed]
gems = [0xf16,0xf15,0xf19,0xf25,0xf21,0xf10,0xf26,0xf2d,0xf13,0x1F4C] #0x1F4C recall
wands = [0xdf5,0xdf3,0xdf4,0xdf2]
regs= [0xf7a,0xf7b,0xf86,0xf84,0xf85,0xf88,0xf8d,0xf8c]
net = [0x0DCA]

boneArmor = [0x1450,0x1f0b,0x1452,0x144f,0x1451,0x144e]

weps = [0xf62,0x1403,0xe87,0x1405,0x1401,0xf52,0x13b0,0xdf0,0x1439,0x1407,0xe89,0x143d,0x13b4,0xe81,0x13f8,
0xf5c,0x143b,0x13b9,0xf61,0x1441,0x13b6,0xec4,0x13f6,0xf5e,0x13ff,0xec3,0xf43,0xf45,0xf4d,0xf4b,0x143e,
0x13fb,0x1443,0xf47,0xf49,0xe85,0xe86,0x13fd,0xf50,0x13b2,]

armor = [0x1b72,0x1b73,0x1b7b,0x1b74,0x1b79,0x1b7a,0x1b76,0x1408,0x1410,0x1411,0x1412,0x1413,0x1414,0x1415,
0x140a,0x140c,0x140e,0x13bb,0x13be,0x13bf,0x13ee,0x13eb,0x13ec,0x13f0,0x13da,0x13db,0x13d5,0x13d6,0x13dc,
0x13c6,0x13cd,0x13cc,0x13cb,0x13c7,0x1db9,0x1c04,0x1c0c,0x1c02,0x1c00,0x1c08,0x1c06,0x1c0a,]

# useless items no matter how good they are, aka bad shields & ringmail
sellItems = [ 0x1B72,0x13DB,0x13D5,0x13DA,0x1B7B,0x1DB9,0x13BB,0x1B79,0x13EB,0x1B7A,0x13F0,0x1C02,0x1C0C,
0x13EC,0x1B73,0x13DC,0x13BE,0x13EE,0x13D6,0x13BF ]

trash = [0x171c,0x1717,0x1718,0x1544,0x1540,0x1713,0x1715,0x1714,0x1716,0x1717,0x1718,0x1719,0x171a,0x171b,
0x171c,0x2306,0x13f6,0xec4,0x1716,0x171c,0xe81,0xe86,]

keepArmorMods = ['Invulnerability','Exceptional'] #'Fortification', 'Hardening', 'Guarding', 'Defence'
keepArmorHPMods = ['Indestructible','Fortified','Massive'] # 'Substantial' , 'Durable'

keepWepDmgMods = ['Power'] # 'Force', 'Might', 'Ruin'
keepWepAccuracyMods = ['Supremely Accurate','Exceedingly Accurate'] # 'Eminently Accurate', 'Surpassingly Accurate', 'Accurate'
keepProps = ['Vanquishing']
slayerProps = ['Silver','Undead','Snake','Lizardman','Dragon','Reptile','Terathan',
'Orc Slaying','Ogre','Water','Earth','Elemental','Repond','Fey','Daemon','Exorcism','Poison','Arachnid']
# 'Scorpion','Flame','Vacuum','Gargoyle','Spider'

lvl1Scrolls = [
0x1f2e,# Clumsy
0x1f2f,# Create Food
0x1f30,# Feeblemind
0x1f31,# Heal
0x1f32,# Magic Arrow
0x1f33,# Night Sight
0x1f2d,# Reactive Armor
0x1f34,# Weaken
]
lvl2Scrolls = [
0x1f35,# Agility
0x1f36,# Cunning
0x1f37,# Cure
0x1f38,# Harm
0x1f39,# Magic Trap
0x1f3a,# Magic Untrap
0x1f3b,# Protection
0x1f3c,# Strength
]
lvl3Scrolls = [
0x1f3d,# Bless
0x1f3e,# Fireball
0x1f3f,# Magic Lock
0x1f40,# Poison
0x1f41,# Telekinesis
0x1f42,# Teleport
0x1f43,# Unlock
0x1f44,# Wall of Stone
]
lvl4Scrolls = [
0x1f45,# Arch Cure
0x1f46,# Arch Protection
0x1f47,# Curse
0x1f48,# Fire Field
0x1f49,# Greater Heal
0x1f4a,# Lightning
0x1f4b,# Mana Drain
0x1f4c,# Recall
]
lvl5Scrolls = [
0x1f4d,# Blade Spirit
0x1f4e,# Dispel Field
0x1f4f,# Incognito
0x1f50,# Magic Reflection
0x1f51,# Mind Blast
0x1f52,# Paralyze
0x1f53,# Poison Field
0x1f54,# Summon Creature
]
lvl6Scrolls = [
0x1f55,# Dispel
0x1f56,# Energy Bolt
0x1f57,# Explosion
0x1f58,# Invisibility
0x1f59,# Mark
0x1f5a,# Mass# Curse
0x1f5b,# Paralyze Field
0x1f5c,# Reveal
]
lvl7Scrolls = [
0x1f5d,# Chain Lightning
0x1f5e,# Energy Field
0x1f5f,# Flamestrike
0x1f60,# Gate Travel
0x1f61,# Mana Vampire
0x1f62,# Mass Dispel
0x1f63,# Meteor Swarm
0x1f64,# Polymorph
]
lvl8Scrolls = [
0x1f65,# Earthquake
0x1f66,# Energy Vortex
0x1f67,# Ressurrection
0x1f68,# Summon Air Elemental
0x1f69,# Summon Daemon
0x1f6a,# Summon Earth Elemental
0x1f6b,# Summon Fire Elemental
0x1f6c,# Summon Water Elemental
]
if sortScrolls or keeplvl8Scrolls:
    Items.UseItem(scrollChest)
    Misc.Pause(dragTime)

def equipWand():
    global wandSerial
    player_bag = Items.FindBySerial(Player.Backpack.Serial)
    if leftHand:
        Player.UnEquipItemByLayer('LeftHand')
        Misc.Pause(dragTime)
    if not rightHand:
        for i in player_bag.Contains:
            if i.ItemID in wands:
                Player.EquipItem(i.Serial)
                Misc.Pause(dragTime)
                wandSerial = Player.GetItemOnLayer('RightHand').Serial
    elif Player.GetItemOnLayer('RightHand').ItemID in wands:
        wandSerial = Player.GetItemOnLayer('RightHand').Serial
    else:
        Player.ChatSay(33, "No Wands Found, Stopping Script")
        sys.exit()
    Misc.Pause(dragTime)
        
def idTarget():
    worldSave()
    if idWand:
        equipWand()
        Items.UseItem(wandSerial)
        Misc.Pause(100)
    else:
        Player.UseSkill('Item ID')
        Misc.Pause(100)
    if not Target.HasTarget():
        Misc.Pause(1000)
        idTarget()

def checkWeight():
    if Player.Weight >= stopWeight:
        Player.HeadMessage(msgColor, 'Go Sell this shit')
        winsound.PlaySound(sound, winsound.SND_ALIAS)
        sys.exit()
        
def idStuff(container, type):
    idContainer = Items.FindBySerial(container)
    
    if type == 'weps':
        idItems = weps
        tier1 = keepWepDmgMods
        tier2 = keepWepAccuracyMods
        worthlessBag = sellBag
    elif type == 'armor':
        idItems = armor
        tier1 = keepArmorMods
        tier2 = keepArmorHPMods
        worthlessBag = sellBag
    elif type == 'bone':
        idItems = boneArmor
        tier1 = keepArmorMods
        tier2 = ['Indestructible']
        worthlessBag = trashCan
    
        
    for i in idContainer.Contains:
        worldSave()
        if i.ItemID in idItems:
            checkWeight()
            Journal.Clear()
            idTarget()
            Target.WaitForTarget(1500)
            Target.TargetExecute(i.Serial)
            Misc.Pause(dragTime)
            Items.SingleClick(i)
            if any(Journal.Search(keep) for keep in keepProps):
                #** Good Stuff Move **
                Items.Move(i, goodChest, 0)
                Misc.Pause(dragTime)
            elif any(Journal.Search(slash) for slash in tier1):
                #moves items if in sell ids
                if i.ItemID in sellItems:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
                elif any(Journal.Search(sub) for sub in tier2):
                    #** Good Stuff Move **
                    Items.Move(i, goodChest, 0)
                    Misc.Pause(dragTime)
                else:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
            else:
                #** Sell Stuff Move **
                Items.Move(i, worthlessBag, 0)
                Misc.Pause(dragTime)
                
def idStuffToolTips(container, type):
    idContainer = Items.FindBySerial(container)
    
    if type == 'weps':
        idItems = weps
        tier1 = keepWepDmgMods
        tier2 = keepWepAccuracyMods
        worthlessBag = sellBag
    elif type == 'armor':
        idItems = armor
        tier1 = keepArmorMods
        tier2 = keepArmorHPMods
        worthlessBag = sellBag
    elif type == 'bone':
        idItems = boneArmor
        tier1 = keepArmorMods
        tier2 = ['Indestructible']
        worthlessBag = trashCan
    
        
    for i in idContainer.Contains:
        worldSave()
        if i.ItemID in idItems:
            checkWeight()
            Journal.Clear()
            idTarget()
            Target.WaitForTarget(1500)
            Target.TargetExecute(i.Serial)
            Misc.Pause(dragTime)
            Items.WaitForProps(i,2000)
            props = Items.GetPropStringList(i)
            if any(elem in keepProps for elem in props):
                #** Good Stuff Move **
                Items.Move(i, goodChest, 0)
                Misc.Pause(dragTime)
            elif any(elem in tier1 for elem in props):
                #moves items if in sell ids
                if i.ItemID in sellItems:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
                elif any(elem in tier2 for elem in props):
                    #** Good Stuff Move **
                    Items.Move(i, goodChest, 0)
                    Misc.Pause(dragTime)
                else:
                    #** Sell Stuff Move **
                    Items.Move(i, worthlessBag, 0)
                    Misc.Pause(dragTime)
            else:
                #** Sell Stuff Move **
                Items.Move(i, worthlessBag, 0)
                Misc.Pause(dragTime)
        
def organizeItems(container):    
    idContainer = Items.FindBySerial(container)
    for i in idContainer.Contains:
        worldSave()
        if i.ItemID in loot:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in perk:
            Items.Move(i, Player.Backpack.Serial, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in gold:
            Items.Move(i, goldChest, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in regs:
            Items.Move(i, regChest, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in gems:
            Items.Move(i, gemChest, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in net:
            Items.Move(i, netChest, 0)
            Misc.Pause(dragTime)
        elif i.ItemID in lvl8Scrolls:
            if keeplvl8Scrolls and sortScrolls == False:
                Items.Move(i, scrollBags[7], 0)
                Misc.Pause(dragTime)
    for i in idContainer.Contains:
        if i.ItemID in lvl1Scrolls:
            scrollSorter(i, scrollBags[0])
        elif i.ItemID in lvl2Scrolls:
            scrollSorter(i, scrollBags[1])
        elif i.ItemID in lvl3Scrolls:
            scrollSorter(i, scrollBags[2])
        elif i.ItemID in lvl4Scrolls:
            scrollSorter(i, scrollBags[3])
        elif i.ItemID in lvl5Scrolls:
            scrollSorter(i, scrollBags[4])
        elif i.ItemID in lvl6Scrolls:
            scrollSorter(i, scrollBags[5])
        elif i.ItemID in lvl7Scrolls:
            scrollSorter(i, scrollBags[6])
        elif i.ItemID in lvl8Scrolls:
            scrollSorter(i, scrollBags[7])
        elif i.ItemID in trash:
            if tossJunk:
                Items.Move(i, trashCan, 0)
                Misc.Pause(dragTime)
                
def scrollSorter(item, destination):
    if sortScrolls:
        Items.Move(item, destination, 0)
        Misc.Pause(dragTime)  
    else:
        if tossJunk:
            Items.Move(item, trashCan, 0)
            Misc.Pause(dragTime)
                
def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()
        
def findChest():
    # Filters
    chest = Items.Filter()
    chest.Enabled = True
    chest.OnGround = True
    chest.Movable = True
    chest.RangeMax = 1
    chest.Graphics = List[int]( [ 0x0E40,0x0E43,0x0E41,0x0E43,0x09AB,0x0E42 ] )
    chest.CheckIgnoreObject = True
    chest = Items.ApplyFilter(chest)
    sortChest = Items.Select(chest, 'Nearest')
    

    if sortChest:
        Items.UseItem(sortChest)
        Misc.Pause(dragTime)
        if Journal.Search("locked")== True:
            lockpickchest(sortChest)
            Misc.Pause(3000)
            Items.UseItem( sortChest )
        while Player.Hits < Player.HitsMax:
            Spells.CastMagery('Greater Heal')
            Target.WaitForTarget(1500)
            Target.Self()
            Misc.Pause(2500)
            Items.UseItem( sortChest )
            Misc.Pause(dragTime)
        organizeItems(sortChest.Serial)
        if toolTipsOn:
            idStuffToolTips(sortChest.Serial, 'weps')
            idStuffToolTips(sortChest.Serial, 'armor')
            idStuffToolTips(sortChest.Serial, 'bone')
        else:
            idStuff(sortChest.Serial, 'weps')
            idStuff(sortChest.Serial, 'armor')
            idStuff(sortChest.Serial, 'bone')
        Player.HeadMessage(msgColor, 'Chest Cleared')
#        Items.Move(sortChest.Serial, trashCan, 0)
#        Misc.Pause(dragTime)
#        Misc.IgnoreObject(sortChest.Serial)

def lockpickchest(chest):
    lockpicks = Items.FindByID(0x14FC, -1, Player.Backpack.Serial)
    if lockpicks == None:
        Player.HeadMessage( 33, 'You don\'t have any lockpicks!' )
        return
    
    Items.UseItem(lockpicks)
    lockedChest = Items.FindBySerial( chest.Serial )
                
    Player.HeadMessage( 44, 'Starting chest unlock!' )
    
    Journal.Clear()
    while not ( Journal.SearchByName( 'The lock quickly yields to your skill.', '' ) or
            Journal.SearchByType( 'This does not appear to be locked.', 'Regular' ) ):
        Items.UseItem( lockpicks )
        Target.WaitForTarget( 2000, True )
        Target.TargetExecute( lockedChest )
        Misc.Pause( 4000 )
        Misc.Pause( 120 )

        lockpicks = Items.FindByID(0x14FC, -1, Player.Backpack.Serial)
        if lockpicks == None:
            Player.HeadMessage( 33, 'Ran out of lockpicks!' )
            return
        
    else:
        return False
        
Items.UseItem(containerToOrganize)
Misc.Pause(dragTime)
Items.UseItem(sellBag)
Misc.Pause(dragTime)
Journal.Clear()
organizeItems(containerToOrganize)
if toolTipsOn:
    idStuffToolTips(containerToOrganize, 'weps')
    idStuffToolTips(containerToOrganize, 'armor')
    idStuffToolTips(containerToOrganize, 'bone')
else:
    idStuff(containerToOrganize, 'weps')
    idStuff(containerToOrganize, 'armor')
    idStuff(containerToOrganize, 'bone')
Player.HeadMessage(msgColor, 'Chest Cleared')
Items.Move(containerToOrganize, trashCan, 0)
<file_sep># Slayer Spellbook Crafter by MatsaMilla
# Last edit: Matsamilla 3/16/22
#
# Restocks blank scrolls from beetle (1k at a time)
# Moves slayers to beetle
# Must have tooltips enabled
from System.Collections.Generic import List

#***************SETUP SECTION**********************************

keepAll = False # true to keep all slayers, false keeps only ones in keepSlayerProps

keepSlayerProps = ['Silver','Reptilian Death','Elemental Ban','Repond','Exorcism','Arachnid Doom','Fey Slayer',
    'Balron Damnation','Daemon Dismissal','Orc Slaying','Dragon Slaying'] 

#**************************************************************



dragTime = 600
pen = 0xfbf
scrolls = 0x0EF3
spellbook = 0x0EFA
noColor = 0x0000
self_pack = Player.Backpack.Serial
self = Player.Serial
rightHand = Player.CheckLayer('RightHand')

fullSpellbook = Items.FindByID(0x0EFA,0x0000,Player.Backpack.Serial)
if fullSpellbook:
    Items.WaitForProps(fullSpellbook, 500)
    if "64 Spells" in str(fullSpellbook.Properties):
        if not Player.CheckLayer("RightHand"):
            Player.HeadMessage(66,'Equiping full spellbook to not trash')
            Player.EquipItem(fullSpellbook)
            Misc.Pause(dragTime)
        else:
            Player.HeadMessage(33,'You have a full spellbook in your pack and cant equip to save it. Stopping.')

Player.HeadMessage(66,'Target Pack Animal')
beetle = Target.PromptTarget()

Player.HeadMessage(66,'Target an Item in Pack Animals Backpack')
beetleContainer = Items.FindBySerial(Target.PromptTarget())
beetleContainer = beetleContainer.RootContainer

isitabeetle = Mobiles.FindBySerial(beetle)

if isitabeetle.Body == 0x0317:
    itsAbeetle = True
else:
    itsAbeetle = False


    
if not keepAll:
    Player.HeadMessage(66, 'Keeping:')
    for i in keepSlayerProps:
        Player.HeadMessage(66, i)
        Misc.Pause(200)
else:
    Player.HeadMessage(66, 'Keeping All Slayers')
    
slayers = ['Silver','Reptilian Death','Elemental Ban','Repond','Exorcism','Arachnid Doom','Fey Slayer',
            'Balron Damnation','Daemon Dismissal','Orc Slaying', 'Blood Drinking', 'Troll Slaughter',
            'Ogre Thrashing','Dragon Slaying','Earth Shatter','Elemental Health','Flame Dousing',
            'Summer Wind','Vacuum','Water Dissipation','Gargoyles Foe','Scorpions Bane','Spiders Death',
            'Terathan','Lizardman Slaughter','Ophidian','Snakes Bane']

slayersLower = []
keepSlayerPropsLower = []
            
for i in range(len(keepSlayerProps)):
   slayersLower.append(keepSlayerProps[i].lower())
    
for k in range(len(slayers)):
    keepSlayerPropsLower.append(slayers[k].lower())
    
    


# Use neraby trashcan
trashBarrelFilter = Items.Filter()
trashBarrelFilter.OnGround = 1
trashBarrelFilter.Movable = False
trashBarrelFilter.RangeMin = 0
trashBarrelFilter.RangeMax = 2
trashBarrelFilter.Graphics = List[int]( [ 0x0E77 ] )
trashBarrelFilter.Hues = List[int]( [ 0x03B2 ] )
trashcanhere = Items.ApplyFilter( trashBarrelFilter )

if not trashcanhere:
    Player.HeadMessage( 1100, 'No trashcan nearby!' )
    Misc.ScriptStop( 'craft_SlayerSpellbook.py' )
    Misc.Pause(5000)
    Stop
else:
    global trashcan
    trashcan = trashcanhere[ 0 ]

def moveSlayerBookToBeetle():
    if Player.Mount and itsAbeetle:
        Mobiles.UseMobile(self)
        Misc.Pause(dragTime)
    Items.Move(craftedBook, beetle, 1)
    Misc.Pause(dragTime)
    Mobiles.UseMobile(beetle)
    Misc.Pause(dragTime)
        
def trashSpellbook():
    if craftedBook:
        Items.Move(craftedBook, trashcan, 1)
        Misc.Pause(dragTime)
    
def hide():
    if not Player.BuffsExist('Hiding') and Timer.Check('hideskill') == False:
        Player.UseSkill('Hiding')
        Timer.Create('hideskill',11000)

def checkMats():
    if Items.BackpackCount(scrolls, -1) < 16:
        restockScrolls()
        Misc.Pause(dragTime)
        if Items.BackpackCount(scrolls, -1) < 16:
            Misc.SendMessage('Out of Scrolls',33)
            if not Player.Mount and itsAbeetle:
                Mobiles.UseMobile(beetle)
                Misc.Pause(dragTime)
            Stop
            
def restockScrolls():
    if Player.Mount and itsAbeetle:
        Mobiles.UseMobile(self)
        Misc.Pause(dragTime)
        
    Mobiles.SingleClick(beetle)
    Misc.WaitForContext(beetle, 1500)
    if Player.Visible:
        Misc.ContextReply(beetle, "Open Backpack") #10
    else:
        Misc.ContextReply(beetle, "Open Backpack") #0
    Misc.Pause(dragTime)
    beetleScrolls = Items.FindByID(scrolls, noColor, beetleContainer)
    if beetleScrolls:
        Player.HeadMessage (66, 'Restocking')
        Items.Move(beetleScrolls, self_pack, 500)
        Misc.Pause(dragTime)
    
    if not Player.Mount and itsAbeetle:
        Mobiles.UseMobile(beetle)
        Misc.Pause(dragTime)
        
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
        
def craftBook():
    currentPen = FindItem(pen, Player.Backpack) #Items.FindByID(pen, -1, -1,True) 
    if currentPen:
        if Gumps.CurrentGump() != 0x38920abd:
            Items.UseItem(currentPen.Serial)
        Gumps.WaitForGump(0x38920abd,1500)
        Gumps.SendAction(0x38920abd, 57)
        Gumps.WaitForGump(0x38920abd,1500)
        Gumps.SendAction(0x38920abd, 16)
        Misc.Pause(2000)
    else:
        Misc.SendMessage('Out of Pens',33)
        Misc.Beep()
        if not Player.Mount and itsAbeetle:
            Mobiles.UseMobile(beetle)
            Misc.Pause(dragTime)
        Stop

def slayerCheck():
    global craftedBook
    craftedBook = Items.FindByID(spellbook, -1, self_pack)
    
    while craftedBook:
        if keepAll:
            Items.WaitForProps(craftedBook, 1500)
            props = Items.GetPropStringList(craftedBook)
            if any(elem in slayers for elem in props) or any(elem in slayersLower for elem in props):
                Player.HeadMessage (66, props[3]) #
                moveSlayerBookToBeetle()
            else:
                trashSpellbook()
        else:
            Items.WaitForProps(craftedBook, 1500)
            props = Items.GetPropStringList(craftedBook)
            if any(elem in keepSlayerProps for elem in props) or any(elem in keepSlayerPropsLower for elem in props):
                Player.HeadMessage (66, props[3]) #
                moveSlayerBookToBeetle()
            else:
                trashSpellbook()
                
        craftedBook = Items.FindByID(spellbook, -1, self_pack)
    
    
            
while True:
    Journal.Clear()
    if Player.GetRealSkillValue('Hiding') > 30:
        hide() 
    checkMats()           
    craftBook()
    while Items.BackpackCount(spellbook, -1) > 0:
        slayerCheck()
    if not Player.Mount and itsAbeetle:
        Mobiles.UseMobile(beetle)
        Misc.Pause(dragTime)
<file_sep># Sallos . recall and . gate commands
# By MatsaMilla, Version 2.0 - UOAges Compatible

Misc.Pause(5000)
runebookDelay = 600

if Misc.ShardName() == "UO Ages":
    runebookID = 0x0EFA
    runebookDelay = 800
else:
    runebookID = 0x22C5

if Player.GetRealSkillValue('Magery') > 35:
    mageRecall = True
else:
    mageRecall = False
    Misc.SendMessage('Recalling by Charges')
    
def makeRunebookList( ):
    sortedRuneList = []
    for i in Player.Backpack.Contains:
        if i.ItemID == runebookID:
            # opens runebook
            Items.UseItem( i )
            Misc.Pause(120) 
            Gumps.WaitForGump( 1431013363, 500 )
            if Journal.Search('You must wait'):
                Misc.SendMessage('trying runebook again')
                Items.UseItem( i )
                Gumps.WaitForGump( 1431013363, 500 )
                Journal.Clear()
            
            bookSerial = i.Serial
            runeNames = []
            lineList = Gumps.LastGumpGetLineList()

            # Remove the default 3 lines from the top of the list
            lineList = lineList[ 3 : ]

            # Remove the items before the names of the runes
            endIndexOfDropAndDefault = 0
            for i in range( 0, len( lineList ) ):
                if lineList[ i ] == 'Set default' or lineList[ i ] == 'Drop rune':
                    endIndexOfDropAndDefault += 1
                else:
                    break

            # Add two for the charge count and max charge numbers
            endIndexOfDropAndDefault += 2
            runeNames = lineList[ endIndexOfDropAndDefault : ( endIndexOfDropAndDefault + 16 ) ]
            runeNames = [ name for name in runeNames if name != 'Empty' ]
            mageRecall = 5
            chargeRecall = 2
            gate = 6
            for x in runeNames:
                sortedRuneList.append( (bookSerial, x.lower(), mageRecall , chargeRecall , gate) )
                mageRecall = mageRecall + 6
                chargeRecall = chargeRecall + 6
                gate = gate + 6
            Gumps.CloseGump(1431013363)
            Misc.Pause(runebookDelay)
    Misc.SendMessage('Runebooks Updated', 66)
    return sortedRuneList

def recall( str ):
    for f in runeNames:
        if str == f[1]:
            Items.UseItem(f[0])
            Gumps.WaitForGump(1431013363, 1000)
            Gumps.SendAction(1431013363, f[2])
            Player.HeadMessage(66, '- ' + str + ' -')
        
def chargeRecall( str ):
    for f in runeNames:
        if str == f[1]:
            Items.UseItem(f[0])
            Misc.Pause(50)
            Gumps.WaitForGump(1431013363, 1000)
            Gumps.SendAction(1431013363, f[3])
            Player.HeadMessage(66, '- ' + str + ' -')
#            Items.WaitForProps(f[0],500)
#            charges = Items.GetPropValue(f[0],'Charges')
#            Player.HeadMessage(66, str(int(charges)) + ' charges left' )

            
def gate( str ):
    for f in runeNames:
        if str == f[1]:
            Items.UseItem(f[0])
            Gumps.WaitForGump(1431013363, 1000)
            Gumps.SendAction(1431013363, f[4])
            Player.HeadMessage(66, '- ' + str + ' -')
            #Misc.SendMessage('Gating ' + str,11)
            
def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
def checkRegs():
    if (FindItem(0x0F7A , Player.Backpack) and FindItem(0x0F86 , Player.Backpack) and FindItem(0x0F7B , Player.Backpack) ):
        return True
    else:
        return False
        
def parseJournal (str):
    # Fetch the Journal entries (oldest to newest)
    regularText = Journal.GetTextBySerial(Player.Serial)
    
    # Reverse the Journal entries so that we read from newest to oldest
    regularText.Reverse()

    # Read back until the item ID was started to see if it succeeded
    try:
        for line in regularText[ 0 : len( regularText ) ]:
            #if line == str:
            if str in line:
                line = line.split(str + ' ', 1)[1]
                Journal.Clear()
                return line
    except:
        Player.HeadMessage(33,'Not Found')

playerSerialCheck = Misc.ReadSharedValue('playerSerial')

runeNames = Misc.ReadSharedValue('runeNames'+str(Player.Serial))
if runeNames == 0:
    Misc.SendMessage('Reading Runebooks, please wait', 33)
    runeNames = makeRunebookList()
    Misc.Pause(500)
    Misc.SetSharedValue('runeNames'+str(Player.Serial), runeNames)
else:
     Misc.SendMessage('Runes Still In Memory', 66)

Journal.Clear()
while Player.IsGhost:
    Misc.Pause(5000)

while True:
    if Journal.SearchByName(". recall", Player.Name):
        if mageRecall and checkRegs():
            recallLocation = parseJournal('. recall')
            if recallLocation != None:
                recall(recallLocation.lower())
            Misc.NoOperation()
        else:
            recallLocation = parseJournal('. recall')
            if recallLocation != None:
                chargeRecall(recallLocation.lower())
            Misc.NoOperation()
        Journal.Clear()
    elif Journal.SearchByName(". gate", Player.Name):
        gateLocation = parseJournal('. gate')
        if gateLocation != None:
            gate(gateLocation.lower())
        Journal.Clear()
    Misc.Pause(50)
<file_sep># Poison trainer by MatsaMilla
# NEED: Bag of poison kegs
#       Empty bag for emtpy kegs to go into
#       Food to poison    

backpack = Player.Backpack.Serial
dragTime = 600
msgColor = 33
pKeg = None
import sys
def GetBag ( sharedValue, promptString ):
    if Misc.CheckSharedValue( sharedValue ):
        bag = Misc.ReadSharedValue( sharedValue )
        if not Items.FindBySerial( bag ):
            bag = Target.PromptTarget( promptString )
            Misc.SetSharedValue( sharedValue, bag )
    else:
        bag = Target.PromptTarget( promptString )
        Misc.SetSharedValue( sharedValue, bag )
    return bag
    
kegBag = Target.PromptTarget( 'Select Bag with Poison Kegs' )# GetBag( 'KegBag', 'Select Bag with Poison Kegs' )
emptyKegBag = Target.PromptTarget( 'Select Bag for empty Kegs' ) #GetBag( 'eKegBag', 'Select Bag for empty Kegs' )
toPoison = Target.PromptTarget( 'Target what you want to poison' ) #GetBag( 'toPoisonn', 'Target what you want to poison')

Items.UseItem(kegBag)
Misc.Pause(dragTime)
        
def restockKeg():
    emptyKeg = Items.FindByID( 0x1940 , -1 , backpack )
    if emptyKeg != None:
        Items.Move( emptyKeg , emptyKegBag , 0 )
        Misc.Pause(dragTime)
    
    Items.UseItem(kegBag)
    Misc.Pause(dragTime)
    
    pKeg = Items.FindByID( 0x1940 , -1 , kegBag )
    
    if pKeg != None:
        Items.Move( pKeg , backpack , 0 )
        Misc.Pause(dragTime)
    elif pkeg == None:
        Misc.SendMessage('Out of kegs', msgColor)
        Misc.Beep()
        sys.exit()
            
def trainPoison():
    pkeg = Items.FindByID( 0x1940 , -1 , backpack )
    
    if not Items.BackpackCount(0xf0a, -1):
        Items.UseItem(pkeg)
        Misc.Pause(dragTime)
    
    ppot = Items.FindByID( 0xf0a , -1 , backpack )
    
    if ppot and Timer.Check('poisonTimer') == False:
        Player.UseSkill('Poisoning')
        Target.WaitForTarget(1500)
        Target.TargetExecute(ppot)
        Target.WaitForTarget(1500)
        Target.TargetExecute(toPoison)
        Timer.Create('poisonTimer', 11000)
    elif pkeg == None:
        restockKeg()
        Journal.Clear()
    
    if Journal.Search('The keg is empty.'):
        restockKeg()
        Journal.Clear()
        
def boxRefresh():
    if Timer.Check('boxrefresh') == False:
        Items.DropItemGroundSelf(kegBag, 0)
        Timer.Create('boxrefresh', 180000) #300000 = 5 mins    
        
Journal.Clear()        
while True:
    if Player.GetRealSkillValue('Poisoning') > 30 and Player.GetRealSkillValue('Poisoning') < 100:
        trainPoison()
        boxRefresh()
    Misc.Pause(100)
    
    while Player.Hits < 50:
        Misc.Pause(50)
<file_sep>Player.ChatSay(5, "Forward One")<file_sep>Player.ChatSay(5, "Fire Left")<file_sep>'''
Author: TheWarDoctor95
Other Contributors:
    Last Contribution By: MatsaMilla - March 28, 2020

Description: Uses the instruments from the player backpack and the selected target
    to train Provocation to GM Provokes mobs onto yourself
    
    Targets nearest mob until 75, then tries to target a rotting corpse if one is around.
    
'''
from System.Collections.Generic import List
from System import Byte
import sys

# provo skill cooldown
provocationTimerMilliseconds = 10200

instruments = [0xe9e, 0x2805, 0xe9c, 0xeb3, 0xeb1, 0x0eb2 , 0x0E9D] 

enemyFilter = Mobiles.Filter()
enemyFilter.Enabled = True
enemyFilter.RangeMax = 12
enemyFilter.Notorieties = List[Byte](bytes( [ 3 , 4 ] ) )

rottingFilter = Mobiles.Filter()
rottingFilter.Enabled = True
rottingFilter.RangeMax = 12
rottingFilter.Bodies = List[int] ( [ 0x009B ] )

def TrainProvocation():
    '''
    Trains Musicianship by using the instruments in the player bag
    Transitions to a new instrument if the one being used runs out of uses
    '''
    global provocationTimerMilliseconds
    global provocationTarget

    Timer.Create( 'provocationTimer', 1 )

    while Player.GetSkillValue( 'Provocation' ) < 100:
        
        rottingMob = Mobiles.ApplyFilter(rottingFilter)
        rotting = Mobiles.Select(rottingMob, "Nearest")
        
        enemyMob = Mobiles.ApplyFilter(enemyFilter)
        enemy = Mobiles.Select(enemyMob, "Farthest")
        
        if Timer.Check( 'provocationTimer' ) == False:
            Journal.Clear()
            
            Player.UseSkill( 'Provocation' )
            Misc.Pause(120)
            
            # selects an instrument if on is needed.
            if Journal.Search("What instrument shall you play?"):
                for i in Player.Backpack.Contains:
                    if i.ItemID in instruments:
                        Target.TargetExecute(i)
                        Player.HeadMessage(33, "Instrument Found")
                        Journal.Clear()
                        Misc.Pause(200)
                        break
                Misc.SendMessage('No Instruments found',33)
                sys.exit()

            Target.WaitForTarget( 2000, True )
            
            # targets a mob
            if Player.GetSkillValue( 'Provocation' ) < 75:
                Target.TargetExecute( enemy )
            elif Player.GetSkillValue( 'Provocation' ) > 75:
                if rotting:
                    Target.TargetExecute( rotting )
                else:
                    Target.TargetExecute( enemy )
            else:
                Target.TargetExecute( enemy )
            
            Target.WaitForTarget( 2000, True )
            Target.Self()

            Timer.Create( 'provocationTimer', provocationTimerMilliseconds )

        # Wait a little bit so that the while loop does not consume as much CPU
        Misc.Pause( 50 )
    
    Player.HeadMessage(66, 'Wahoo! GM Provo!')

# Start Training
TrainProvocation()
<file_sep>Download both files.
Edit ButlerProfiles with as many profiles as you would like.
It works by pulling the toon name (no spaces or caps) and going from there.
Follow / replace / copy the examples there to get it to work.

This will replace current profile(s) on butler, so if you use multiple clients / helpers you
may not want to use these scripts.
<file_sep>Journal.Clear()
Player.WeaponStunSA( )
Misc.Pause(120)
if Journal.Search("You get yourself ready to stun your opponent."):
    Player.HeadMessage(33, "Stun: ON")

if Journal.Search("You decide to not try to stun anyone."):
    Player.HeadMessage(33, "Stun: OFF")
    
if Journal.Search("You are not skilled enough to stun your opponent."):
    Player.HeadMessage(33, "NO STUN")<file_sep>'''
Author: TheWarDoctor95
Other Contributors:
    Last Contribution By: Matsamilla - 12/7/21

Description: Selects enemies to use the Provocation skill on.
    • Automatically selects an instrument if one is needed
    • Maintains a list of enemies that have been successfully been provoked together and will ignore enemies that have been provoked together
    • If one of the enemies that has already been provokd dies, the script will detect the death and free up the enemy that is still alive to be provoked again
    • Priority:
        1. PKs
        2. Paragons
        3. Enemies in War Mode
        4. Any other enemy
'''

## Script options ##
# Change depending on whether or not you want a more verbose output on what is being provoked or ignored by the script
showTargets = True

import re
from System.Collections.Generic import List
from System import Byte

journalEntryDelayMilliseconds = 200
targetClearDelayMilliseconds = 200
dragDelayMilliseconds = 600

enemiesProvodSharedValue = 'enemiesProvod'

pkFilter = Mobiles.Filter()
pkFilter.Enabled = True
pkFilter.RangeMax = 12
pkFilter.IsHuman = True
pkFilter.IsGhost = False
pkFilter.Friend = False
pkFilter.Notorieties = List[Byte](bytes([ 6 ]))

def GetEmptyMobileList( Mobiles ):
    '''
    Creates a filter that returns an empty list, and then returns the empty list
    '''
    emptyFilter = Mobiles.Filter()
    emptyFilter.Enabled = True
    emptyFilter.Name = 'there_is_no_way this_is someones_name_since_its_way_too_long'
    return Mobiles.ApplyFilter( emptyFilter )

class Notoriety:
    byte = Byte( 0 )
    color = ''
    description = ''

    def __init__ ( self, byte, color, description ):
        self.byte = byte
        self.color = color
        self.description = description

notorieties = {
    'innocent': Notoriety( Byte( 1 ), 'blue', 'innocent' ),
    'ally': Notoriety( Byte( 2 ), 'green', 'guilded/ally' ),
    'attackable': Notoriety( Byte( 3 ), 'gray', 'attackable but not criminal' ),
    'criminal': Notoriety( Byte( 4 ), 'gray', 'criminal' ),
    'enemy': Notoriety( Byte( 5 ), 'orange', 'enemy' ),
    'murderer': Notoriety( Byte( 6 ), 'red', 'murderer' ),
    'npc': Notoriety( Byte( 7 ), '', 'npc' )
}

def GetNotorietyList ( notorieties ):
    '''
    Returns a byte list of the selected notorieties
    '''
    notorietyList = []
    for notoriety in notorieties:
        notorietyList.append( notoriety.byte )

    return List[Byte]( notorietyList )

def GetEnemyNotorieties( minRange = 0, maxRange = 12 ):
    '''
    Returns a list of the common enemy notorieties
    '''
    global notorieties

    return GetNotorietyList( [
        notorieties[ 'attackable' ],
        notorieties[ 'criminal' ],
        notorieties[ 'enemy' ],
        notorieties[ 'murderer' ]
    ] )


def GetEnemies( Mobiles, minRange = 0, maxRange = 12, notorieties = GetEnemyNotorieties(), IgnorePartyMembers = True ):
    '''
    Returns a list of the nearby enemies with the specified notorieties
    '''

    if Mobiles == None:
        raise ValueError( 'Mobiles was not passed to GetEnemies' )

    enemyFilter = Mobiles.Filter()
    enemyFilter.Enabled = True
    enemyFilter.RangeMin = minRange
    enemyFilter.RangeMax = maxRange
    enemyFilter.Notorieties = notorieties
    enemyFilter.CheckIgnoreObject = True
    enemyFilter.Friend = False
    enemies = Mobiles.ApplyFilter( enemyFilter )

    if IgnorePartyMembers:
        partyMembers = [ enemy for enemy in enemies if enemy.InParty ]
        for partyMember in partyMembers:
            enemies.Remove( partyMember )

    return enemies

class myItem:
    name = None
    itemID = None
    color = None
    category = None
    weight = None

    def __init__ ( self, name, itemID, color, category, weight ):
        self.name = name
        self.itemID = itemID
        self.color = color
        self.category = category
        self.weight = weight


def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''

    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
colors = {
    'green': 65,
    'cyan': 90,
    'orange': 43,
    'red': 1100,
    'yellow': 52
}

instruments = {
    'drum': myItem( 'drum', 0x0E9C, 0x0000, 'instrument', None ),
    'flute': myItem( 'flute', 0x2805, 0x0000, 'instrument', None ),
    'lute': myItem( 'lute', 0x0EB3, 0x0000, 'instrument', None ),

    # Harps
    'lap harp': myItem( 'lap harp', 0x0EB2, 0x0000, 'instrument', None ),
    'standing harp': myItem( 'standing harp', 0x0EB1, 0x0000, 'instrument', None ),

    # Tambourines
    'tambourine': myItem( 'tambourine', 0x0E9E, 0x0000, 'instrument', None ),
    'tambourine (tassle)': myItem( 'tambourine', 0x0E9D, 0x0000, 'instrument', None )
}

def FindInstrument( container ):
    '''
    Uses FindItem to look through the players backpack for an instrument
    '''
    global instruments

    instrumentIDs = [ instruments[ instrument ].itemID for instrument in instruments ]

    return FindItem( instrumentIDs, container )

def CheckPlayerInDungeon( Player ):
    '''
    Uses the Players X and Y coordinates to determine if they are in a dungeon
    '''

    if Player.Position.X < 5120:
        # Player is west of the dungeon cutoff
        return False

    if Player.Position.Y < 2305:
        # Player is east of the dungeon cutoff and to the north of the Lost Lands
        return True

    if Player.Position.X > 6140:
        # Player is east of the Lost Lands
        return True

    # Player is in the Lost Lands
    return False

def SelectEnemyToProvo( enemies ):
    '''
    Selects the nearest enemy who is not provoked to use Provocation on
    '''

    enemiesAlreadyProvod = None
    enemiesAlreadyProvodCheck = Misc.CheckSharedValue( enemiesProvodSharedValue )
    if enemiesAlreadyProvodCheck:
        enemiesAlreadyProvod = Misc.ReadSharedValue( enemiesProvodSharedValue )

        # Make sure the enemies we provoked previously are still around
        verifiedEnemiesAlreadyProvod = None
        enemySets = enemiesAlreadyProvod.split( ',' )
        for enemySet in enemySets:
            enemySerials = enemySet.split( '`' )
            bothEnemiesStillExist = True

            for enemySerial in enemySerials:
                enemyMobile = Mobiles.FindBySerial( int( enemySerial ) )
                if enemyMobile == None:
                    bothEnemiesStillExist = False

            if bothEnemiesStillExist and verifiedEnemiesAlreadyProvod == None:
                verifiedEnemiesAlreadyProvod = enemySet
            elif bothEnemiesStillExist:
                verifiedEnemiesAlreadyProvod += ',' + enemySet

        # Update the stored values
        enemiesAlreadyProvod = verifiedEnemiesAlreadyProvod
        if verifiedEnemiesAlreadyProvod == None:
            Misc.RemoveSharedValue( enemiesProvodSharedValue )
        else:
            Misc.SetSharedValue( enemiesProvodSharedValue, verifiedEnemiesAlreadyProvod )

    enemiesNotYetProvod = enemies
    if enemiesAlreadyProvod != None:
        # Remove the enemies we have already provoked from the list of potential enemies to provo
        enemiesAlreadyProvodSerials = []
        enemySets = enemiesAlreadyProvod.split( ',' )
        for enemySet in enemySets:
            enemySerials = enemySet.split( '`' )
            for enemy in enemySerials:
                enemiesAlreadyProvodSerials.append( int( enemy ) )

        enemiesNotYetProvodPythonList = list( filter( lambda enemy: enemy.Color == 1157 or not ( enemy.Serial in enemiesAlreadyProvodSerials ), enemies ) )

        # We have the Python formatted list, but we need a C# list to pass to Mobiles.Select()
        enemiesNotYetProvodCSharpList = GetEmptyMobileList( Mobiles )
        for enemy in enemiesNotYetProvodPythonList:
            enemiesNotYetProvodCSharpList.Add( enemy )
        enemiesNotYetProvod = enemiesNotYetProvodCSharpList

    # Make sure there are still enemies yet to be provod, if not, use all of the enemies given
    enemiesToProvo = enemiesNotYetProvod
    if len( enemiesToProvo ) == 0:
        enemiesToProvo = enemies

    # Select the enemy to provo
    paragons = [ enemy for enemy in enemiesToProvo if enemy.Color == 1157 ]
    if len( paragons ) > 0:
        paragonMobiles = GetEmptyMobileList( Mobiles )
        for paragon in paragons:
            paragonMobiles.Add( paragon )
        return Mobiles.Select( paragonMobiles, 'Nearest' )

    if not CheckPlayerInDungeon( Player ):
        # Make sure we are pulling enemies attacking and not birds or rabbits
        enemiesInWarMode = [ enemy for enemy in enemiesToProvo if enemy.WarMode ]
        if len( enemiesInWarMode ) > 0:
            warModeMobiles = GetEmptyMobileList( Mobiles )
            for enemyInWarMode in enemiesInWarMode:
                warModeMobiles.Add( enemyInWarMode )
            return Mobiles.Select( warModeMobiles, 'Nearest' )

    return Mobiles.Select( enemiesToProvo, 'Nearest' )


def ProvoEnemies():
    '''
    Identifies enemies that need to be provoked and uses the Provocation skill on them
    Having this encapsulated in a function makes it possible to use the 'return' keyword
    '''

    global showTargets

    Misc.ClearIgnore()

    provoAttemptCompleted = False

    while not provoAttemptCompleted:
        enemies = GetEnemies( Mobiles, 0, 12, GetEnemyNotorieties(), IgnorePartyMembers = True )
        #murderer = GetEnemies( Mobiles, 0, 12, 'murderer' , IgnorePartyMembers = True )

        if enemies == None or len( enemies ) < 2:
            Misc.SendMessage( 'Not enough enemies to provo!', colors[ 'red' ] )
            return
        else:
            # Clear any previously selected target and the target queue
            Target.ClearLastandQueue()

            # Wait for the target to finish clearing
            Misc.Pause( targetClearDelayMilliseconds )

            Player.UseSkill( 'Provocation' )

            # Wait for the journal entry to appear
            Misc.Pause( journalEntryDelayMilliseconds )

            if Journal.SearchByType( 'You must wait a few moments to use another skill.', 'System' ):
                # Something is on cooldown, nothing we can do
                Player.HeadMessage( 55, 'Skill Timer, try again')
                Journal.Clear()
                return
            elif Journal.SearchByType( 'What instrument shall you play?', 'System' ):
                instrument = FindInstrument( Player.Backpack )
                if instrument == None:
                    Misc.SendMessage( 'No instrument to provo with!', colors[ 'red' ] )
                    return
                Target.WaitForTarget( 2000, True )
                Target.TargetExecute( instrument )

            Target.WaitForTarget( 2000, True )
            enemyToProvo1 = SelectEnemyToProvo( enemies )
            Target.TargetExecute( enemyToProvo1 )

            # Wait for the journal entry to appear
            Misc.Pause( journalEntryDelayMilliseconds )

            if Journal.SearchByType( 'Target cannot be seen', 'System' ):
                if showTargets:
                    Mobiles.Message( enemyToProvo1, colors[ 'red' ], 'Target 1 cannot be seen' )
                Misc.IgnoreObject( enemyToProvo1 )
                Journal.Clear()
                provoAttemptCompleted = False
                Misc.Pause( 1000 )
                continue

            # Remove the selected enemy to ensure we don not provo an enemy onto themselves
            enemies.Remove( enemyToProvo1 )
            
            pkscan = Mobiles.ApplyFilter( pkFilter )
            pk = Mobiles.Select( pkscan , 'Nearest' )
            

            Target.WaitForTarget( 2000, True )
            if pk:
                Target.TargetExecute(pk)
                Player.HeadMessage( 33 , 'Provo on ' + pk.Name)
                Target.SetLast(pk)
            else:
                enemyToProvo2 = SelectEnemyToProvo( enemies )
                Target.TargetExecute( enemyToProvo2 )

            # Wait for the journal entry to appear
            Misc.Pause( journalEntryDelayMilliseconds )

            if Journal.SearchByType( 'Target cannot be seen', 'System' ):
                if showTargets:
                    Mobiles.Message( enemyToProvo2, colors[ 'red' ], 'Target 2 cannot be seen' )
                Misc.IgnoreObject( enemyToProvo2 )
                Journal.Clear()
                provoAttemptCompleted = False
                Misc.Pause( 1000 )
                continue

            if showTargets:
                Mobiles.Message( enemyToProvo1, colors[ 'cyan' ], 'Provo Target 1' )
                Mobiles.Message( enemyToProvo2, colors[ 'cyan' ], 'Provo Target 2' )

            # Wait for the journal entry to appear
            Misc.Pause( journalEntryDelayMilliseconds )

            if Journal.SearchByType( 'Your music succeeds, as you start a fight.', 'System' ):
                Journal.Clear()
                newEntry = '%i`%i' % ( enemyToProvo1.Serial, enemyToProvo2.Serial )
                enemiesAlreadyProvodCheck = Misc.CheckSharedValue( enemiesProvodSharedValue )
                if enemiesAlreadyProvodCheck:
                    enemiesAlreadyProvod = Misc.ReadSharedValue( enemiesProvodSharedValue )
                    Misc.SetSharedValue( enemiesProvodSharedValue, enemiesAlreadyProvod + ',' + newEntry )
                else:
                    Misc.SetSharedValue( enemiesProvodSharedValue, newEntry )
            provoAttemptCompleted = True

# Run ProvoEnemies
while Target.HasTarget():
    Misc.Pause(10)
ProvoEnemies()
<file_sep># Bandage Timer by Wardoc
# Contributions by Matsamilla
# I have this always running, start at login.
# version 2.0 - If running RazorEnhanced 7.7.23 or greater use this now, or change line 13 to match

# True for overhead Bandage Available message, false for in system messages
overheadMessage = True

msgcolor = 88
Misc.SetSharedValue('bandageDone', True)
def BandagesApplying():
    # Fetch the Journal entries (oldest to newest)
    regularText = Journal.GetTextByType( 'System' )

    # Reverse the Journal entries so that we read from newest to oldest
    regularText.Reverse()

    # Read back until the bandages were started to see if they have finished applying
    for line in regularText[ 0 : len( regularText ) ]:
        if (line == 'You begin applying the bandages.' or
                line == 'Your hands are still busy applying other bandages.'):
            break
        if ( line == 'You finish applying the bandages.' or
                line == 'You heal what little damage your patient had.' or
                line == 'You apply the bandages, but they barely help.' or
                line == 'That being is not damaged!' or
                line == 'You have cured the target of all poisons!' or
                line == 'You are unable to resurrect your patient.' or 
                line == 'You are able to resurrect your patient' or
                line == 'You are able to resurrect the creature.' or
                line == 'You fail to resurrect the creature.' or
                line == 'You did not stay close enough to heal your patient!'):
            return False
    return True


def WaitForBandagesToApply():
    Misc.SetSharedValue('bandageDone', False)
    #bandageDone = False
    secondsCounter = 0
    while BandagesApplying():
        worldSave()
        Misc.Pause( 1000 )
        secondsCounter += 1
        if overheadMessage:
            Player.HeadMessage( msgcolor, 'Bandage: %is' % ( secondsCounter ) )
        else:
            Player.HeadMessage ( msgcolor, 'Bandage: %is' % ( secondsCounter ) )
        
        if secondsCounter > 18:
            break
            
    if overheadMessage:
        Player.HeadMessage(msgcolor, 'Bandage Available')
    else:
        Misc.SendMessage( 'Bandage Available', msgcolor )
        
    Misc.SetSharedValue('bandageDone', True)
    return

def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'System' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'System'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()    
    
Journal.Clear()
while True:
    if Player.IsGhost:
        # Player died, wait until Player is resurrected
        while Player.IsGhost:
            Misc.Pause( 100 )
    if Journal.Search('You begin applying the bandages.'):
        WaitForBandagesToApply()
        Journal.Clear()
    Misc.Pause( 50 )
<file_sep># in dress agent create one that is your player name
# without spaces and a 2 at the end.
# Example: "Player Name" needs to be playername2

msgcolor = 62
wep2 = Player.Name.lower().replace(' ', '') + '2'

Player.HeadMessage(msgcolor, "Weapon 2")
Dress.ChangeList(wep2)
Dress.DressFStart()
<file_sep>Player.ChatSay(5, "Back Left")<file_sep># use this to dye all items inside a container (I use to dye armor)

dyeTub = Target.PromptTarget( 'Target dye tub' )
container = Items.FindBySerial( Target.PromptTarget( 'Target Container with armor' ) )

for i in container.Contains:
    Items.UseItem(dyeTub)
    Target.WaitForTarget(1500)
    Target.TargetExecute(i)
    Misc.Pause(550)<file_sep># Automatic Potion Butler Filler by MatsaMilla 
#   - Version 4, updated 4/3/22 (Includes DP now)

# Must have TOOLTIPSON ([toggletooltips in game to turn off/on)

# NEED: Restock Chest (containing regs / empty pots), 
#       Mortars in backpack or in restock chest (can be in a bag in restock chest, has to be open).
#       Empty keg in toons backpack.

# Makes Make sure restock chest & motar restock bags are open

#mark false to NOT fill DP
fillDeadlyPoison = False

#*******************************************************************#

Player.HeadMessage(66,'Target Butler')
butler = Target.PromptTarget('Target Butler')
Player.HeadMessage(66,'Target Restock Chest')
restockChest = Items.FindBySerial( Target.PromptTarget('Target Restock Chest') )
#Player.HeadMessage(66,'Mortar Restock Bag (optional)')
#mortarBag = Items.FindBySerial( Target.PromptTarget('Mortar Restock Bag (optional)') )

import sys
        
keg = Items.FindByID( 0x1940 , -1 ,  Player.Backpack.Serial )
if keg:
    Misc.SendMessage('Using keg in pack', 66)
else:
    Player.HeadMessage(66,'Target keg to fill')
    kegTarget =  Target.PromptTarget('Target keg to fill')
    Misc.SendMessage('Using targeted Keg', 66)
    keg = Items.FindBySerial(kegTarget)

fillStopNumber = 5000
dragTime = 800
butlerGump = 989312372

def setValues( regValue , potValue , gump1 , gump2 ):
    global regID
    global potID
    global gumpAction1
    global gumpAction2
    regID = regValue
    potID = potValue
    gumpAction1 = gump1
    gumpAction2 = gump2


def FindItem( itemID, container, color = -1, ignoreContainer = [] ):
    '''
    Searches through the container for the item IDs specified and returns the first one found
    Also searches through any subcontainers, which Misc.FindByID() does not
    '''
    ignoreColor = False
    if color == -1:
        ignoreColor = True

    if isinstance( itemID, int ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID == itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    elif isinstance( itemID, list ):
        foundItem = next( ( item for item in container.Contains if ( item.ItemID in itemID and ( ignoreColor or item.Hue == color ) ) ), None )
    else:
        raise ValueError( 'Unknown argument type for itemID passed to FindItem().', itemID, container )

    if foundItem != None:
        return foundItem

    subcontainers = [ item for item in container.Contains if ( item.IsContainer and not item.Serial in ignoreContainer ) ]
    for subcontainer in subcontainers:
        foundItem = FindItem( itemID, subcontainer, color, ignoreContainer )
        if foundItem != None:
            return foundItem
            
def craftPot (potType):
    
    # set values for pot items
    if potType == 'cure':
        setValues( 0x0F84 , 0x0F07 , 43 , 16 )
    elif potType == 'heal':
        setValues( 0x0F85, 0x0F0C , 22 , 16 )
    elif potType == 'refresh':
        setValues ( 0x0F7A , 0x0F0B , 1 , 9 )
    elif potType == 'explode':
        setValues ( 0x0F8C, 0x0F0D , 50 , 16 )
    elif potType == 'strength':
        setValues ( 0x0F86 , 0x0F09 , 29 , 9 )
    elif potType == 'agility':
        setValues ( 0x0F7B, 0x0F08 , 8 , 9 )
    elif potType == 'DP':
        setValues ( 0x0F88 , 0x0F0A , 36 , 23 )
    else:
        Misc.SendMessage('potType not defined, stopping', 33)
        sys.exit()
    
    while not Items.GetPropValue(keg,'The Keg Is Completely Full.'): 
    #while not Journal.SearchByType('The keg will not hold any more!', 'System'): # non-tool tips change
        
        worldSave()
        
        # find mortar, even if nested in backpack
        mortar = FindItem( 0x0E9B , Player.Backpack )
        if not mortar:
            mortarFound = FindItem( 0x0E9B , restockChest )#Items.FindByID(0x0E9B , -1 , mortarBag)
            if mortarFound:
                Items.Move(mortarFound, Player.Backpack.Serial, 0)
                Misc.Pause(dragTime)
            else:
                Misc.SendMessage('Out of Mortars!', 33)
                Misc.Pause(5000)
                sys.exit()
         
        # count / restock reg type
        packRegs = FindItem(regID, Player.Backpack)
        if not packRegs or packRegs.Amount < 10:
        #if Items.BackpackCount(regID) < 10:
            Misc.Pause(100)
            regFound = FindItem(regID, restockChest) #Items.FindByID( regID, -1, restockChest)
            if regFound:
                Items.WaitForProps( regFound.Serial , dragTime)
                Items.Move( regFound, Player.Backpack , 250 )
                Misc.Pause(800)
                packRegs = FindItem(regID, Player.Backpack)
                if not packRegs or packRegs.Amount < 10:
                #if Items.BackpackCount(regID) < 10:
                    Misc.NoOperation()
                    #Misc.SendMessage('Out of regs for this pot type, moving to next pot - 1', 33)
                    break
            else:
                Misc.SendMessage('Out of regs for this pot type, moving to next pot', 33)
                return False
            
        # move pot to keg  
        pot = FindItem( potID , Player.Backpack)
        while pot:
            Items.Move(pot, keg, 0)
            Misc.Pause(dragTime)
            pot = FindItem( potID , Player.Backpack)
            if Journal.SearchByType('The keg will not hold any more!', 'System'):
                break
        
        # make sure you have empty bottle
        if Items.BackpackCount(0x0F0E) < 1:
            emptyPot = FindItem(0x0F0E,restockChest) #Items.FindByID( 0x0F0E, -1, restockChest)
            if emptyPot:
                Items.Move(emptyPot, Player.Backpack.Serial, 2)
                Misc.Pause(dragTime)
            else:
                Player.HeadMessage(33,'Need empty pot(s) in restock container or in backpack.')
                sys.exit()
        # empty keg of other potion
        if Journal.Search('You decide that it would be a bad idea to mix different types of potions.'):
            Misc.SendMessage('Oops')
            Items.Move( keg , butler , 0 )
            Misc.Pause(dragTime)
            Journal.Clear()
            
        #craft pot
        Items.UseItem(mortar)
        Gumps.WaitForGump(949095101, dragTime)
        Gumps.SendAction(949095101, gumpAction1)
        Gumps.WaitForGump(949095101, dragTime)
        Gumps.SendAction(949095101, gumpAction2)
        Gumps.WaitForGump(949095101, dragTime)
        Misc.Pause(120)
        #check keg level
        Items.WaitForProps(keg, dragTime)
    
    # move keg to butler
    Items.Move( keg , butler , 0 )
    Misc.Pause(dragTime)
    Journal.Clear()
    
def worldSave():
    if Journal.SearchByType('The world is saving, please wait.', 'Regular' ):
#    if Journal.SearchByType('The world will save in 1 minute.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(1000)
        Misc.SendMessage('Continuing', 33)
        Journal.Clear()
    
Journal.Clear()
Misc.Pause(1000)
Mobiles.UseMobile(butler)
Misc.Pause(1000)
    
if Gumps.LastGumpTextExist( 'Remove Leather Tub?' ):
    Misc.SendMessage('Leather Tub Detected')
    fillList = [('cure',37),('agility',38),('strength',39),('DP',40),('refresh',41),('heal',42),('explode',43)]
else:
    fillList = [('cure',35),('agility',36),('strength',37),('DP',38),('refresh',39),('heal',40),('explode',41)]

while True:
    # verify its butler gump
    if Gumps.CurrentGump() == butlerGump:
        # iterate through fillList
        for i in fillList:
            # read gump line
            fillNumber = fillStopNumber - int(float(Gumps.LastGumpGetLine(i[1])))
            while fillNumber > 100: #int(float(Gumps.LastGumpGetLine(i[1]))) < fillStopNumber:
                if str(i[0]) == 'DP' and fillDeadlyPoison == False:
                    break
                Gumps.CloseGump(butlerGump)
                Misc.SendMessage('Filling ' + str(i[0])+ ', ' + str(fillNumber) + ' left', 66)
                Misc.Pause(dragTime)
                craftPot (i[0])
                Mobiles.UseMobile(butler)
                Misc.Pause(dragTime)
                fillNumber = fillStopNumber - int(float(Gumps.LastGumpGetLine(i[1])))
        Misc.SendMessage('Butler is as full as we can get it!', 66)
        Gumps.CloseGump(butlerGump)
        sys.exit()
    else:
        Mobiles.UseMobile(butler)
        Misc.Pause(dragTime)
<file_sep># ButlerProfiles.py by MatsaMilla - 2 part script, part 1 is ButlerHelper.py
# updated 4/2/22 - new field: Misc.SetSharedValue('deadlypoison', 0)  

# You need to set up a "profile" for each toon based on name
# see examples below
# Note - armor (0 = no, 1 = yes) (all but cap)
#        cap (0 = no, 1 = yes)   (cap only)
# If upgrading, add this line to your profiles to take a cap: Misc.SetSharedValue('cap', 1)

#makes player name lowercase with no spaces.... if name of toon is <NAME>, makes it matsamilla
name = Player.Name.lower().replace(' ', '')

if name == 'matsamilla': #Replace matsamilla with toon name, no caps or spaces
    Misc.SendMessage('Loading: ' + name)
    Misc.SetSharedValue('moss', 75)
    Misc.SetSharedValue('ash', 75)
    Misc.SetSharedValue('root', 75)
    Misc.SetSharedValue('pearl', 75)
    Misc.SetSharedValue('shade', 75)
    Misc.SetSharedValue('ginseng', 75)
    Misc.SetSharedValue('garlic', 75)
    Misc.SetSharedValue('silk', 75)
    Misc.SetSharedValue('bandies', 50)
    Misc.SetSharedValue('exp', 10)
    Misc.SetSharedValue('str', 10)
    Misc.SetSharedValue('refresh', 20)
    Misc.SetSharedValue('agil', 10)
    Misc.SetSharedValue('heal', 15)
    Misc.SetSharedValue('cure', 10)
    Misc.SetSharedValue('arrows', 0)
    Misc.SetSharedValue('bolts', 0)  
    Misc.SetSharedValue('armor', 1)
    Misc.SetSharedValue('cap', 1)
    Misc.SetSharedValue('deadlypoison', 0)  
#******************
# copy, paste and edit as many as this next section as you need for toons
elif name == 'playername': #Replace playername with toon name, no caps or spaces
    Misc.SendMessage('Loading: ' + name)
    Misc.SetSharedValue('moss', 0)
    Misc.SetSharedValue('ash', 0)
    Misc.SetSharedValue('root', 0)
    Misc.SetSharedValue('pearl', 0)
    Misc.SetSharedValue('shade', 0)
    Misc.SetSharedValue('ginseng', 0)
    Misc.SetSharedValue('garlic', 0)
    Misc.SetSharedValue('silk', 0)
    Misc.SetSharedValue('bandies', 100)
    Misc.SetSharedValue('exp', 0)
    Misc.SetSharedValue('str', 10)
    Misc.SetSharedValue('refresh', 20)
    Misc.SetSharedValue('agil', 10)
    Misc.SetSharedValue('heal', 10)
    Misc.SetSharedValue('cure', 10)
    Misc.SetSharedValue('arrows', 0)
    Misc.SetSharedValue('bolts', 0)  
    Misc.SetSharedValue('armor', 0)   
    Misc.SetSharedValue('cap', 0)
    Misc.SetSharedValue('deadlypoison', 0)  
    
#******************

Misc.ScriptRun('ButlerHelper.py')
<file_sep>Player.ChatSay(5, "Back One")<file_sep>Player.ChatSay(5, "Back Right")<file_sep># Toggle alternate wep by MatsaMilla
# Updated 7/16/21

leftHand = Player.GetItemOnLayer('LeftHand')
rightHand = Player.GetItemOnLayer('RightHand')
shields = [ 0x1B76,0x1B74,0x1B7B,0x1B73,0x1B72,0x1B79,0x1B7A ]

if Misc.CheckSharedValue(Player.Name + 'wep2'):
    tempwep = Items.FindBySerial(Misc.ReadSharedValue(Player.Name + 'wep2'))
    if tempwep:
        wep = tempwep
    else:
        Player.HeadMessage(66,'Target New Wep')
        wep = Items.FindBySerial( Target.PromptTarget() )
        Misc.SetSharedValue(Player.Name + 'wep2', wep.Serial)
        Player.HeadMessage(66, 'Wep Set')
else:
    Player.HeadMessage(66,'Target Wep')
    wep = Items.FindBySerial( Target.PromptTarget() )
    Misc.SetSharedValue(Player.Name + 'wep2', wep.Serial)
    Player.HeadMessage(66, 'Wep Set')
    
def toggleWep():
    if wep.IsTwoHanded:
        Misc.SendMessage('Two Handed')
        if rightHand:
            Items.Move(rightHand.Serial,Player.Backpack.Serial,0)
            Misc.Pause(600)
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
                Misc.Pause(600)
            else:
                Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        else:
            Player.EquipItem(wep)
            
    elif wep.ItemID in shields:
        Misc.SendMessage('Shield')
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
            else:
                Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        else:
            Player.EquipItem(wep) 
        
        
    else:
        if rightHand:
            if rightHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
            else:
                Items.Move(rightHand,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
                
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
            elif leftHand.ItemID in shields:
                Player.EquipItem(wep)
            else:                
                Items.Move(leftHand,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        
        else:
            Player.EquipItem(wep)
        
toggleWep()
<file_sep>Player.ChatSay(5, "Forward Right")<file_sep>Player.ChatSay(5, "Drop Anchor")
Misc.Pause(400)
Player.ChatSay(5, "Disembark")<file_sep># Weapon Swapper by Matsamilla
# Swaps between weps you target, last targeted is first equipted
# if only one weapon targeted, acts as a wep toggle.

# Version 3.1, updated 7/16/21

leftHand = Player.GetItemOnLayer('LeftHand')
rightHand = Player.GetItemOnLayer('RightHand')
shields = [ 0x1B76,0x1B74,0x1B7B,0x1B73,0x1B72,0x1B79,0x1B7A ]

def setWeps(text, multiple=True):
    Player.HeadMessage(76,text)
    list = []
    if multiple: 
        while multiple:
            chosenid = Target.PromptTarget()
            if chosenid > -1:
               chosen = Items.FindBySerial(chosenid)
               Misc.Pause(500)
               list.append(chosen.Serial)
            else:
               multiple = False
               if len(list) == 1:
                   return chosen
               else:
                   return list
    else:
        chosenid = Target.PromptTarget()
        if chosenid > -1:
           chosen = Items.FindBySerial(chosenid)
           Misc.Pause(500)
           Misc.SendMessage("Chose {}".format(chosen.Name))
           return chosenid
               
def swampWeps():
    for i in mainWeplist:
        if Items.FindBySerial(i) == None:
            Player.HeadMessage(33, 'Set New Weps')
            Misc.RemoveSharedValue(Player.Name + 'weplist')
            Misc.RemoveSharedValue(Player.Name + 'mainWeplist')
            checkList()
            break
        
    # set weps to temp list
    if Misc.CheckSharedValue(Player.Name + 'weplist'):
        weplist = Misc.ReadSharedValue(Player.Name + 'weplist')
    else:
        weplist =[]
        for i in mainWeplist:
            weplist.append(i)
        Misc.SetSharedValue(Player.Name + 'weplist', weplist)

    # get last list position
    lastPos = len(weplist) -1

    # equip next wep in list
    #currentWep = Items.FindBySerial(currentWep)
    
    wep = Items.FindBySerial(weplist[lastPos])
    
    if wep.IsTwoHanded:
        Misc.SendMessage('Two Handed')
        if rightHand:
            Items.Move(rightHand.Serial,Player.Backpack.Serial,0)
            Misc.Pause(600)
        if leftHand:
            Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
            Misc.Pause(600)
            Player.EquipItem(wep)
        else:
            Player.EquipItem(wep)
            
    elif wep.ItemID in shields:
        Misc.SendMessage('Shield')
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
            else:
                Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        else:
            Player.EquipItem(wep) 
        
        
    else:
        if rightHand:
            Misc.SendMessage('disarming right')
            Items.Move(rightHand,Player.Backpack.Serial,0)
            Misc.Pause(600)
            Player.EquipItem(wep)
            # delete last equipt wep from temp list
            weplist.pop()
            if not weplist:
                Misc.RemoveSharedValue(Player.Name + 'weplist')
            else:
                weplist = Misc.ReadSharedValue(Player.Name + 'weplist')
            return
                
        if leftHand:
            Misc.SendMessage('disarming left')
            if leftHand.ItemID in shields:
                Player.EquipItem(wep)
                
            else:                
                Items.Move(leftHand,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        
        else:
            Player.EquipItem(wep)

    # delete last equipt wep from temp list
    weplist.pop()
    if not weplist:
        Misc.RemoveSharedValue(Player.Name + 'weplist')
    else:
        weplist = Misc.ReadSharedValue(Player.Name + 'weplist')
        
def toggleWep():
    if wep.IsTwoHanded:
        Misc.SendMessage('Two Handed')
        if rightHand:
            Items.Move(rightHand.Serial,Player.Backpack.Serial,0)
            Misc.Pause(600)
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
                Misc.Pause(600)
            else:
                Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        else:
            Player.EquipItem(wep)
            
    elif wep.ItemID in shields:
        Misc.SendMessage('Shield')
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
            else:
                Items.Move(leftHand.Serial,Player.Backpack.Serial,0)
                Misc.Pause(600)
                Player.EquipItem(wep)
        else:
            Player.EquipItem(wep) 
        
        
    else:
        if rightHand:
            if rightHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
                return
                
        if leftHand:
            if leftHand.Serial == wep.Serial:
                Items.Move(wep,Player.Backpack.Serial,0)
                return
            elif leftHand.ItemID in shields:
                Player.EquipItem(wep)
        
        else:
            Player.EquipItem(wep)
        
# check to see if weps are saved
def checkList():
    global mainWeplist
    global wep
    if Misc.CheckSharedValue(Player.Name + 'singlewep'):
        tempwep = Items.FindBySerial(Misc.ReadSharedValue(Player.Name + 'singlewep'))
        if tempwep:
            wep = tempwep
        else:
            Misc.RemoveSharedValue(Player.Name + 'singlewep')
            checkList()
            
    elif Misc.CheckSharedValue(Player.Name + 'mainWeplist') == False:
        mainWeplist = setWeps("Target Wep(s), then cancel target.")
        if isinstance(mainWeplist, list):
            Misc.SetSharedValue(Player.Name + 'mainWeplist', mainWeplist)
        else:
            Misc.SetSharedValue(Player.Name + 'singlewep', mainWeplist.Serial)
            wep = mainWeplist
        Misc.Pause(600)
    else:
        mainWeplist = Misc.ReadSharedValue(Player.Name + 'mainWeplist')

try:
    checkList()

    if isinstance(mainWeplist, list):
        Misc.SendMessage('Swap Wep', 33)
        swampWeps()
    else:
        Misc.SendMessage('Toggle Wep', 33)
        toggleWep()
except:
    Misc.RemoveSharedValue(Player.Name + 'mainWeplist')
    Misc.RemoveSharedValue(Player.Name + 'singlewep')
    Misc.RemoveSharedValue(Player.Name + 'weplist')
    Player.HeadMessage(33, 'Something went wrong, reset weps')
<file_sep># Explode pot 1 key executer.
# hit once to arm
# hit again to toss at last target

# true to cancel target after arming
cancelTarget = False

msgcolor = 53
fakeTarget = 0x00000
lastTarget = Target.GetLast()

import sys
            
def potArmOrThrow():
    # tosses pot if has been charging
    if Timer.Check( 'ex' + Player.Name ) == True:
        Player.HeadMessage( msgcolor, 'Tossing' )
        usePot()
        Target.WaitForTarget(1500)
        Target.TargetExecute(lastTarget)
        Timer.Create( 'ex' + Player.Name , 1)

    # starts charging pot 
    else:
        usePot()
        Timer.Create( 'ex' + Player.Name , 4500)
        if cancelTarget:
            Target.Cancel()
    
def usePot():
    if Misc.ShardName() == "Ultima Forever":
        drinkPot()
    else:
        usePotType()
    
def drinkPot():
    Player.ChatSay(msgcolor, '[drink GreaterExplosionPotion')
    Misc.Pause(120)
    if Journal.Search( 'You do not have any of those potions.'):
        Player.HeadMessage(msgcolor, 'Out of Exp Pots')
        sys.exit()
    elif Journal.Search('You must wait a moment before using another explosion potion'):
        Misc.NoOperation()
        
def usePotType():
    pot = Items.FindByID(0x0F0D,0,Player.Backpack.Serial,True)
    if pot:
        Items.UseItem(pot)
    else:
        Player.HeadMessage(33, "No Explode pots!")

Journal.Clear()
potArmOrThrow()
<file_sep>Player.ChatSay(5, "Backwards")<file_sep>leftHand = Player.GetItemOnLayer('LeftHand')
chugtime = 650
msgColor = 66
noBow = True
bows = [ 0x13B2,0x26C2,0x0F50,0x13FD,0x0A12,0x0F6B] # 0x0A12,0x0F6B = torch

if not leftHand:
    noBow = True
elif leftHand.ItemID in bows:
    noBow = False
elif leftHand:
    noBow = True
    
def potDrink():
    if leftHand and noBow:
        Player.UnEquipItemByLayer('LeftHand')
        Misc.Pause(650)
        Player.ChatSay( 1 , '[drink greaterStrengthPotion')
        Misc.Pause(100)
        if Journal.Search( 'You do not have any of those potions.'):
            Player.HeadMessage(msgColor, "No Strength pots!")
        Misc.Pause(chugtime)
        Player.EquipItem(leftHand)
        Misc.Pause(50)
    else:
        Player.ChatSay( 1 , '[drink greaterStrengthPotion')
        Misc.Pause(100)
        if Journal.Search( 'You do not have any of those potions.'):
            Player.HeadMessage(msgColor, "No Strength pots!")
        else:
            Misc.NoOperation()
        
def usePot():
    pot = Items.FindByID(0x0F09,0,Player.Backpack.Serial,True)
    if pot:
        if leftHand and noBow:
            Player.UnEquipItemByLayer('LeftHand')
            Misc.Pause(chugtime)
            Items.UseItem(pot)
            Misc.Pause(chugtime)
            Player.EquipItem(leftHand)
            Misc.Pause(50)
        else:
            Items.UseItem(pot)
    else:
        Player.HeadMessage(msgColor, "No Strength pots!")
            
        
if Misc.ShardName() == "Ultima Forever" or Misc.ShardName() == "UOForever":
    potDrink()
else:
    usePot()
<file_sep>#frombook = 0x43909128
frombook =0x43909128 #dehued normal book in bag
lbodstorage = 0x4083CF0E
lbodstorage2 = 0x45E3CA15
fullbod = [ 0x41660840  , 0x43908F54  ] #chest first, book second
nomatchstorage = 0x41113188

bonestorage = 0x43E08982
#leatherstorage= 0x4391DCB4 #leather keeper 1
leatherstorage= 0x43647AB7



garbagebox = 0x4009C22A #temporary 


deed = 0x14EF
tinktool = 0x1EB8
sewtool = 0x0F9D
restockchest = 0x405183AA
cloth = 0x1766
leather = 0x1081 #no color so it randomly pics a quality
ingot = 0x1BF2
trash = 0x403C2A3E
bone = 0x0F7E

barbedcolor= 0x059d
spinecolor= 0x05e4
hornedcolor= 0x0900
leathercolor = 0x0000




def worldSave():
    if Journal.SearchByType('The world will save in 1 minute.', 'Regular' ):
        Misc.SendMessage('Pausing for world save', 33)
        while not Journal.SearchByType('World save complete.', 'Regular'):
            Misc.Pause(500)
        Misc.Pause(2500)
        Misc.SendMessage('Continuing run', 33)
        Journal.Clear()  
        
def checktools():
    if Items.BackpackCount(tinktool , -1) < 3:
        Misc.SendMessage('Out of Tink Tools',33)
        craftTink()
    Misc.Pause(1000)    
    if Items.BackpackCount(sewtool , -1) < 3:
        Misc.SendMessage('Out of sewtool',33)
        craftsewtool()
        
def craftTink():    
    UseTinkTool = Items.FindByID(tinktool, -1, Player.Backpack.Serial)
    Items.UseItem(UseTinkTool.Serial)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, 8)
    Gumps.WaitForGump(949095101, 1500)
    Gumps.SendAction(949095101, 23)
    Misc.Pause(2000)
        
        
def craftsewtool():
    UseTinkTool = Items.FindByID(tinktool, -1, Player.Backpack.Serial)
    Items.UseItem(UseTinkTool.Serial)
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, 8)
    Gumps.WaitForGump(949095101, 10000)
    Gumps.SendAction(949095101, 44)
    Gumps.WaitForGump(949095101, 10000)
    Misc.Pause(2000)
    Gumps.SendAction(949095101, 0)    

def setsemat(material):
    
    if material == barbedcolor:
        UseTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial)
        Items.UseItem(UseTool.Serial)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 7)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 27)
    if material == hornedcolor:
        UseTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial)
        Items.UseItem(UseTool.Serial)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 7)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 20)
    if material == spinecolor:
        UseTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial)
        Items.UseItem(UseTool.Serial)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 7)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 13)
    if material == "-1":
        UseTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial)
        Items.UseItem(UseTool.Serial)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 7)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 6)
    if material == -1:
        UseTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial)
        Items.UseItem(UseTool.Serial)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 7)
        Misc.Pause(500)
        Gumps.SendAction(949095101, 6)


    
def unstock():
    while Items.FindByID(bone,-1, Player.Backpack.Serial):
        moveitem = Items.FindByID(bone,-1, Player.Backpack.Serial)
        Items.Move(moveitem, restockchest, 0)
        Misc.Pause(750)        
    while Items.FindByID(leather,-1, Player.Backpack.Serial):
        moveitem = Items.FindByID(leather,-1, Player.Backpack.Serial)
        Items.Move(moveitem, restockchest, 0)
        Misc.Pause(750)    
    while Items.FindByID(cloth,-1, Player.Backpack.Serial):
        moveitem = Items.FindByID(cloth,-1, Player.Backpack.Serial)
        Items.Move(moveitem, restockchest, 0)
        Misc.Pause(750) 
    
        
def checkrestock(materialtype, color): #loads crafting stuff
    if materialtype == "cloth":
        material = cloth
    elif color == barbedcolor:
        material = leather
    elif color == hornedcolor:
        material = leather    
    elif color == spinecolor:
        material = leather    
    elif color == -1:
        material = leather
        color = leathercolor
    Player.HeadMessage(54, str(materialtype))
    Player.HeadMessage(54, str(color))
    x = Items.BackpackCount(material, color)
    Player.HeadMessage(54, "Material Count" + str(x))
    if materialtype == "bone":
        if Items.BackpackCount(bone, -1) < 15:
            Items.UseItem(restockchest)
            Misc.Pause(500)       
            if Items.FindByID(bone, -1, restockchest):
                targetitem = Items.FindByID(bone, -1, restockchest)
                Items.Move(targetitem, Player.Backpack.Serial , 30)
                Misc.Pause(1000)
        if Items.BackpackCount(leather, color) < 20:
            if Items.FindByID(leather, color, restockchest):
                targetitem = Items.FindByID(leather, color, restockchest)
                Items.Move(targetitem, Player.Backpack.Serial , 75)
                Misc.Pause(1000)
        
    
    if Items.BackpackCount(material, color) < 25:
        Items.UseItem(restockchest)
        Misc.Pause(1000)       
        if Items.FindByID(material, color, restockchest):
            targetitem = Items.FindByID(material, color, restockchest)
            Items.Move(targetitem, Player.Backpack.Serial , 100)
            Misc.Pause(1000)
    if Items.BackpackCount(ingot, -1) < 10:
        Items.UseItem(restockchest)
        Misc.Pause(1000)       
        if Items.FindByID(ingot, -1, restockchest):
            targetitem = Items.FindByID(ingot, -1, restockchest)
            Items.Move(targetitem, Player.Backpack.Serial , 50)
            Misc.Pause(1000)    

def catagorylogic(bod): #working
    #Hats is first gump 1
    #shirts is first gump 8
    #pants is gump 15
    #misc is gump 22
    #footware is 29
        
    x = Items.GetPropStringList(bod)
           
######## HATS ################    
    if "doublet: 0" in x:
        return [8,2,"cloth"];
    if "shirt: 0" in x:
        return [8,9,"cloth"];
    if "fancy shirt: 0" in x:
        return [8,16,"cloth"];        
    if "tunic: 0" in x:
        return [8,23,"cloth"];        
    if "surcoat: 0" in x:
        return [8,30,"cloth"];          
    if "plain dress: 0" in x:
        return [8,37,"cloth"];
    if "fancy dress: 0" in x:
        return [8,44,"cloth"];
    if "cloak: 0" in x:
        return [8,51,"cloth"];        
    if "robe: 0" in x:
        return [8,58,"cloth"];
    if "jester suit: 0" in x:
        return [8,65,"cloth"];        
        
 
 ######## shirts ################    
    if "skullcap: 0" in x:
        return [1,2,"cloth"];
    if "bandana: 0" in x:
        return [1,9,"cloth"];
    if "floppy hat: 0" in x:
        return [1,16,"cloth"];        
    if "cap: 0" in x:
        return [1,23,"cloth"];        
    if "wide-brim hat: 0" in x:
        return [1,30,"cloth"];          
    if "straw hat: 0" in x:
        return [1,37,"cloth"];
    if "tall straw hat: 0" in x:
        return [1,44,"cloth"];
    if "wizard's hat: 0" in x:
        return [1,51,"cloth"];        
    if "bonnet: 0" in x:
        return [1,58,"cloth"];
    if "feathered hat: 0" in x:
        return [1,65,"cloth"];        
    if "tricorne hat: 0" in x:
        return [1,72,"cloth"];        
    if "jester hat: 0" in x:
        return [1,79,"cloth"];        
 
######## pants ################    
    if "short pants: 0" in x:
        return [15,2,"cloth"];
    if "long pants: 0" in x:
        return [15,9,"cloth"];
    if "kilt: 0" in x:
        return [15,16,"cloth"];        
    if "skirt: 0" in x:
        return [15,23,"cloth"];  

######## Misc ################    
    if "body sash: 0" in x:
        return [22,2,"cloth"];
    if "half apron: 0" in x:
        return [22,9,"cloth"];
    if "full apron: 0" in x:
        return [22,16,"cloth"];        
    if "oil cloth: 0" in x:
        return [22,23,"cloth"];   

 ######## FOOTWARE ################    
    if "sandals: 0" in x:
        return [29,2,"leather"];
    if "shoes: 0" in x:
        return [29,9,"leather"];
    if "boots: 0" in x:
        return [29,16,"leather"];        
    if "thigh boots: 0" in x:
        return [29,23,"leather"]; 
     
######## Leather ################          
    if "leather gorget: 0" in x:
        return [36,2,"leather"];
    if "leather cap: 0" in x:
        return [36,9,"leather"];
    if "leather gloves: 0" in x:
        return [36,16,"leather"];        
    if "leather sleeves: 0" in x:
        return [36,23,"leather"];        
    if "leather leggings: 0" in x:
        return [36,30,"leather"];          
    if "leather tunic: 0" in x:
        return [36,37,"leather"]; 

######## Studded Leather ################          
    if "studded gorget: 0" in x:
        return [43,2,"leather"];
    if "studded cap: 0" in x:
        return [43,9,"leather"];
    if "studded gloves: 0" in x:
        return [43,16,"leather"];        
    if "studded sleeves: 0" in x:
        return [43,23,"leather"];        
    if "studded leggings: 0" in x:
        return [43,30,"leather"];          
    if "studded tunic: 0" in x:
        return [43,37,"leather"];  

######## Female Leather ################          
    if "leather shorts: 0" in x:
        return [50,2,"leather"];
    if "leather skirt: 0" in x:
        return [50,9,"leather"];
    if "leather bustier: 0" in x:
        return [50,16,"leather"];        
    if "studded bustier: 0" in x:
        return [50,23,"leather"];        
    if "female leather armor: 0" in x:
        return [50,30,"leather"];          
    if "studded armor: 0" in x:
        return [50,37,"leather"];  

######## Bone Leather ################          
    if "bone helmet: 0" in x:
        return [57,2,"bone"];
    if "bone gloves: 0" in x:
        return [57,9,"bone"];
    if "bone arms: 0" in x:
        return [57,16,"bone"];        
    if "bone leggings: 0" in x:
        return [57,23,"bone"];        
    if "bone armor: 0" in x:
        return [57,30,"bone"];          
    if "orc helm: 0" in x:
        return [57,37,"bone"];  



def bagindexing():
    inventory = []
    for item in Player.Backpack.Contains: 
        inventory.append(item.Serial)
        Misc.Pause(5)
    return inventory    

def findnewitem(inv): #works but the string is weird if you print it. 
        for item in Player.Backpack.Contains:
            if item.Serial not in inv:
                return item.Serial



def craftitems(bod):
    
    count = 0
    bodarray = [0,0,0,0,0]
    checkbod = analsbod(bod) #grabs array of bod info 
    
    bodarray[0] = bod
    temp = catagorylogic(bodarray[0])

        
    while checkbod[3] == False: #checkbod[3] is true if full and false if not full
        
        bodarray [1] = temp[0]
        bodarray [2] = temp[1]
        bodarray [3] = temp[2] 
        bodarray [4] = checkbod[1]        
            
        worldSave()
        checktools()
        Player.HeadMessage(54, "Crafting Items")
        if str(bodarray[4]) == "barbed":
            material = barbedcolor
        elif str(bodarray[4]) == "spined":
            material = spinecolor
        elif str(bodarray[4]) == "horned":
            material = hornedcolor           
        else:
            material = -1
        
        setsemat(material)
        checkrestock(bodarray[3],material)

        inventory = bagindexing()        
        UseSewTool = Items.FindByID(sewtool, -1, Player.Backpack.Serial) 
        Items.UseItem(UseSewTool.Serial)
        Misc.Pause(250)    
        Gumps.WaitForGump(949095101, 10000)
        Gumps.SendAction(949095101, bodarray[1])
        Gumps.WaitForGump(949095101, 10000)
        Gumps.SendAction(949095101, bodarray[2])
        Misc.Pause(2000)  
        item = findnewitem(inventory)
        if item != None:
            Journal.Clear()
            Items.SingleClick(item)
            Misc.Pause(800)
            if Journal.Search("Exceptional"):
                Player.HeadMessage(54, "good")
                Items.UseItem(bodarray[0])
                Misc.Pause(750)
                Gumps.SendAction(1526454082, 2)
                Misc.Pause(750)
                Target.TargetExecute(item)
                Misc.Pause(750)
                count = count + 1
            else:
                Player.HeadMessage(54, "bad") 
                scissors = Items.FindByID(0x0F9F, -1, Player.Backpack.Serial)
                Items.UseItem(scissors.Serial)
                Misc.Pause(500)
                Target.TargetExecute(item)
                Misc.Pause(1000)
                if Journal.Search("Scissors cannot be used"):
                    Items.Move(item, trash, 0)
                    Misc.Pause(500)
        checkbod = analsbod(bod)
    unstock()
                    
                    
                    
                    
                    
 ########################################################################################        
 ########################################################################################       
 ########################################################################################
def grabbod():
        
        Items.UseItem(frombook)
        Misc.Pause(1000)
        Gumps.SendAction(1425364447, 5)
        Misc.Pause(1000)
        x = Items.FindByID(0x14EF, 0x0483, Player.Backpack.Serial)
        return x 


        
        
def sortnonmatch(bod): #sorts a bod that doesnt match an Lbod    

    sbod = catagorylogic(bod)
    if sbod[2] == "cloth":    
        craftitems(bod)
        Misc.Pause(500)
        while Items.FindByID(deed, -1, Player.Backpack.Serial):
            Items.UseItem(fullbod[0]) #open Chest
            Misc.Pause(600)
            Items.Move(fullbod[1],Player.Backpack.Serial, 0)
            Misc.Pause(600)
            Items.Move(bod, fullbod[1], 0) #store full bod in chest.
            Misc.Pause(600) 
            Items.Move(fullbod[1],fullbod[0], 0)
            Misc.Pause(600)
    elif sbod[2] == "bone":
        while Items.FindByID(deed, -1, Player.Backpack.Serial):
            Items.UseItem(nomatchstorage) #open Chest
            Misc.Pause(600)
            Items.Move(bonestorage,Player.Backpack.Serial, 0)
            Misc.Pause(600)
            Items.Move(bod, bonestorage, 0) #store full bod in chest.
            Misc.Pause(600) 
            Items.Move(bonestorage,nomatchstorage, 0)
            Misc.Pause(600)    
    elif sbod[2] == "leather":
        while Items.FindByID(deed, -1, Player.Backpack.Serial):
            Items.UseItem(nomatchstorage) #open Chest
            Misc.Pause(600)
            Items.Move(leatherstorage,Player.Backpack.Serial, 0)
            Misc.Pause(600)
            Items.Move(bod, leatherstorage, 0) #store full bod in chest.
            Misc.Pause(600) 
            Items.Move(leatherstorage,nomatchstorage, 0)
            Misc.Pause(600)                
            
            
            
    else:        
        Items.Move(bod, nomatchstorage, 0)
        Player.HeadMessage(54, "No lbod match moving to storage")
          
            
                
def comparebods(bod):
    Items.UseItem(lbodstorage)
    Misc.Pause(600)
    Items.UseItem(lbodstorage2)
    Misc.Pause(600)
    sbod = analsbod(bod)
    lbodstoragecontainer = Items.FindBySerial(lbodstorage)
    lbodstoragecontainer2 = Items.FindBySerial(lbodstorage2)
    Player.HeadMessage(54, "checking 1st container")
    for item in lbodstoragecontainer.Contains: 
        lbod = anallbod(item.Serial)
        if sbod[2] == lbod[2]: #qty 
            if sbod[1] == lbod[1] or lbod[1] == "cloth": #material                   
                for i in range(0, len(lbod)):
                    if str(sbod[4]) == str(lbod[i]):
                        Player.HeadMessage(54, "Mark 4")    
                        craftitems(bod) #fills sbod
                        Misc.Pause(600)
                        #adds it to lbod
                        Items.Move(item, Player.Backpack.Serial, 0)
                        Misc.Pause(600)
                        Items.UseItem(item)
                        Misc.Pause(600)
                        Gumps.SendAction(2703603018, 2)
                        Misc.Pause(600)
                        Target.TargetExecute(bod)
                        Misc.Pause(600)
                        
                        if lbod[1] == "spined" or lbod[1] == "barbed" or lbod[1] == "horned":
                            lbodqty=4
                        else: 
                            lbodqty = 3
                        
                        if len(lbod) == lbodqty:
                            Player.HeadMessage(54, "Lbod Full store in complete")
                            while Items.FindByID(deed, -1, Player.Backpack.Serial):
                                Items.UseItem(fullbod[0]) #open Chest
                                Misc.Pause(600)
                                Items.Move(fullbod[1],Player.Backpack.Serial, 0) #moves book to inventory
                                Misc.Pause(600)
                                Items.Move(item, fullbod[1], 0) #puts bod in book
                                Misc.Pause(600) 
                                Items.Move(fullbod[1],fullbod[0], 0)#store full bod in chest.
                                Misc.Pause(600) 
                                return
                               
                        else: #checks 2nd box
                               
                            Misc.Pause(1000)
                            Items.Move(item, lbodstorage, 0)
                            Misc.Pause(600)
                            return
                            
                        
                        
                        
                        
                            
    Player.HeadMessage(54, "checking 2nd container")
    for item in lbodstoragecontainer2.Contains: 
        lbod = anallbod(item.Serial)
        if sbod[2] == lbod[2]: #qty 
            if sbod[1] == lbod[1] or lbod[1] == "cloth": #material                   
                for i in range(0, len(lbod)):
                    if str(sbod[4]) == str(lbod[i]):
                        Player.HeadMessage(54, "Mark 4")    
                        craftitems(bod) #fills sbod
                        Misc.Pause(600)
                        #adds it to lbod
                        Items.Move(item, Player.Backpack.Serial, 0)
                        Misc.Pause(600)
                        Items.UseItem(item)
                        Misc.Pause(600)
                        Gumps.SendAction(2703603018, 2)
                        Misc.Pause(600)
                        Target.TargetExecute(bod)
                        Misc.Pause(600)
                        
                        if lbod[1] == "spined" or lbod[1] == "barbed" or lbod[1] == "horned":
                            lbodqty=4
                        else: 
                            lbodqty = 3
                        
                        if len(lbod) == lbodqty:
                            Player.HeadMessage(54, "Lbod Full store in complete")
                            while Items.FindByID(deed, -1, Player.Backpack.Serial):
                                Items.UseItem(fullbod[0]) #open Chest
                                Misc.Pause(600)
                                Items.Move(fullbod[1],Player.Backpack.Serial, 0) #moves book to inventory
                                Misc.Pause(600)
                                Items.Move(item, fullbod[1], 0) #puts bod in book
                                Misc.Pause(600) 
                                Items.Move(fullbod[1],fullbod[0], 0)#store full bod in chest.
                                Misc.Pause(600) 
                                return 
                        else: #checks 2nd box
                               
                            Misc.Pause(1000)
                            Items.Move(item, lbodstorage2, 0)
                            Misc.Pause(600)
                            return       
    




  
    


def anallbod(bod): #returns an array of info including only empty sbod info
    result = [0,0,0]
    bodList = Items.GetPropStringList(bod)        
    bodsize = len(bodList) 
    qtyarraynum = 6 #quantity in array slot 6 unless its spined/.barbed then we change to 7
    
    #Player.HeadMessage(54, bodsize) brints msg
      
    if bodList[4] == "small bulk order":
        result[0] = "small"
    else:
        result[0] = "large"
    
        
    if bodList[6].find("barbed")  == -1:
        if bodList[6].find("spined")  == -1:
                if bodList[6].find("horned")  == -1:
                    result[1] = "cloth"
                else:
                    result[1] = "horned"
                    qtyarraynum = 7
        else:
            result[1] = "spined"
            qtyarraynum = 7
        
    else:
        result[1] = "barbed"
        qtyarraynum = 7
    
    
    
        
    if bodList[qtyarraynum].find("20")  == -1:
        if bodList[qtyarraynum].find("15")  == -1:
            result[2] = 10
        else:
            result[2] = 15 
    else:
        result[2] = 20         
    if result[1] == "spined" or result[1] == "barbed" or result[1] == "horned":
        start = 8
    else:
        start = 7
    for i in range(start, bodsize):
        temp = bodList[i]
        #Player.HeadMessage(54, temp)
        #Player.HeadMessage(54, str(i))
        if temp.find(' 0') == -1:
            Misc.Pause(10)
        else:
            temp = temp.replace(":","")
            temp = temp.replace("20","")
            temp = temp.replace("15","")
            temp = temp.replace("10","")
            temp = temp.replace("0","")
            result.append(temp)
    
    return result    


def analsbod(bod):
    result = [0,0,0,0, 0,0,0] #added two zeros to deal with spined leather? 
    bodList = Items.GetPropStringList(bod)
    qtyarraynum = 6
    if bodList[4] == "small bulk order":
        result[0] = "small"
    else:
        result[0] = "large"
        
    if bodList[6].find("barbed")  == -1:
        if bodList[6].find("spined")  == -1:
                if bodList[6].find("horned")  == -1:
                    result[1] = "cloth"
                    fullcheck = 7
                else:
                    result[1] = "horned"
                    qtyarraynum = 7
                    fullcheck = 8
        else:
            result[1] = "spined"
            qtyarraynum = 7
            fullcheck = 8
        
    else:
        result[1] = "barbed"
        qtyarraynum = 7
        fullcheck = 8

        
    if bodList[qtyarraynum].find("20")  == -1:
        if bodList[qtyarraynum].find("15")  == -1:
            result[2] = 10
            
        else:
            result[2] = 15

    else:
        result[2] = 20

        
    if bodList[fullcheck].find(str(result[2]))  == -1:
        result[3] = False
    else:
        result[3] = True
        
    if result[1] == "spined" or result[1] == "barbed" or result[1] == "horned":
        start = 8
    else:
        start = 7    
    Misc.Pause(500)
    temp = bodList[start]
    temp = temp.replace(":","")
    temp = temp.replace("20","")
    temp = temp.replace("15","")
    temp = temp.replace("10","")
    temp = temp.replace("0","")

    result[4] = temp
    

    return result

def testingsmalloutput(bod):
    x = analsbod(bod) 
    Player.HeadMessage(54, str(x)) 
    Player.HeadMessage(54, 'we are making ' + str(x[0])) 
    Player.HeadMessage(54, 'it is ' + x[1]  ) 
    Player.HeadMessage(54, 'we need to make ' + str(x[2])  ) 
    Player.HeadMessage(54, 'is it full '+ str(x[3]) ) 
    Player.HeadMessage(54, 'we making '+ str(x[4]) ) 

def testlbodoutput(bod):
    zz = anallbod(bod)
    Player.HeadMessage(54, '<NAME>')
    Player.HeadMessage(54, str(len(zz)))
    for i in range(0, len(zz)):
        Player.HeadMessage(54, str(zz[i]))  
        
        
def getstringofbod(bod):
        result= ""
        bodList = Items.GetPropStringList(bod)
        for i in range(0, len(bodList)):
            result = result + bodList[i]
            
        result = result.replace("[","")
        result = result.replace("]","")
        result = result.replace("deedBlessed<BASEFONT COLOR=#204018>","")
        result = result.replace("(1155)<BASEFONT COLOR=#FFFFFF>","")
        result = result.replace("Hue: Rusty Green Weight: 1 stone","")
        result = result.replace("a bulk order","")
        result = result + '\n'
        return result
        
def comparetolist(bod, input):
    filepath = 'C:/Users/Jason/PycharmProjects/BodBot/' + input + ".txt"
    f = open(filepath, 'r')        
    allinlist = f.readlines()
    f.close()
  
    #Player.HeadMessage(54, str(len(allinlist)))
    for i in range(0, len(allinlist)):
        #Player.HeadMessage(54, str(allinlist[i]))
        #Player.HeadMessage(54, str(getstringofbod(0x44D90146)))
        if getstringofbod(bod) == allinlist[i]:
            Player.HeadMessage(54, "Match found from list")
            return True
        else:
            Misc.Pause(5)
    return False
            
            



    
def main():

#initializing
    
    isautofill = False
    isgarbage = False
 
    x = Items.GetPropValue(frombook, "Deeds In Book:")
    for z in range(x): #runs all the items in the book
        Misc.Pause(500)
 
    
    #STEP 1: grab bod out of book
    
        Misc.Pause(1000) 
        bod = grabbod()
        Misc.Pause(2500)    
    #STEP 2: analyze for garbage 
        garbbodList = Items.GetPropStringList(bod)
        checkbod = analsbod(bod) #grabs array of bod info specifically for loop if its full sbod
        
        if comparetolist(bod, "garbo"):
            Player.HeadMessage(54, "Found garbage - dumping")
            Items.Move(bod, garbagebox, 0)
            Misc.Pause(1000)
            isgarbage = True
            
           
        elif str(garbbodList[5]) != "All items must be exceptional.":
            Player.HeadMessage(54, "Normal") 
            Items.Move(bod, garbagebox, 0)
            Misc.Pause(1000)
            isgarbage = True    

    #STEP 3: analyze for autocraft   
        
        elif checkbod[3] == True:
            Player.HeadMessage(54, "BODZ FULL LOOKING FOR LBOD")
            comparebods(bod)
            while Items.FindByID(deed, -1, Player.Backpack.Serial):
                Items.UseItem(fullbod[0]) #open Chest
                Misc.Pause(800)
                Items.Move(fullbod[1],Player.Backpack.Serial, 0)
                Misc.Pause(800)
                Items.Move(bod, fullbod[1], 0) #store full bod in chest.
                Misc.Pause(800) 
                Items.Move(fullbod[1],fullbod[0], 0)
                Misc.Pause(800) 
            
        elif comparetolist(bod, "autofill"):
            Player.HeadMessage(54, "Found autofill - filling")
            craftitems(bod)
            Misc.Pause(500)
            while Items.FindByID(deed, -1, Player.Backpack.Serial):
                Items.UseItem(fullbod[0]) #open Chest
                Misc.Pause(600)
                Items.Move(fullbod[1],Player.Backpack.Serial, 0)
                Misc.Pause(600)
                Items.Move(bod, fullbod[1], 0) #store full bod in chest.
                Misc.Pause(600) 
                Items.Move(fullbod[1],fullbod[0], 0)
                Misc.Pause(600) 
            isautofill = True    
    
    
    
    
    #STEP 3: is it small or large
        else:
            x = analsbod(bod)
            if str(x[0]) == "small":
                comparebods(bod)
            else:
                Player.HeadMessage(54, 'found large')
                Items.Move(bod, lbodstorage, 0)
                Misc.Pause(600)

    #Step 4: What do we do if no match?
        Misc.Pause(1000)
        if Items.FindByID(deed, -1, Player.Backpack.Serial):            
            sortnonmatch(bod)    

checktools()            
main()    


#testlbodoutput(0x450C4341)



#testlbodoutput(0x44FBDC4C)

#testingsmalloutput(0x45044849)
