[EasyUO] Simple Smelter

If you make a Client-side script you can publish it here for other players to use
Locked
Shindaril
Grandmaster Scribe
Posts: 96
Joined: Tue Jul 01, 2014 12:11 pm

[EasyUO] Simple Smelter

Post by Shindaril »

Long time since I've published any scripts, but this was requested by another player, so here it is. A working, easy to set up smelting script for all those items you loot or wish to smelt while training.

There is no setup required, but you can set the tool's item type and the container's ItemID in the first two lines of the script to avoid going through the setup and target those two every time you run the script. The item type for Smith's Hammer is OLH, so most will probably set it as %tool_type as those are what you get from the tool houses.

Code: Select all

set %tool_type N/A
set %bag N/A
WARNING! There is no check by the script to check what's actually in the container, so you should be sure to put only items which can be smelt into the container, otherwise the script will fail and run in a loop trying to smelt something you cannot smelt at all.

Code: Select all

; Shindaril's Smelter version b0.1
; No setup required, the script will ask you to point the
; container and the tool, so it should work with carpentry
; as well, but this is untested.
; The user needs to have the items in a container and
; tool in their main backpack and the container may only
; contain items which can be smelted.

; You can set the tool type and container's ID with the
; first two variables to avoid running the setup every
; time you run the script. The type for Smith's Hammer
; is OLH_


    set %tool_type N/A      ; This is the item type of Smith's Hammer, you can edit or add to the list if you're using other smithing tools
    set %bag N/A            ; You can edit this to your smeltable loot bag's ID to skip the setup every time you run the script


    initEvents

    gosub setup
    main:
    display OKCancel Click OK to begin smelting or $ Cancel to stop script
    if Cancel in #dispRes
    {
            halt
    }
    gosub smelt
    
    sub setup
        if %bag = N/A
        {
            display ok Target the container holding the items you wish to smelt
            set #lTargetID null
            set #TargCurs 1
            loot_bag:
            if #lTargetID = null
            {
                    goto loot_bag
            }
            set %bag #lTargetID
            set #lObjectID %bag
            event Macro 17
            wait 20
        }
        if %tool_type = N/A
        {
            display ok Target your Smith Hammer
            set #lTargetID null
            set #TargCurs 1
            smith_hammer:
            if #lTargetID = null
            {
                    goto smith_hammer
            }
            set %tool #lTargetID
            goto main
        }
        ;if %tool_type ! N/A
        {
            finditem %tool_type C_ , #BackPackID
            if #FINDCNT > 0
            {
               set %tool #FindID
               goto main
            }
        }
        display ok No tool found, halting...
        halt
    
    sub smelt
        set #lObjectID %tool
        event Macro 17
        start:
              wait 10
              finditem * C_ , %bag   ; You can set here if you wish to specify which item types are to be smelt
              if #FindKind = -1
              {
                    ignoreitem reset
                    click 300 300 r ; close Blacksmithy Menu gump to get it out of the way
                    display ok The bag is empty, halting...
                    halt
              }
              click 67 391 ;Smelt Button
              set #lTargetID #FindID
              wait 5
              event macro 22
              ;wait 10               ; You might need to change this based on your latency or lag
              goto start
        return
Locked