Skip to content
Outlands Hub

Razor script

Armor Crate Assembler

by nev0r · 502 lines
Download

Compatibility unverified

This community Razor script has not been tested in game by the Hub. Read its setup and client requirements before use.

This script assists you in creating armor crates in UO Outlands - https://wiki.uooutlands.com/Armor_Crates - It is using items from backpack by default - Edit setup to restock from a shelf instead - WARNING: server system messages are…

Organizing
Armor Crate Assembler.razor
1# This is an automated backup - check out https://outlands.uorazorscripts.com/script/6d0959e6-46f5-4d28-8266-090c17b84c97 for latest2# Automation by Jaseowns3## Script: Armor Crate Assembler4## Created by: nev0r#05#############################################6 7// This script assists you in creating armor crates in UO Outlands8// - https://wiki.uooutlands.com/Armor_Crates9// - It is using items from backpack by default10// - Edit setup to restock from a shelf instead11// - WARNING: server system messages are needed to determine necessary actions, make sure they are not filtered for scripts: 12//    Razor -> Filters -> Text&Messages ->13//    - Uncheck "Filter repeating system messages"14//    - "Enable text filter" and "Filter system messages" (list entry sub-menu) can be checked, however "Ignore filtered messages in overhead and scripts" (list entry sub-menu) has to be unchecked15 16// -------- U  S  E  R  -  S  E  T  U  P ------- //17// ----------- C r a t e  A m o u n t ---------- //18// 0  ... Try to create as many crates as possi- //19//        ble from backpack only, no restock     //20// 1+ ... Build crates until backpack has this   //21//        amount. Restock crates/armor from      // 22//        shelf. Already existing crates count   //23//        toward target amount.                  //24setvar! crateAmount 025 26// ------------- A r m o r  T y p e ------------ //27// 1 ... Leather Armor     | 4 ... Ringmail      //28// 2 ... Studded Armor     | 5 ... Chainmail     //29// 3 ... Bone Armor        | 6 ... Platemail     //30setvar! crateArmorType 131 32// -------------- M a t e r i a l -------------- //33// 1 ... Regular      |  6 ... Gold              //34// 2 ... Dull         |  7 ... Rose/Agaptie      //35// 3 ... Shadow       |  8 ... Vere              //36// 4 ... Copper       |  9 ... Vale              //37// 5 ... Bronze       | 10 ... Avar              //38setvar! crateMaterial 139 40// --------------------------------------------- //41// - E  N  D  -  U  S  E  R  -  S  E  T  U  P  - //42 43//Global variables44setvar! globalWaitForServerResponse 50045setvar! globalWaitForObjectDelay    60046setvar! globalTimeout             1500047if not timerexists globalObjectDelayTimer48    settimer globalObjectDelayTimer globalWaitForObjectDelay49endif50 51//Colors52setvar! cSuccess 6853setvar! cWarning 5554setvar! cError   3355 56//Clear relevant system messages and ignore list57if insysmsg "You assemble an armor crate." or insysmsg "That item is unavailable." or insysmsg "Assembling armor crates require 6 armor items: one for each armor layer, with all being of exceptional quality, mastercrafted, fully repaired, and matching the 'crafted by' of the targeted item."58endif59@clearignore60 61if 0 = crateAmount62//Build crates exclusively from items currently held in backpack, no restock63    64    if not findtype "empty armor crate" backpack65        overhead "|* No armor crates *|" cWarning66        sysmsg   "|* No armor crates *|" cWarning67        stop68    elseif not findtype "leather tunic|studded tunic|bone armor|ringmail tunic|chainmail tunic|platemail" backpack69        overhead "|* Missing armor items *|" cWarning70        sysmsg   "|* Missing armor items *|" cWarning71        stop72    endif73    while findtype "leather tunic|studded tunic|bone armor|ringmail tunic|chainmail tunic|platemail" backpack as localArmor and findtype "empty armor crate" backpack as localEmptyCrate74        if targetexists75            target cancel76        endif77        while timer globalObjectDelayTimer < globalWaitForObjectDelay78        endwhile79        dclick localEmptyCrate80        settimer globalObjectDelayTimer 081        wft globalWaitForServerResponse82        if targetexists83            target localArmor84            @ignore localArmor85        endif86        getlabel backpack waitForPing87    endwhile88    @clearignore89    overhead "| Armor crates finished |" cSuccess90    stop91 92endif93 94//Validate user input95if 1 > crateArmorType or 6 < crateArmorType96    overhead "|** Wrong input **|" cError97    overhead "|* crateArmorType: {{crateArmorType}} (1-6) *|" cWarning98    sysmsg   "|** Wrong input **|" cError99    sysmsg   "|* crateArmorType: {{crateArmorType}} (1-6) *|" cWarning100    stop101elseif 1 > crateMaterial or 10 < crateMaterial102    overhead "|** Wrong input **|" cError103    overhead "|* crateMaterial: {{crateMaterial}} (1-10) *|" cWarning104    sysmsg   "|** Wrong input **|" cError105    sysmsg   "|* crateMaterial: {{crateMaterial}} (1-10) *|" cWarning106    stop107endif108 109//Shelf variables110setvar! shelfGumpID      3232825965111setvar! shelfLowerMenuLeft       20112setvar! shelfLowerMenuRight      21113setvar! shelfSwitchRetrieveType  23114setvar! shelfLowerMenu_Btn2      51115setvar! shelfLowerMenu_Btn3      52116setvar! shelfLowerMenu_Btn4      53117setvar! shelfLowerMenu_Btn7      56118setvar! shelfPrevMaterial        30119setvar! shelfNextMaterial        40120setvar! shelfGetArmorCrate      140121 122//Open shelf gump123if findtype "storage shelf" ground -1 -1 2 as localShelf124    setvar! myShelf localShelf125elseif findtype "storage locker" self as localShelf126    setvar! myShelf localShelf127else128    overhead "|* Move closer to shelf *|" cWarning129    sysmsg   "|* Move closer to shelf *|" cWarning130    stop131endif132while timer globalObjectDelayTimer < globalWaitForObjectDelay133endwhile134dclick myShelf135settimer globalObjectDelayTimer 0136getlabel backpack waitForPing137waitforgump shelfGumpID globalWaitForServerResponse138if not gumpexists shelfGumpID139    overhead "|** Shelf gump not found **|" cError140    sysmsg   "|** Shelf gump not found **|" cError141    stop142endif143 144//Toggle 'Retrieve One'145settimer globalSafetyTimer 0146while gumpexists shelfGumpID and not ingump "Retrieve One" 3232825965 and timer globalSafetyTimer < globalTimeout147    gumpresponse shelfSwitchRetrieveType shelfGumpID148    waitforgump shelfGumpID globalWaitForServerResponse149endwhile150 151//Pull empty armor crates152gumpresponse shelfLowerMenuRight shelfGumpID153waitforgump shelfGumpID globalWaitForServerResponse154gumpresponse shelfLowerMenu_Btn4 shelfGumpID155waitforgump shelfGumpID globalWaitForServerResponse156while counttype "empty armor crate" backpack < crateAmount and gumpexists shelfGumpID157    gumpresponse shelfGetArmorCrate shelfGumpID158    waitforgump shelfGumpID globalWaitForServerResponse159    if insysmsg "That item is unavailable."160        overhead "|* Not enough empty crates *|" cWarning161        sysmsg   "|* Not enough empty crates *|" cWarning162        if counttype "empty armor crate" backpack as localCrateCount163            overhead "| Creating {{localCrateCount}} crates |" cSuccess164            sysmsg   "| Creating {{localCrateCount}} crates |" cSuccess165        else166            stop167        endif168        break169    endif170endwhile171settimer globalSafetyTimer 0172while gumpexists shelfGumpID and ingump "Iron" 3232825965 and timer globalSafetyTimer < globalTimeout173    gumpresponse shelfLowerMenuLeft shelfGumpID174    waitforgump shelfGumpID globalWaitForServerResponse175    gumpresponse shelfLowerMenu_Btn7 shelfGumpID176    waitforgump shelfGumpID globalWaitForServerResponse177endwhile178 179//Switch shelf gump to needed material type180settimer globalSafetyTimer 0181if 0 < crateArmorType and 4 > crateArmorType182    183    while gumpexists shelfGumpID and not ingump "Leather" 3232825965 and timer globalSafetyTimer < globalTimeout184        gumpresponse shelfLowerMenu_Btn2 shelfGumpID185        waitforgump shelfGumpID globalWaitForServerResponse186    endwhile187    188    if 1 = crateMaterial189        setvar! crateHue 0190        while gumpexists shelfGumpID and not ingump "Leather" 3232825965 and timer globalSafetyTimer < globalTimeout191            gumpresponse shelfNextMaterial shelfGumpID192            waitforgump shelfGumpID globalWaitForServerResponse193        endwhile194    elseif 2 = crateMaterial195        setvar! crateHue 2419196        while gumpexists shelfGumpID and not ingump "Dullhide" 3232825965 and timer globalSafetyTimer < globalTimeout197            gumpresponse shelfNextMaterial shelfGumpID198            waitforgump shelfGumpID globalWaitForServerResponse199        endwhile200    elseif 3 = crateMaterial201        setvar! crateHue 2406202        while gumpexists shelfGumpID and not ingump "Shadowhide" 3232825965 and timer globalSafetyTimer < globalTimeout203            gumpresponse shelfNextMaterial shelfGumpID204            waitforgump shelfGumpID globalWaitForServerResponse205        endwhile206    elseif 4 = crateMaterial207        setvar! crateHue 2413208        while gumpexists shelfGumpID and not ingump "Copperhide" 3232825965 and timer globalSafetyTimer < globalTimeout209            gumpresponse shelfNextMaterial shelfGumpID210            waitforgump shelfGumpID globalWaitForServerResponse211        endwhile    212    elseif 5 = crateMaterial213        setvar! crateHue 2418214        while gumpexists shelfGumpID and not ingump "Bronzehide" 3232825965 and timer globalSafetyTimer < globalTimeout215            gumpresponse shelfNextMaterial shelfGumpID216            waitforgump shelfGumpID globalWaitForServerResponse217        endwhile    218    elseif 6 = crateMaterial219        setvar! crateHue 2213220        while gumpexists shelfGumpID and not ingump "Goldenhide" 3232825965 and timer globalSafetyTimer < globalTimeout221            gumpresponse shelfPrevMaterial shelfGumpID222            waitforgump shelfGumpID globalWaitForServerResponse223        endwhile224    elseif 7 = crateMaterial225        setvar! crateHue 2425226        while gumpexists shelfGumpID and not ingump "Rosehide" 3232825965 and timer globalSafetyTimer < globalTimeout227            gumpresponse shelfPrevMaterial shelfGumpID228            waitforgump shelfGumpID globalWaitForServerResponse229        endwhile230    elseif 8 = crateMaterial231        setvar! crateHue 2207232        while gumpexists shelfGumpID and not ingump "Verehide" 3232825965 and timer globalSafetyTimer < globalTimeout233            gumpresponse shelfPrevMaterial shelfGumpID234            waitforgump shelfGumpID globalWaitForServerResponse235        endwhile236    elseif 9 = crateMaterial237        setvar! crateHue 2219238        while gumpexists shelfGumpID and not ingump "Valehide" 3232825965 and timer globalSafetyTimer < globalTimeout239            gumpresponse shelfPrevMaterial shelfGumpID240            waitforgump shelfGumpID globalWaitForServerResponse241        endwhile242    elseif 10 = crateMaterial243        setvar! crateHue 1763244        while gumpexists shelfGumpID and not ingump "Avarhide" 3232825965 and timer globalSafetyTimer < globalTimeout245            gumpresponse shelfPrevMaterial shelfGumpID246            waitforgump shelfGumpID globalWaitForServerResponse247        endwhile248    endif249 250    if 1 = crateArmorType and 1 = crateMaterial251        setvar! crateFindtypeSerial 18047252    elseif 1 = crateArmorType253        setvar! crateFindtypeSerial 18048254    elseif 2 = crateArmorType and 1 = crateMaterial255        setvar! crateFindtypeSerial 18052256    elseif 2 = crateArmorType257        setvar! crateFindtypeSerial 18053258    elseif 3 = crateArmorType and 1 = crateMaterial259        setvar! crateFindtypeSerial 18044260    elseif 3 = crateArmorType261        setvar! crateFindtypeSerial 18045262    endif263 264elseif 3 < crateArmorType and 7 > crateArmorType265    266    while gumpexists shelfGumpID and not ingump "Iron" 3232825965 and timer globalSafetyTimer < globalTimeout267        gumpresponse shelfLowerMenu_Btn3 shelfGumpID268        waitforgump shelfGumpID globalWaitForServerResponse269    endwhile270    271    if 1 = crateMaterial272        setvar! crateHue 0273        while gumpexists shelfGumpID and not ingump "Iron" 3232825965 and timer globalSafetyTimer < globalTimeout274            gumpresponse shelfNextMaterial shelfGumpID275            waitforgump shelfGumpID globalWaitForServerResponse276        endwhile277    elseif 2 = crateMaterial278        setvar! crateHue 2419279        while gumpexists shelfGumpID and not ingump "Dull Copper" 3232825965 and timer globalSafetyTimer < globalTimeout280            gumpresponse shelfNextMaterial shelfGumpID281            waitforgump shelfGumpID globalWaitForServerResponse282        endwhile283    elseif 3 = crateMaterial284        setvar! crateHue 2406    285        while gumpexists shelfGumpID and not ingump "Shadow Iron" 3232825965 and timer globalSafetyTimer < globalTimeout286            gumpresponse shelfNextMaterial shelfGumpID287            waitforgump shelfGumpID globalWaitForServerResponse288        endwhile289    elseif 4 = crateMaterial290        setvar! crateHue 2413    291        while gumpexists shelfGumpID and not ingump "Copper" 3232825965 and timer globalSafetyTimer < globalTimeout or ingump "Dull Copper" 3232825965292            gumpresponse shelfNextMaterial shelfGumpID293            waitforgump shelfGumpID globalWaitForServerResponse294        endwhile    295    elseif 5 = crateMaterial296        setvar! crateHue 2418    297        while gumpexists shelfGumpID and not ingump "Bronze" 3232825965 and timer globalSafetyTimer < globalTimeout298            gumpresponse shelfNextMaterial shelfGumpID299            waitforgump shelfGumpID globalWaitForServerResponse300        endwhile    301    elseif 6 = crateMaterial302        setvar! crateHue 2213    303        while gumpexists shelfGumpID and not ingump "Gold" 3232825965 and timer globalSafetyTimer < globalTimeout304            gumpresponse shelfPrevMaterial shelfGumpID305            waitforgump shelfGumpID globalWaitForServerResponse306        endwhile307    elseif 7 = crateMaterial308        setvar! crateHue 2425    309        while gumpexists shelfGumpID and not ingump "Agapite" 3232825965 and timer globalSafetyTimer < globalTimeout310            gumpresponse shelfPrevMaterial shelfGumpID311            waitforgump shelfGumpID globalWaitForServerResponse312        endwhile313    elseif 8 = crateMaterial314        setvar! crateHue 2207    315        while gumpexists shelfGumpID and not ingump "Verite" 3232825965 and timer globalSafetyTimer < globalTimeout316            gumpresponse shelfPrevMaterial shelfGumpID317            waitforgump shelfGumpID globalWaitForServerResponse318        endwhile319    elseif 9 = crateMaterial320        setvar! crateHue 2219    321        while gumpexists shelfGumpID and not ingump "Valorite" 3232825965 and timer globalSafetyTimer < globalTimeout322            gumpresponse shelfPrevMaterial shelfGumpID323            waitforgump shelfGumpID globalWaitForServerResponse324        endwhile325    elseif 10 = crateMaterial326        setvar! crateHue 1763    327        while gumpexists shelfGumpID and not ingump "Avarite" 3232825965 and timer globalSafetyTimer < globalTimeout328            gumpresponse shelfPrevMaterial shelfGumpID329            waitforgump shelfGumpID globalWaitForServerResponse330        endwhile331    endif332 333    if 4 = crateArmorType and 1 = crateMaterial334        setvar! crateFindtypeSerial 18050335    elseif 4 = crateArmorType336        setvar! crateFindtypeSerial 18051337    elseif 5 = crateArmorType338        setvar! crateFindtypeSerial 18046339    elseif 6 = crateArmorType340        setvar! crateFindtypeSerial 18049341    endif342 343endif344 345if not gumpexists shelfGumpID or not ingump "Retrieve One" 3232825965 or timer globalSafetyTimer > globalTimeout346    overhead "|** Shelf gump error **|" cError347    sysmsg   "|** Shelf gump error **|" cError348    stop349endif350 351//Assemble crates352//crateCounterList is used to increase script execution speed. Empty crates are deleted from inventory a lot slower than the system message or finished crate appear,353//resulting in wrong findtype and counttype results of empty armor crates354removelist crateCounterList355createlist crateCounterList356while list crateCounterList != counttype "empty armor crate" backpack357    pushlist crateCounterList index358endwhile359 360settimer globalSafetyTimer 0361while counttype crateFindtypeSerial backpack crateHue < crateAmount and list crateCounterList and findtype "empty armor crate" backpack as localEmptyCrate362 363    if targetexists364        target cancel365    endif366 367    if gumpexists shelfGumpID and timer globalSafetyTimer < globalTimeout368        //Retrieve armor items369        if 1 = crateArmorType or 4 = crateArmorType370            gumpresponse 130 shelfGumpID371            waitforgump shelfGumpID globalWaitForServerResponse372            gumpresponse 131 shelfGumpID373            waitforgump shelfGumpID globalWaitForServerResponse374            gumpresponse 132 shelfGumpID375            waitforgump shelfGumpID globalWaitForServerResponse376            gumpresponse 133 shelfGumpID377            waitforgump shelfGumpID globalWaitForServerResponse378            gumpresponse 134 shelfGumpID379            waitforgump shelfGumpID globalWaitForServerResponse380            gumpresponse 135 shelfGumpID381            waitforgump shelfGumpID globalWaitForServerResponse382        elseif 2 = crateArmorType or 5 = crateArmorType383            gumpresponse 230 shelfGumpID384            waitforgump shelfGumpID globalWaitForServerResponse385            gumpresponse 231 shelfGumpID386            waitforgump shelfGumpID globalWaitForServerResponse387            gumpresponse 232 shelfGumpID388            waitforgump shelfGumpID globalWaitForServerResponse389            gumpresponse 233 shelfGumpID390            waitforgump shelfGumpID globalWaitForServerResponse391            gumpresponse 234 shelfGumpID392            waitforgump shelfGumpID globalWaitForServerResponse393            gumpresponse 235 shelfGumpID394            waitforgump shelfGumpID globalWaitForServerResponse395        elseif 3 = crateArmorType or 6 = crateArmorType396            gumpresponse 330 shelfGumpID397            waitforgump shelfGumpID globalWaitForServerResponse398            gumpresponse 331 shelfGumpID399            waitforgump shelfGumpID globalWaitForServerResponse400            gumpresponse 332 shelfGumpID401            waitforgump shelfGumpID globalWaitForServerResponse402            gumpresponse 333 shelfGumpID403            waitforgump shelfGumpID globalWaitForServerResponse404            gumpresponse 334 shelfGumpID405            waitforgump shelfGumpID globalWaitForServerResponse406            gumpresponse 335 shelfGumpID407            waitforgump shelfGumpID globalWaitForServerResponse408        endif409    endif410        411    //Assemble crate412    if 1 = crateArmorType and findtype "leather tunic" backpack crateHue as localArmor and findtype "leather sleeves" backpack crateHue and findtype "leather Gloves" backpack crateHue and findtype "leather gorget" backpack crateHue and findtype "leather cap" backpack crateHue and findtype "leather leggings" backpack crateHue413        setvar! crateArmorSerial localArmor414    elseif 2 = crateArmorType and findtype "studded tunic" backpack crateHue as localArmor and findtype "studded sleeves" backpack crateHue and findtype "studded gloves" backpack crateHue and findtype "studded gorget" backpack crateHue and findtype "studded cap" backpack crateHue and findtype "studded leggings" backpack crateHue415        setvar! crateArmorSerial localArmor416    elseif 3 = crateArmorType and findtype "bone armor" backpack crateHue as localArmor and findtype "bone arms" backpack crateHue and findtype "bone gloves" backpack crateHue and findtype "bone gorget" backpack crateHue and findtype "bone helmet" backpack crateHue and findtype "bone legs" backpack crateHue417        setvar! crateArmorSerial localArmor418    elseif 4 = crateArmorType and findtype "ringmail tunic" backpack crateHue as localArmor and findtype "ringmail sleeves" backpack crateHue and findtype "ringmail gloves" backpack crateHue and findtype "ringmail gorget" backpack crateHue and findtype "helmet" backpack crateHue and findtype "ringmail leggings" backpack crateHue419        setvar! crateArmorSerial localArmor420    elseif 5 = crateArmorType and findtype "chainmail tunic" backpack crateHue as localArmor and findtype "chain arms" backpack crateHue and findtype "chain gloves" backpack crateHue and findtype "chain gorget" backpack crateHue and findtype "chainmail coif" backpack crateHue and findtype "chainmail leggings" backpack crateHue421        setvar! crateArmorSerial localArmor422    elseif 6 = crateArmorType and findtype "platemail" backpack crateHue as localArmor and findtype "platemail arms" backpack crateHue and findtype "platemail gloves" backpack crateHue and findtype "platemail gorget" backpack crateHue and findtype "plate helm" backpack crateHue and findtype "platemail legs" backpack crateHue423        setvar! crateArmorSerial localArmor424    else425        setvar! crateArmorSerial 0426    endif427 428    if 0 < crateArmorSerial429        while timer globalObjectDelayTimer < globalWaitForObjectDelay430        endwhile431        dclick localEmptyCrate432        settimer globalObjectDelayTimer 0433        wft globalWaitForServerResponse434        if targetexists435            target crateArmorSerial436        else437            settimer globalSafetyTimer globalTimeout438            continue439        endif440    else441        overhead "|* Missing armor pieces *|" cWarning442        sysmsg   "|* Missing armor pieces *|" cWarning443        break444    endif445 446    settimer globalSafetyTimer 0447    while gumpexists shelfGumpID and not insysmsg "You assemble an armor crate." and timer globalSafetyTimer < globalTimeout448        if insysmsg "Assembling armor crates require 6 armor items: one for each armor layer, with all being of exceptional quality, mastercrafted, fully repaired, and matching the 'crafted by' of the targeted item."449            overhead "|* Crafter mismatch *|"  cWarning450            sysmsg   "|* Crafter mismatch *|"  cWarning451            settimer globalSafetyTimer globalTimeout452        endif453    endwhile454    if not gumpexists shelfGumpID or timer globalSafetyTimer > globalTimeout455        overhead "|** Failed to build crate **|" cError456        sysmsg   "|** Failed to build crate **|" cError457        break458    endif459 460    //Status display461    if 1 = crateArmorType and counttype "leather crate" backpack crateHue as localCount462        overhead "Crate done ... {{localCount}}" crateHue463        sysmsg "Armor crate count: {{localCount}}" cSuccess464    elseif 2 = crateArmorType and counttype "studded crate" backpack crateHue as localCount465        overhead "Crate done ... {{localCount}}" crateHue    466        sysmsg "Armor crate count: {{localCount}}" cSuccess467    elseif 3 = crateArmorType and counttype "bone armor crate" backpack crateHue as localCount468        overhead "Crate done ... {{localCount}}" crateHue    469        sysmsg "Armor crate count: {{localCount}}" cSuccess470    elseif 4 = crateArmorType and counttype "ringmail crate" backpack crateHue as localCount471        overhead "Crate done ... {{localCount}}" crateHue    472        sysmsg "Armor crate count: {{localCount}}" cSuccess473    elseif 5 = crateArmorType and counttype "chainmail crate" backpack crateHue as localCount474        overhead "Crate done ... {{localCount}}" crateHue    475        sysmsg "Armor crate count: {{localCount}}" cSuccess476    elseif 6 = crateArmorType and counttype "platemail crate" backpack crateHue as localCount477        overhead "Crate done ... {{localCount}}" crateHue    478        sysmsg "Armor crate count: {{localCount}}" cSuccess479    endif480    481    poplist crateCounterList front482 483endwhile484 485//Clean up486if find myShelf ground -1 -1 2 or find myShelf self487    while findtype "empty armor crate" backpack as localCrate488        while timer globalObjectDelayTimer < globalWaitForObjectDelay489        endwhile490        @drop backpack -1 -1 -1491        @lift localCrate 60000492        settimer globalObjectDelayTimer 0493        @drop myShelf -1 -1 -1494        getlabel backpack waitForPing495    endwhile496endif497 498@clearignore499gumpclose shelfGumpID500removelist crateCounterList501removetimer globalSafetyTimer502removetimer globalObjectDelayTimer