Cannith Deconstruction Script

SpartanKiller13

Why do I have 411 .ddocp files
Tired of clicking a bunch for every item you want to deconstruct? Want to do it in only one click? Here's a script for you!

Reposting my AutoHotkey (hereafter AHK) script so I don't have to keep using the old forums (old forum post).

Dev stance on scripts is that as long as it's an action a human can do, and there's a human at the keyboard they're ok with it. Especially QoL or enabling, like this isn't gaining any competitive advantage :)

There was a deconstruction QoL change sometime in 2022, so it saves which recipe you're working on; this makes scripting it a lot weirder, or you can just deconstruct one item manually before using this script. I want this script to be easily legible to most people so you know you're not going to break something, so I'll go with the second option for simplicity.

To use the script:
1) Make sure you have AHK downloaded.
2) Copy the code below into Notepad etc.
3) Save it as WhateverYouWant.ahk (mine is named Deconstructor).
4) Run the script (right click > run, or double click on it).
5) In DDO, go to the Item Deconstruction Device, open the interface.
6) Deconstruct one item manually (so you get the right recipe selected).
7) Shift+Right Click on the left-most grey box in the "Your Ingredients" tab (see image below). This sets the target location for the current usage.
8) Shift+Left Click on items you want gone. Repeat as necessary.
9) Press Escape to close script.

Repeat Steps 4-9 as needed!

bVNz99B.png


Code:
#SingleInstance Force                          ; prevents multiple instances of script
CoordMode, Mouse, Screen                       ; sets coordinates to absolute
#IfWinActive ahk_class Turbine Device Class    ; checks to make sure you're in DDO


SetupX :=                                      ; X position of drop point
SetupY :=                                      ; Y position of drop point
DissX :=                                       ; X position of dissolve point
DissY :=                                       ; Y position of dissolve point
DecoX :=                                       ; X position of deconstruct point
DecoY :=                                       ; Y position of deconstruct point

+RButton::                                     ; Shift-Right Click on left box of drop point to set up
MouseGetPos, SetupX, SetupY                    ; get current mouse X and Y position for setup
DissX := SetupX + 30                             
DissY := SetupY - 300
DecoX := SetupX + 200
DecoY := SetupY + 30
return

+LButton::                                     ; Shift+Left Click on item to be deconstructed
MouseGetPos, VarX, VarY                        ; get current mouse positon
BlockInput On                                  ; prevent user input
MouseClickDrag, L, , , %SetupX%, %SetupY%      ; click and drag to drop point
Sleep 250                                      ; wait, not always long enough
Click %DissX%, %DissY%                         ; click on dissolve
Sleep 80                                       ; brief delay
Click %DecoX%, %DecoY%                         ; click on deconstruct
MouseMove, %VarX%, %VarY%                      ; move mouse to start location
BlockInput Off                                 ; allow user input
return

Esc::                                          ; Escape closes this
ExitApp
Return

Just tested a fresh copy, works great for me. If your connection is good or bad, feel free to lower or raise the Sleep numbers as needed. If it's too fast you might have to click on an item again, no problems otherwise. Copy-pasting it from the forums might double-space your code, but it works just fine so no worries leaving it that way.

Let me know if you have any difficulties, questions, or suggestions :)
 

SpartanKiller13

Why do I have 411 .ddocp files
Doesn't the deconstruction device bug (won't accept item drags) every few deconstructs? Or is that just me?
I haven't previously had issues. Today I did like 10 items with no problems, but wasn't testing for that bug since I haven't had it. About how many does it take? I'll save up a stack of items and test lol.

If you're having more issues you can change the Exit hotkey to be more robust so you can exit out of the deconstruction thingy and just restart? I can't see any way using a script would be worse than manually doing it, but I could be missing something. This script is just dragging the stuff for you, so if that doesn't work then the script won't work.

Like:
+Esc:: ; shift-escape to close, so you don't close it by accident
ExitApp
Return
 

Rull

Well-known member
I haven't previously had issues. Today I did like 10 items with no problems, but wasn't testing for that bug since I haven't had it. About how many does it take? I'll save up a stack of items and test lol.

If you're having more issues you can change the Exit hotkey to be more robust so you can exit out of the deconstruction thingy and just restart? I can't see any way using a script would be worse than manually doing it, but I could be missing something. This script is just dragging the stuff for you, so if that doesn't work then the script won't work.

Like:
+Esc:: ; shift-escape to close, so you don't close it by accident
ExitApp
Return

After exactly one. I dragged an item in (manually) and the second item wasn't accepted. I had to close the crafting station and reopen it. Then after 4 or 5 it got stuck again and I sold the rest of the items to the vendor.

It feels random; sometimes I can do 20 without it freezing up (but not often).

Anyway, the script doesn't influence it (I think), but if the window doesn't open in the exact same spot, you have to restart and calibrate it again every time it freezes.
 

SpartanKiller13

Why do I have 411 .ddocp files
After exactly one. I dragged an item in (manually) and the second item wasn't accepted. I had to close the crafting station and reopen it. Then after 4 or 5 it got stuck again and I sold the rest of the items to the vendor.

It feels random; sometimes I can do 20 without it freezing up (but not often).

Anyway, the script doesn't influence it (I think), but if the window doesn't open in the exact same spot, you have to restart and calibrate it again every time it freezes.
It's definitely possible to search your screen for the crafting window, but that's beyond what I could easily explain to someone new to AHK so I'm not ok with putting that into a public script: "Yo download this I swear it's not malware..." (also I'd have to research a bunch)

Are you really low level in Cannith Crafting? Perhaps you're leveling and having the same issue as Dielzen above?

If your window does open in the same spot every time you can set preset values and not have to aim the script every time you run it, if that's helpful?
 

Lapras09

Member
Hey, I just tried your script and it semi-works. But instead of desconstructing the item, it keys them for crafting. Any idea how can I fix it?
 

SpartanKiller13

Why do I have 411 .ddocp files
Hey, I just tried your script and it semi-works. But instead of desconstructing the item, it keys them for crafting. Any idea how can I fix it?
Deconstruct one item first before using the script

A few years back they changed crafting stations so they remember your last recipe instead of listing them all.

Could set it up to image match etc, but that's a lot more complicated and less easy to understand, which I don't really like for a public script.

If that doesn't work let me know, and I'll look into it later
 

Lapras09

Member
Deconstruct one item first before using the script

A few years back they changed crafting stations so they remember your last recipe instead of listing them all.

Could set it up to image match etc, but that's a lot more complicated and less easy to understand, which I don't really like for a public script.

If that doesn't work let me know, and I'll look into it later
Yeah I deconstructed it first. I'm sure I followed every step, however, it's still clicking to key them for crafting. I've recorded a video to show. Sorry if it's not of the best quality.
 

SpartanKiller13

Why do I have 411 .ddocp files
Yeah I deconstructed it first. I'm sure I followed every step, however, it's still clicking to key them for crafting. I've recorded a video to show. Sorry if it's not of the best quality.
Hmm, can you try with the following? That way it'll click the second option on future runs instead of the first lol, like the OG script:
DissY := SetupY - 190

Instead of DissY := SetupY- 300?

I wonder if it has to do with pulling crafting mats from shared crafting storage or something. If I'm understanding your video correctly, you deconstruction window is listing all the recipes, unlike how it works for me lol.
 

Lapras09

Member
Hmm, can you try with the following? That way it'll click the second option on future runs instead of the first lol, like the OG script:
DissY := SetupY - 190

Instead of DissY := SetupY- 300?

I wonder if it has to do with pulling crafting mats from shared crafting storage or something. If I'm understanding your video correctly, you deconstruction window is listing all the recipes, unlike how it works for me lol.
This fixed the issue and works perfectly now, thank you so much! Back to clicking Loot All, it seems ? I'll just try to change the button to End, PageDown or something like that cause I keep hitting Esc to close every window and having to set the window all the time is a little annoying. Great work, loved it!
 

Lapras09

Member
Oh, if it's not too much to ask: can you please add another step that is clicking the "Clear" button, even if it's greyed out before the cursos going back to the previous position? I ask this because I run some alts that are lower level at crafting, and for some reason the cannith deconstruction material gets stuck there, I dont know why...
 

SpartanKiller13

Why do I have 411 .ddocp files
Oh, if it's not too much to ask: can you please add another step that is clicking the "Clear" button, even if it's greyed out before the cursos going back to the previous position? I ask this because I run some alts that are lower level at crafting, and for some reason the cannith deconstruction material gets stuck there, I dont know why...
Add these three sections to the relevant portions (the start where variable are defined, the setup portion where the variables get filled, and between clicking Deconstruct & the MouseMove command - just add it as two new lines). You might not need the delay but I generally have better success with having some time between steps.

You'll also have to aim more in the center of the red box for the Setup step (since the Clear button is small) but should work fine.

Code:
ClearX :=                                       ; X position of Clear button
ClearY :=                                       ; Y position of Clear button

ClearX := SetupX
ClearY := SetupY + 30

Sleep 80                                        ; adjust this as needed, it is time in milliseconds
Click %ClearX%, %ClearY%                        ; click on Clear
 

Lapras09

Member
So, after some testing I've found that that if I keep the cannith dissolver inside an Ingredientes Bag, the bug won't happen and Clear button doesn't need to be clicked as there'll be no remanescent material in the spaces. If they're placed inside an Igredientes Bag and even removed right after, it should work just fine. So, a heads up for anyone using it: don't keep the dissolve materials in your main bag, toss it into an Ingredient Bag first.

Add these three sections to the relevant portions (the start where variable are defined, the setup portion where the variables get filled, and between clicking Deconstruct & the MouseMove command - just add it as two new lines). You might not need the delay but I generally have better success with having some time between steps.

You'll also have to aim more in the center of the red box for the Setup step (since the Clear button is small) but should work fine.

Code:
ClearX :=                                       ; X position of Clear button
ClearY :=                                       ; Y position of Clear button

ClearX := SetupX
ClearY := SetupY + 30

Sleep 80                                        ; adjust this as needed, it is time in milliseconds
Click %ClearX%, %ClearY%                        ; click on Clear

This code worked just fine. However, after 1 or 2 deconstructions the item is sloted in the right place but the Cannith machine simply won't recognize it, even if I placed the item there manually lol So, I can say the first version without adding clear works just fine IF the requeriments said above are fulfied. Which, in all honesty, is perfectly fine by me. So, thank you again immensily for the script!
 

SpartanKiller13

Why do I have 411 .ddocp files
So, after some testing I've found that that if I keep the cannith dissolver inside an ingredients Bag, the bug won't happen and Clear button doesn't need to be clicked as there'll be no remanescent material in the spaces. If they're placed inside an ingredients Bag and even removed right after, it should work just fine. So, a heads up for anyone using it: don't keep the dissolve materials in your main bag, toss it into an Ingredient Bag first.

This code worked just fine. However, after 1 or 2 deconstructions the item is slotted in the right place but the Cannith machine simply won't recognize it, even if I placed the item there manually lol So, I can say the first version without adding clear works just fine IF the requirements said above are fulfilled. Which, in all honesty, is perfectly fine by me. So, thank you again immensely for the script!
Thanks for testing! It's been some weird interaction for a while so thanks for figuring it out :)

Glad to help! Figured I know the basics of scripting and I was using it, might as well help some other people.
 
Top