### Initialize Combat System - JavaScript Source: https://context7.com/guicampos/uo-scripts/llms.txt The `system_initialization()` function serves as the main entry point for the combat system. It starts all concurrent script loops for combat modes, spell casting, bandaging, and looting, along with displaying statistics and status bars. ```javascript // Initialize the complete combat system // This starts all combat loops and automation features system_initialization(); // The system will automatically: // - Initialize shared variables and timers // - Start combat mode loop (loop_combat_mode) // - Start auxiliary spells loop (loop_auxspells) // - Start auto bandage self loop (loop_bandage_self) // - Start auto bandage friends loop (loop_bandage_friends) // - Start auto looter loop (loop_auto_looter) // - Start special attacks loop (loop_special_attacks) // - Display statistics gump (showStatistics) // - Display status bar gump (status_bar_show) ``` -------------------------------- ### Voice Command Combat Interface Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt A message-handling system that monitors the journal for specific commands starting with a period. It provides status updates and toggles for various combat configurations like Auto Healing, Evasion, and Auto Looter settings. ```UO-Script if @injournal '.help' characterName[0] @clearjournal sysmsg 'Help for Advanced Combat System with Voice Commands.' 1990 sysmsg 'All commands starts with ".". Available Commands:' 1990 sysmsg '-=|Combat Modes|=-' 1990 sysmsg ' .cmode - switch to the champion mode' 1281 sysmsg ' .ah - Toggles Auto Healing' 1281 sysmsg ' .al - toggles the auto looter feature' 1281 endif ``` -------------------------------- ### Get Water Tiles for UO Gold Panning Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/PanningMarkLargeSpots_v2.orig.txt The `getTiles` function in Python identifies potential gold panning locations in Ultima Online by scanning for specific water tile IDs within a given radius around the player. It returns a list of dictionaries, each containing the coordinates, ID, and distance of a water tile. ```python def getTiles(searchRadius): waterTiles = [ 0x179c, 0x1798, 0x1797, 0x1799, 0x179b, 0x179a, 0xa9, 0xa8, 0xab, 0xaa, 0x17ad] #global tiles for x in range(Engine.Player.X - searchRadius, Engine.Player.X + searchRadius): for y in range(Engine.Player.Y - searchRadius, Engine.Player.Y + searchRadius): statics = Statics.GetStatics(Convert.ChangeType(Engine.Player.Map, int), x, y) #print((statics)) try: for s in statics: if waterTiles.Contains(s.ID): tiles.append({'X': s.X, 'Y': s.Y, 'Z': s.Z, 'ID': s.ID, 'Distance': UOMath.Distance(Engine.Player.X, Engine.Player.Y, s.X, s.Y)}) except: continue return tiles ``` -------------------------------- ### Initialize UO-Scripts Configuration and Startup Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This snippet defines the initial configuration lists for looting and weight management, followed by the startup phase which validates the character name and initializes all necessary system timers. ```UO-Script @pushlist 'corpseGraphic' 0x2006 @pushlist 'masterKeySerial' 0x4257c632 @pushlist 'minSkillforLoot' '13' @pushlist 'howManySkillsforLoot' '2' @pushlist 'autoclaimMessage' '[claim -c' @pushlist 'filterCorpses' 'on' @pushlist 'lootCorpseDistance' '2' @pushlist 'weightLimitWarningDelay' '20000' @pushlist 'weightLimitStones' 525 @pushlist 'weightLimitCount' 110 @clearlist 'status' @pushlist 'status' 'startup' ``` -------------------------------- ### Initialize and Populate UO Script Lists Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This snippet demonstrates the standard pattern for initializing game lists in UO-Scripts. It uses @createlist to define the structure, @clearlist to reset state, and @pushlist to populate specific values for combat, status, and entity tracking. ```UO-Script @createlist 'minSkillforLoot' @clearlist 'minSkillforLoot' //# Fixed lists - Colors @createlist 'colors' @clearlist 'colors' @pushlist 'colors' 1990 //# red @pushlist 'colors' 1986 //# yellow //# Champion bosses configuration @createlist 'RikktorGraphic' @clearlist 'RikktorGraphic' @pushlist 'RikktorGraphic' 0xAC //# Riktor ``` -------------------------------- ### Get Nearby Water Tiles Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningSearchTarget.orig.txt The 'getTiles' function scans the player's vicinity for specified water tile IDs within a given radius. It collects tile information including coordinates, ID, and distance, storing them for potential use in panning. ```python def getTiles(searchRadius): waterTiles = [ 0x179c, 0x1798, 0x1797, 0x1799, 0x179b, 0x179a, 0xa9, 0xa8, 0xab, 0xaa, 0x17ad] for x in range(Engine.Player.X - searchRadius, Engine.Player.X + searchRadius): for y in range(Engine.Player.Y - searchRadius, Engine.Player.Y + searchRadius): statics = Statics.GetStatics(Convert.ChangeType(Engine.Player.Map, int), x, y) try: for s in statics: if waterTiles.Contains(s.ID): tiles.append({'X': s.X, 'Y': s.Y, 'Z': s.Z, 'ID': s.ID, 'Distance': UOMath.Distance(Engine.Player.X, Engine.Player.Y, s.X, s.Y)}) except: continue return tiles ``` -------------------------------- ### Get Location Data from File (Python) Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningLoop.orig.txt Reads location data from a specified file. Each line in the file is expected to contain position information separated by colons and commas. The function parses this data and returns it as a dictionary where keys are integer positions and values are lists of coordinates. ```python def getLocations(filePath): panPos = dict() worldSave() with open(filePath) as file: for line in file: worldSave() a = line.strip().split(':') #print(a) panPos[int(a[0])] = [ a[1].split(','),a[2].split(',')] return panPos ``` -------------------------------- ### Initialize Combat System Variables Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Sets up the necessary lists and aliases for the combat system upon script startup. This ensures all tracking variables for delays, modes, and character status are initialized before the main loop begins. ```UO-Script if not @findobject 'lootBag' promptalias 'lootBag' endif @createlist 'actionsDelay' @createlist 'autoCounterAttackMode' @createlist 'autoClaim' @createlist 'autoLooter' @createlist 'combatMode' ``` -------------------------------- ### Get Enemies from Game Engine (Python) Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/TargetEnemies.orig.orig.txt Retrieves a collection of enemy mobile entities from the game engine. It filters enemies based on maximum distance, excludes the player's own serial, and optionally filters by notoriety. The results can be ordered by a provided lambda function. ```python from Assistant import Engine import re import clr import System clr.AddReference("System.Core") clr.ImportExtensions(System.Linq) #Function to get enemy # and m.ID != 0x2eb exclude all wraiths with this the mirrors will not honored everytime def GetEnemies(enemyNotorieties = None, enemyMaxDistance = 32, orderBy = lambda m: m.Distance): getEnemy = Engine.Mobiles.Where(lambda m: m.Distance < enemyMaxDistance and m.Serial != Engine.Player.Serial and m.ID != 0x2eb and (enemyNotorieties == None or enemyNotorieties.Contains(m.Notoriety.ToString()))).OrderBy(orderBy) return getEnemy ``` -------------------------------- ### Manage Lists: Create, Clear, and Push Elements Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt These scripts demonstrate the creation, clearing, and population of lists within the UO environment. They are used to store and manage various game-related data such as colors, item IDs, and skill names. No external dependencies are required. ```UO Script @pushlist 'TwauloColor' 1109 //# Twaulo color 1109 @pushlist 'LordOaksColor' 0 //# Lord Oaks //# Jewelry loot system @createlist 'corpseGraphic' @clearlist 'corpseGraphic' @createlist 'jewelryList' @clearlist 'jewelryList' @pushlist 'jewelryList' 0x108a @pushlist 'jewelryList' 0x1f09 @pushlist 'jewelryList' 0x1086 @pushlist 'jewelryList' 0x1f06 @createlist 'jewelryCheck' @clearlist 'jewelryCheck' @createlist 'SkillList' @clearlist 'SkillList' @pushlist 'SkillList' 'Swordsmanship' @pushlist 'SkillList' 'Tactics' @pushlist 'SkillList' 'Anatomy' @pushlist 'SkillList' 'Bushido' @pushlist 'SkillList' 'Parrying' @pushlist 'SkillList' 'Resisting Spells' @pushlist 'SkillList' 'Magery' @pushlist 'SkillList' 'Spirit Speak' @pushlist 'SkillList' 'Necromancy' @pushlist 'SkillList' 'Mace Fighting' @pushlist 'SkillList' 'Archery' @pushlist 'SkillList' 'Animal Taming' @pushlist 'SkillList' 'Animal Lore' @pushlist 'SkillList' 'Evaluating Intelligence' @pushlist 'SkillList' 'Musicianship' @createlist 'SkillListFound' @clearlist 'SkillListFound' @pushlist 'status' 'setup' ``` -------------------------------- ### Get Gold Pan Item in UO Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/PanningMarkLargeSpots_v2.orig.txt The `getGoldpan` function in Python attempts to retrieve and use a gold pan from a storage container in Ultima Online, identified by its hue. It handles gump interactions and recursively calls itself if the pan is not immediately usable, returning `True` on success and `False` if the pan cannot be found. ```python def getGoldpan(): if FindType(0x9d7, -1, 'backpack', panKeyHue): SetAlias('goldpan', 'found') UseObject('goldpan') Pause(middlePause) ReplyGump(0x6abce12, 4) WaitForGump(0x6abce12, 5000) ReplyGump(0x6abce12, 0) if checkGoldpan(): return True else: getGoldpan() else: HeadMsg("**** cant find a goldpan storage found ****", 'self', 82) Pause(smallPause) return False ``` -------------------------------- ### Initiate Attack and Pre-Combat Routines Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt After handling combat modes, this script section initiates the primary attack on the 'finalEnemy'. It also includes pre-combat routines such as casting 'Divine Fury' and activating 'autoEvasionMode', both of which are governed by specific timers and delay parameters to prevent spamming. ```N/A // #-----Attack!----------- attack! 'finalEnemy' if @list 'logLevel' > 4 headmsg '↓Attacking↓' '1990' 'finalEnemy' endif //# Pre-combat routines. For example, defensive manouvers. //# Divine Fury. if @timer 'divineFuryTimer' > divineFuryDelay[0] and @timer 'castDelayTimer' > castDelay[0] if @list 'logLevel' > 2 sysmsg 'Casting Divine Fury' msgclr[0] endif cast 'Divine Fury' @settimer 'divineFuryTimer' 0 @settimer 'castDelayTimer' 0 endif //# autoEvasionMode if @inlist 'autoEvasionMode' 'on' if @timer 'autoEvasionTimer' > autoEvasionDelay[0] and @timer 'castDelayTimer' > castDelay[0] if @list 'logLevel' > 2 ``` -------------------------------- ### Configure Panning Automation Settings Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningLoop.orig.txt Sets up the environment for the gold panning script by importing required .NET and ClassicAssist libraries. It defines the storage path for runebook data and the preferred recall method for navigation. ```python from ClassicAssist.UO.Data import Statics from Assistant import Engine from System import Convert from ClassicAssist.UO import UOMath from ClassicAssist.UO.Data import Direction import System import clr import os clr.AddReference('System.Core') clr.ImportExtensions(System.Linq) pathToBooks = "D:\\Games\\Macros\\Data\\books\\" recallType = 'c' ``` -------------------------------- ### Auto Evasion and Counter Attack Logic Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Handles automatic evasion and counter-attack casting based on timers and game state. It checks timers like 'autoEvasionTimer', 'autoCounterAttackTimer', and 'castDelayTimer' to determine when to cast spells like 'evasion' and 'Counter Attack'. ```UO Script sysmsg 'Casting Evasion (autoEvasionMode is on)' msgclr[0] endif @cast 'evasion' @settimer 'autoEvasionTimer' 0 @settimer 'castDelayTimer' 0 endif endif //# Auto autoCounterAttackMode if @inlist 'autoCounterAttackMode' 'on' if @timer 'autoCounterAttackTimer' > autoCounterAttackDelay[0] and @timer 'castDelayTimer' > castDelay[0] if @timer 'autoEvasionTimer' > 8300 if @list 'logLevel' > 2 sysmsg 'Casting Counter Attack (autoCounterAttackMode is on)' msgclr[0] endif @cast 'Counter Attack' @settimer 'autoCounterAttackTimer' 0 @settimer 'castDelayTimer' 0 endif endif endif ``` -------------------------------- ### Get Specific Elementals from Game Engine (Python) Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/TargetEnemies.orig.orig.txt Retrieves specific elemental mobile entities from the game engine based on their ID. Filters can be applied for maximum distance and notoriety, and the results can be ordered. This function is useful for targeting specific creature types like metal elementals (ID 0x6f). ```python # 0x6f is an metal elemental def GetElementals(enemyNotorieties = None, enemyMaxDistance = 32, enemyType = None, orderBy = lambda m: m.Distance): getEnemy = Engine.Mobiles.Where(lambda m: m.Distance < enemyMaxDistance and m.Serial != Engine.Player.Serial and m.ID == enemyType and (enemyNotorieties == None or enemyNotorieties.Contains(m.Notoriety.ToString()))).OrderBy(orderBy) return getEnemy ``` -------------------------------- ### Automate Panning for Large Nuggets using Runebook Travel in UO Source: https://github.com/guicampos/uo-scripts/wiki/Gold-Panning This function automates the process of panning for large nuggets in Ultima Online (UO) using runebooks. It retrieves runebooks, filters for large nugget spots, recalls to each spot, pans for nuggets, and performs cleanup actions before returning home. It requires specific prerequisites like a pan storage, bank crystal, and a 'gohome' macro. ```javascript panning_runebook_travel(); ``` -------------------------------- ### Initialize Script Variables Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningSearchTarget.orig.txt Initializes variables used for pathfinding, tile storage, and recall locations. It also ensures the directory for books exists, creating it if necessary. ```python searchRange = 4 tiles = [] panTile = [] recallPlace = [] if not os.path.exists(pathToBooks): os.makedirs(pathToBooks) ``` -------------------------------- ### Configure UOSteam Advanced Combat System Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Initializes the combat system by populating configuration lists in UOSteam. This includes character identification, toggleable combat modes (Evasion, Honor, Discordance), and precise timing delays for actions like healing and special attacks. ```UOSteam while not dead if @inlist 'status' 'setup' @pushlist 'characterName' 'Velland' @pushlist 'logLevel' 0 @pushlist 'autoHealingMode' 'on' @pushlist 'autoEvasionMode' 'on' @pushlist 'autoHonorMode' 'on' @pushlist 'autoCounterAttackMode' 'on' @pushlist 'autoEnemyOfOneMode' 'off' @pushlist 'lockChampionMode' 'on' @pushlist 'autoDiscordanceMode' 'on' @pushlist 'autoLooter' 'on' @pushlist 'autoClaim' 'off' @pushlist 'combatMode' 'cmode' @pushlist 'cmodeSpecial' 'secondary' @pushlist 'smodeSpecial' 'Lightning Strike' @pushlist 'actionsDelay' '600' @pushlist 'lootCorpseDelay' '600' @pushlist 'championMsgDelay' '10000' @pushlist 'healingDelay' '4000' @pushlist 'healthLimit' '250' @pushlist 'divineFuryDelay' '19000' @pushlist 'consecrateWeaponDelay' '9000' @pushlist 'autoEvasionDelay' '24000' @pushlist 'autoHonorDelay' '1000' @pushlist 'listsCleanerDelay' '180000' @pushlist 'autoEnemyOfOneDelay' '120000' @pushlist 'autoCounterAttackDelay' '10000' @pushlist 'cmodeSpecialRate' '600' @pushlist 'smodeSpecialRate' '600' @pushlist 'autoDiscordanceDelay' '14000' @pushlist 'castDelay' '800' @pushlist 'championMsgText' '↓CHAMPS!↓' @pushlist 'instrumentGraphic' 0xe9d @pushlist 'instrumentColor' 0 endif ``` -------------------------------- ### FUNCTION panning_search_new_spot Source: https://github.com/guicampos/uo-scripts/wiki/Gold-Panning Searches for new pan spots in water tiles and marks them in a runebook. ```APIDOC ## FUNCTION panning_search_new_spot ### Description This function scans water tiles within a specified range to identify and mark new pan spots in a runebook. It includes automated AFK checks and world save handling. ### Parameters #### Arguments - **waterTilesRange** (number) - Required - The range in tiles to search for water sources. ### Request Example ```javascript panning_search_new_spot(10); ``` ### Response #### Success Response - **result** (boolean) - Returns true if all spots were successfully analyzed and marked. #### Exceptions - Throws an error if the runebook gump is not found. ``` -------------------------------- ### Search for New Panning Spots in Ultima Online Source: https://github.com/guicampos/uo-scripts/wiki/Gold-Panning This function searches for new pan spots in water tiles and marks them in a runebook. It is designed for use in Ultima Online (UO) scripting using the Orion UO client. It handles initialization, runebook validation, spot marking, and post-analysis actions. It returns true if successful, false otherwise. ```javascript panning_search_new_spot(10); // Example usage with a waterTilesRange of 10 ``` -------------------------------- ### Manage Combat and System Settings via Journal Commands Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Monitors the in-game journal for specific trigger strings like '.jl', '.lc', '.timers', and '.status'. It toggles system states, reports active timers, and displays the current configuration of combat modules to the user. ```UO-Script if @injournal '.jl' characterName[0] @clearjournal if @inlist 'autoClaim' 'on' @clearlist 'autoClaim' @pushlist 'autoClaim' 'off' headmsg 'Auto Claim is now OFF' 1990 else @clearlist 'autoClaim' @pushlist 'autoClaim' 'on' headmsg 'Auto Claim is now ON' 1990 endif endif if @injournal '.status' characterName[0] @clearjournal if @inlist 'autoLooter' 'on' headmsg 'Auto Looter: ON' msgclr[0] else headmsg 'Auto Looter: OFF' msgclr[0] endif endif ``` -------------------------------- ### Detect Champion Boss Enemies Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This section of the script iterates through various predefined enemy types (Semidar, MOA, Serado, etc.) and checks if their corresponding graphics and colors are present on the ground. If a match is found, it sets an alias 'championBoss' to 'found'. This logic is crucial for identifying potential boss targets. ```N/A elseif @findtype SemidarGraphic[0] SemidarColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype MOAGraphic[0] MOAColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype SeradoGraphic[0] SeradoColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype MephitisGraphic[0] MephitisColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype PrimevalLichGraphic[0] PrimevalLichColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype NeiraGraphic[0] NeiraColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype RagnarGraphic[0] RagnarColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype TwauloGraphic[0] TwauloColor[0] 'ground' @setalias 'championBoss' 'found' elseif @findtype LordOaksGraphic[0] LordOaksColor[0] 'ground' @setalias 'championBoss' 'found' endif @settimer 'actionDelayTimer' 0 endif ``` -------------------------------- ### Create Timers for Game Actions Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This section of the UO scripts focuses on creating various timers. These timers are essential for managing delays, cooldowns, and periodic actions within the game, such as auto-attacking, healing, or loot collection. Each timer is given a descriptive name. ```UO Script // ---- Timers ---- @createtimer 'actionDelayTimer' @createtimer 'autoCounterAttackTimer' @createtimer 'autoEnemyOfOneTimer' @createtimer 'autoEvasionTimer' @createtimer 'listsCleanerTimer' @createtimer 'autoHonorTimer' @createtimer 'castDelayTimer' @createtimer 'championMSGTimer' @createtimer 'cmodeSpecialRateTimer' @createtimer 'consecrateWeaponTimer' @createtimer 'discordanceDelayTimer' @createtimer 'divineFuryTimer' @createtimer 'healingDelayTimer' @createtimer 'loopTime' @createtimer 'lootCorpseTimer' @createtimer 'overweightWarningTimer' @createtimer 'smodeSpecialRateTimer' @createtimer 'autoDiscordanceTimer' @createtimer 'weightLimitWarningTimer' ``` -------------------------------- ### FUNCTION panning_runebook_travel Source: https://github.com/guicampos/uo-scripts/wiki/Gold-Panning Automates the harvesting process by recalling to marked spots in runebooks. ```APIDOC ## FUNCTION panning_runebook_travel ### Description This function iterates through runebooks containing 'Large Nuggets' spots, recalls to each location, performs the panning action, and returns home upon completion. ### Prerequisites - Pan storage (0x09D7) with Gold Pans. - Bank crystal and treasure key in backpack. - 'panning' dress agent configured. - 'gohome' macro recorded. ### Request Example ```javascript panning_runebook_travel(); ``` ### Response #### Success Response - **status** (void) - Executes the full harvest cycle and returns home. #### Exceptions - Throws an error if no runebooks are available or no valid panning books are found. ``` -------------------------------- ### Switch Equipment Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt These commands switch the character's equipped gear. '.eq1' equips 'melee' gear, and '.eq2' equips 'ranged' gear. Both commands clear the journal after execution. ```UO Script if @injournal '.eq1' characterName[0] dress 'melee' @clearjournal endif if @injournal '.eq2' characterName[0] dress 'ranged' @clearjournal endif ``` -------------------------------- ### Main Script Loop for Navigation and Gold Pan (Python) Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningLoop.orig.txt Iterates through a list of runebooks and positions, performing navigation, checking for gold pans, and panning for gold. It includes calls to other utility functions like `checkAlert`, `breaking`, `travel`, `checkGoldpan`, `getGoldpan`, `panGold`, `trashLoot`, and `fillGoldKey`. This is the core loop for the gold panning automation. ```python for r in range(len(runebooks)): runebook = int(runebooks[r]) filePath = pathToBooks + hex(runebook) + '.txt' locations = getLocations(filePath) #print(locations.values()) for pos in range(1,17): #print(type(runebook)) checkAlert() worldSave() breaking() while not travel(runebook, pos, recallType): Pause(smallPause) HeadMsg('{} - Pos: {}'.format(hex(runebook), pos)) #print(pos) Pause(moveItemPause) if not checkGoldpan(): if not getGoldpan(): Stop() tile = [int(locations[pos][1][0]), int(locations[pos][1][1]), int(locations[pos][1][2]), int(locations[pos][1][3])] while panGold(tile): Pause(150) trashLoot() fillGoldKey() clearMiBs(extractMiBs) ``` -------------------------------- ### Execute Combat Modes and Special Abilities Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This section manages different combat modes ('cmode', 'smode', 'pmode'). For 'cmode' and 'smode', it checks timers and conditions to cast special abilities or use them via 'setability'. If 'combatMode' is not set, it defaults to 'cmode'. This logic ensures timely execution of offensive and defensive skills. ```N/A if @findalias 'finalEnemy' //# Combat Modes Routines procedures. //# START OF BATTLE ROUTINES //# Place things that need a target here //#combatMode handling before attacking if @inlist 'combatMode' 'cmode' if @timer 'cmodeSpecialRateTimer' > cmodeSpecialRate[0] and @timer 'castDelayTimer' > castDelay[0] if @findalias 'cmodeSpecialAbility' if @list 'logLevel' > 4 sysmsg 'Executing setability cmodeSpecial' msgclr[0] endif @setability cmodeSpecial[0] 'on' else if @list 'logLevel' > 4 sysmsg 'Executing cast cmodeSpecial' msgclr[0] endif cast cmodeSpecial[0] endif @settimer 'cmodeSpecialRateTimer' 0 endif elseif @inlist 'combatMode' 'smode' if @timer 'smodeSpecialRateTimer' > smodeSpecialRate[0] and @timer 'castDelayTimer' > castDelay[0] if @findalias 'smodeSpecialAbility' if @list 'logLevel' > 4 sysmsg 'Executing setability smodeSpecial (ON)' msgclr[0] endif @setability smodeSpecial[0] 'on' else if @list 'logLevel' > 4 sysmsg 'Executing cast smodeSpecial' msgclr[0] endif cast smodeSpecial[0] endif @settimer 'smodeSpecialRateTimer' 0 endif elseif @inlist 'combatMode' 'pmode' headmsg 'pmode: TODO' else //# oops, combatMode should never 'else' anything. Assuming the default cmode @clearlist 'combatMode' @pushlist 'combatMode' 'cmode' endif //#combatMode handling ``` -------------------------------- ### Configure Rune Book Data Extraction Path Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningSearchTarget.orig.txt Sets up the necessary environment and file path configuration for the rune book scanning utility. It imports required ClassicAssist and .NET libraries to facilitate file system operations and data handling. ```python from ClassicAssist.UO.Data import Statics from Assistant import Engine from System import Convert from ClassicAssist.UO import UOMath from ClassicAssist.UO.Data import Direction import System import clr import os clr.AddReference('System.Core') clr.ImportExtensions(System.Linq) # Change the path to your folder you like to store the book files. # Please use the \\ to separate the folders pathToBooks = "D:\\Games\\Macros\\Data\\books\\" ``` -------------------------------- ### Toggle Auto Evasion Mode Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This script manages the 'autoEvasionMode', switching it between 'on' and 'off'. It checks the current setting, updates the mode, and provides feedback to the user. This is useful for defensive tactics. ```UO Script if @injournal '.eva' characterName[0] @clearjournal if @inlist 'autoEvasionMode' 'on' @clearlist 'autoEvasionMode' @pushlist 'autoEvasionMode' 'off' headmsg 'Auto Evasion is now OFF' 1990 else @clearlist 'autoEvasionMode' @pushlist 'autoEvasionMode' 'on' headmsg 'Auto Evasion is now ON' 1990 endif endif //# . eva ``` -------------------------------- ### Handle Found Champion Boss or Enter Silent Mode Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This logic checks if a 'championBoss' has been identified. If so, and if 'lockChampionMode' is enabled, it sets 'finalEnemy' to the boss and potentially displays a warning message. If no 'championBoss' is found, it unsets 'finalEnemy' and enters 'silentMode' if it's not already active. ```N/A // if there is a boss nearby if @findobject 'championBoss' // if lockChampionMode, switch finalEnemy to it if @inlist 'lockChampionMode' 'on' // warn it if @timer 'championMSGTimer' > championMsgDelay[0] headmsg championMsgText[0] '1990' 'championBoss' @settimer 'championMSGTimer' 0 endif @setalias 'finalEnemy' 'championBoss' endif endif else //else findobject, set silent mode @unsetalias 'finalEnemy' if @inlist 'silentMode' 'off' headmsg 'No Enemy found. Entering Silent Mode' '1990' @clearlist 'silentMode' @pushlist 'silentMode' 'on' endif endif //findobject ``` -------------------------------- ### Configure Panning Automation Settings Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/PanningMarkLargeSpots_v2.orig.txt Initializes the configuration variables for the panning script, including equipment management and target identification. It requires the ClassicAssist environment and specific item identifiers to function correctly. ```python from ClassicAssist.UO.Data import Statics from Assistant import Engine from System import Convert from ClassicAssist.UO import UOMath from ClassicAssist.UO.Data import Direction import System fingerJackKey = 'y' dressName = 'panning' colorTrashbag = 1173 ``` -------------------------------- ### TMap Coordinate Mapping Configuration Source: https://github.com/guicampos/uo-scripts/wiki/Treasure-hunting A static configuration variable containing the mapping of X,Y coordinates to TMap numbers. This data is used to calculate the correct runebook required for navigation. ```javascript var tmaps_coordinates_xy_position = '961,506:1;1162,189:2;1315,317:3;...;3541,2784:200'; ``` -------------------------------- ### Grab Gold Piles Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This script, triggered by '.gg', searches the ground for items with the type '0xeed' (gold). It aliases found items as 'gold', uses them, and then ignores them to prevent re-collection. It loops until no more gold piles are found. ```UO Script if @injournal '.gg' characterName[0] @clearjournal while @findtype 0xeed 'any' 'ground' '6' '6' @setalias 'gold' 'found' @useobject! 'gold' @ignoreobject 'gold' endwhile endif //# .ac autoclaim ``` -------------------------------- ### Record Runebook Goldpanning Spots in UO Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningSearchTarget.orig.txt This script automates the process of recording goldpanning spots from a runebook. It prompts the user to target a runebook, then iterates through its spots, checking for goldpanning tools, finding targets, and saving the location data to a text file. It uses UO-specific functions and external scripts like 'travel', 'checkGoldpan', 'getGoldpan', 'getTiles', 'findPanTarget', 'trashLoot', and 'fillGoldKey'. ```python #Prompt the runebook to search the targets HeadMsg("Please target a Runebook with 16 Goldpanning Spots..", 'self', 82) Pause(smallPause) PromptMacroAlias("runebook") runebook = GetAlias('runebook') checkFileName(pathToBooks + hex(runebook) + '.txt') for i in range(1,17): tiles = [] while not travel(runebook, i, 'c'): Pause(smallPause) #print(i) HeadMsg('{} - Pos: {}'.format(hex(runebook), i)) Pause(moveItemPause) if not checkGoldpan(): if not getGoldpan(): Stop() for r in range(1,6): tiles = getTiles(r) #print(tiles) location = findPanTarget(tiles, r) if location is not None: break recallPlace = [Engine.Player.X, Engine.Player.Y, Engine.Player.Z] fileName = pathToBooks + str(hex(runebook)) + '.txt' string = (str(i) + ":" + str(recallPlace) + ":" + str(location) + "\n").replace('[','').replace(']','') with open(fileName, "a") as fh: fh.write(string) trashLoot() fillGoldKey() clearMiBs(extractMiBs) HeadMsg("All Spots are recorded, please check the File.. ", 'self', 82) Pause(smallPause) ``` -------------------------------- ### Main Combat and Healing Loop Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt The main loop runs while the character is alive, monitoring for reload/halt commands, managing self-healing routines, and handling world save pauses. It also initiates the enemy acquisition logic. ```UO-Script while not dead @settimer 'loopTime' 0 if @injournal '.reload' characterName[0] @clearjournal @clearlist 'status' break endif if @inlist 'autoHealingMode' 'on' if poisoned 'self' or hits < healthLimit[0] if timer 'healingDelayTimer' > healingDelay[0] bandageself waitfortarget actionsDelay[0] target! 'self' settimer 'healingDelayTimer' 0 endif endif endif if @injournal 'The world is saving' 'system' waitforjournal 'World save complete' 60000 'system' @clearjournal endif @getenemy 'murderer' 'enemy' 'gray' 'criminal' 'closest' endwhile ``` -------------------------------- ### Set Aliases for Game IDs Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This script snippet demonstrates how to set aliases for specific game-related IDs. These aliases are used to provide more readable names for numerical identifiers, improving script maintainability. This functionality is specific to the UO scripting environment. ```UO Script @setalias 'regsKeyGumpID' 0x6abce12 @setAlias 'spsGumpID' 0x4239a64f @setAlias 'tpsGumpID' 0x7ec42f38 ``` -------------------------------- ### Auto Looter Weight and Inventory Checks Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Manages the auto-looter functionality, including checks for weight and inventory limits. It uses timers 'lootCorpseTimer', 'weightLimitWarningTimer', and 'overweightWarningTimer' to trigger warnings and actions. It compares current weight and backpack contents against defined limits. ```UO Script // #-----------Claim and Loot procedures------------- // #--------AUTO LOOTER----------- if @inlist 'autoLooter' 'on' and @timer 'lootCorpseTimer' > lootCorpseDelay[0] if @timer 'weightLimitWarningTimer' > weightLimitWarningDelay[0] @settimer 'overweightWarningTimer' 0 if weight >= weightLimitStones[0] sysmsg 'Warning: Check your weight limit!' 1990 headmsg 'Warning: Check your weight limit!' 1990 'self' endif if @contents 'backpack' >= weightLimitCount[0] sysmsg 'Warning: Check your inventory quantity!' 1990 ``` -------------------------------- ### Auto Discordance Skill Usage Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Automates the use of the 'Discordance' skill. It checks for the presence of an instrument in the backpack, enemy proximity, and cooldown timers ('autoDiscordanceTimer', 'actionsDelay'). It also handles journal messages to confirm skill usage and target selection. ```UO Script // proc discord if @inlist 'autoDiscordanceMode' 'on' if not @findtype instrumentGraphic[0] instrumentColor[0] 'backpack' headmsg 'No Instrument found on your backpack. AutoDiscordance Disabled' 1990 'self' @clearlist 'autoDiscordanceMode' @pushlist 'autoDiscordanceMode' 'off' continue endif if @timer 'autoDiscordanceTimer' > autoDiscordanceDelay[0] if not @inlist 'discordedEnemyList' 'finalEnemy' and @inrange 'finalEnemy' 8 @useskill 'Discordance' waitfortarget actionsDelay[0] if @injournal 'What instrument shall you play?' 'system' @clearjournal if @findtype instrumentGraphic[0] instrumentColor[0] 'backpack' @target! 'found' else headmsg 'No Instrument found on your backpack. AutoDiscordance Disabled' 1990 'self' @clearlist 'autoDiscordanceMode' @pushlist 'autoDiscordanceMode' 'off' endif elseif @injournal 'to use another skill' 'system' @clearjournal @settimer 'autoDiscordanceTimer' 0 else @target! 'finalEnemy' //pause 10 if @injournal 'You play jarring music' 'system' @clearjournal @pushlist 'discordedEnemyList' 'finalEnemy' @settimer 'autoDiscordanceTimer' 0 endif endif @canceltarget @cancelautotarget endif endif endif ``` -------------------------------- ### Toggle Auto Claim Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This command toggles the 'autoClaim' functionality between 'on' and 'off'. It checks the current state, clears the list, and pushes the new state, providing user feedback. ```UO Script if @injournal '.ac' characterName[0] @clearjournal if @inlist 'autoClaim' 'on' @clearlist 'autoClaim' @pushlist 'autoClaim' 'off' ``` -------------------------------- ### Toggle Auto Counter Attack Mode Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This command toggles the 'autoCounterAttackMode' between 'on' and 'off'. It checks the current state, updates the mode accordingly, and confirms the action with a message. This is for reactive combat. ```UO Script if @injournal '.ca' characterName[0] @clearjournal if @inlist 'autoCounterAttackMode' 'on' @clearlist 'autoCounterAttackMode' @pushlist 'autoCounterAttackMode' 'off' headmsg 'Auto Counter Attack is now OFF' 1990 else @clearlist 'autoCounterAttackMode' @pushlist 'autoCounterAttackMode' 'on' headmsg 'Auto Counter Attack is now ON' 1990 endif endif //#.ca ``` -------------------------------- ### Automated Corpse Looting and Jewelry Filtering Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt This script scans for nearby corpses, opens them, and filters items based on skill requirements. It uses a list-based approach to identify valuable jewelry and moves them to a designated loot bag. ```UO-Script if @findtype corpseGraphic[0] 'any' 'ground' '0' lootCorpseDistance[0] @setalias 'corpse' 'found' if @inlist 'filterCorpses' 'on' if contents 'corpse' > 0 useobject 'corpse' endif endif for 0 to jewelryList while @findtype jewelryList[] 'any' 'corpse' @setalias 'jewelryFound' 'found' @clearlist 'SkillListFound' for 0 to SkillList if @property SkillList[] 'jewelryFound' >= minSkillforLoot[0] @pushlist 'SkillListFound' SkillList[] endif endfor if list 'SkillListFound' >= howManySkillsforLoot[0] while @findobject 'jewelryFound' 'any' 'corpse' @moveitem 'jewelryFound' 'lootBag' endwhile endif @ignoreobject 'jewelryFound' endwhile endfor endif ``` -------------------------------- ### World Save and Travel Automation Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/panningLoop.orig.txt Functions to detect and wait for game world save events to prevent script interruption, and a travel function to navigate via runebooks using Chivalry or Magery spells. ```python def worldSave(): if InJournal('The world is saving, please wait.', 'system' ): HeadMsg('Pausing for world save','self', 82) Pause(250) if WaitForJournal('World save complete.',60000, 'system'): HeadMsg('Continuing','self',82) Pause(250) ClearJournal() return True def travel(runeBook = None, place = None, travelSpell = 'c'): if runeBook is None or place is None: return False if travelSpell != 'c' and travelSpell != 'r': return False if travelSpell == 'c': bookPos = place * 6 + 1 if travelSpell == 'r': bookPos = place * 6 - 1 ClearJournal() worldSave() UseObject(runeBook) Pause(smallPause) WaitForGump(0x554b87f3, 5000) Pause(middlePause) if InJournal('time to recharge'): Pause(4500) travel(runeBook, place, travelSpell) Pause(smallPause) ReplyGump(0x554b87f3, bookPos) Pause(2500) if InJournal('location is blocked'): return False return True ``` -------------------------------- ### Perform Periodic Cleanup Procedures Source: https://github.com/guicampos/uo-scripts/blob/master/UOS/Battle/vcswvc .txt Uses a timer-based check to periodically clear temporary lists such as honored enemies and discorded targets. This prevents memory bloat and ensures the combat logic operates on fresh data. ```UO-Script if @timer 'listsCleanerTimer' > listsCleanerDelay[0] @settimer 'listsCleanerTimer' 0 @clearlist 'autoHonorHonoredList' @clearlist 'discordedEnemyList' endif ``` -------------------------------- ### Configure UO Script Settings Source: https://github.com/guicampos/uo-scripts/blob/master/CUA/Resources/PanningMarkLargeSpots_v2.orig.txt This section defines configuration variables for UO scripts, controlling pauses between actions, MIB extraction behavior, and travel spell hues. These settings allow customization of script speed and item handling. ```python # this are breaks for people with high pings ;) you can try to loweer them if your ping is fast moveItemPause = 800 smallPause = 100 middlePause = 400 #you can choose how the script should handle the MiBs. If it is set to 'n', the MiBs #will be unpacked and included in the treasure key. If it is 'y' then the bottles are #pushed into a bag in the bank. This then requires the serial of the Cyratal and the bag in the bank. extractMiBs = 'n' #the next two lines are only needed when extractMiBs = 'y' bankCrystal = 0x51286e19 bankBag = 0x4266c61f ############ From here no more changes necessary ############## searchRange = 4 tiles = [] panTile = [] recallPlace = [] if fingerJackKey == 'y': panKeyHue = 1992 else: panKeyHue = 1991 ```