Something awesome is comming, guys. It's a big-ass one.
What does it do at the moment:
- craft 40 shoes
- walks to seller
- sells all shoes
- runs back to loom for crafting
- craft and sell 40 shoes again and runs back to loom
- Walks to guild master
- Gets 160 linen and 80 leather from guild stash
- walks back to loom (then loop to step 1 again)
I am still testing it on some other machines, but here is the semi-final version! It works awesome on my machine!
Improvements done to code in the latest version:
- Human delay
- Optimized crafting speed so the soma client will surely not shut down due to fast clicking
- Quick restart (press esc key to restart the macro)
- General functions in code, it is now written in 360 lines instead of 600+
- During item selling it used to sell 40 items, introduced a way that the macro just checks if there are still items left to be sold, so any amount from item 3 will be sold.
Ideas for next versions, but still with some programmatical problems:
- The macro now just crafts 40 items, I'm thinking of introducing a check if the crafting material is gone; based on the emptieness of the crafting box, a new craft can begin. This could increase the craft speed. Problem here is the variable binding within the function (in code) to the amount of loops already done. So with a bit of luck: to be continued.
- Sometimes a certain wandering NPC gets in the way. I'm thinking of introducing a way to pause the macro and later on resuming it. You can then walk to the correct next spot, resume the macro, press SHIFT untill the macro is beginning the next call. This way you don't have to begin the whole macro again... So: To be continued after previous functions have been implemented.
This code has been tested and works.
Code:
begin
Window.Get location("Soma Mythological Biography", "No", "no", "WinX", "WinY")
Window.Wait for window to appear("soma mythological biography", "no")
// Insert amount of second items to grab from guild stash
Variable.Set("Craft_Left_Item_Amount", "2")
// insert your amount of items to insert as first item
Variable.Set("Craft_Right_Item_Amount", "1")
// Insert your amount of items to insert as second item
begin loop()
Keyboard.Wait for keys to be held down("{<alt>}")
// ALT+1 will do the follwing: Craft 40 shoes
// be sure to stand on spot x:323 y:73 with 162 linen & 82 leather (so 2 more then needed!!)
if Keyboard.Key is held down("1")
begin loop("1")
// Begin Crafting
Function.Execute("craftArmour")
// End Crafting
end
// ALT+2 Will do the following: Sell all items sitting on spot 3
if Keyboard.Key is held down("2")
begin
Function.Execute("Sell_Item_In_Seller")
end
// ALT+3 Will do 2 runs: 2x (Craft 40 shoes, run to seller, sell them and run back to loom)
// be sure to stand on spot x:323 y:73 with 162 linen & 82 leather (so always 2 more then needed!!)
// You also need to have your running set to on (so press the control button, that the run lights up).
if Keyboard.Key is held down("3")
begin loop("2")
// Begin Crafting
Keyboard.Press key("{<controlkey>}")
Function.Execute("craftArmour")
Keyboard.Press key("{<controlkey>}")
// End Crafting
// begin Walk to seller and back
Function.Execute("WalkSeller_Sell_WalkBack")
// back at loom, came from seller
end
// //
// //
// // Begin region button 4!!
// // ALT+4 will do the following: 2 runs, then collect from Guild Stash
// // be sure to stand on spot x:323 y:73 with at least 162 linen & 82 leather (so always 2 more then needed!!)
// You need these 2 extra mats so these mats will always be on thesame spot in your private stash.
// You also need to have your running set to on (so press the control button, that the run lights up).
// //
if Keyboard.Key is held down("4")
begin loop("4")
// Outer loop is for walking to guild stash and begin a run
begin loop("2")
// Inner loop is for your run + sell
// Begin Crafting
Macro.Pause("550")
Keyboard.Press key("{<controlkey>}")
Function.Execute("craftArmour")
Keyboard.Press key("{<controlkey>}")
// End crafting items
// begin Walk to seller and back
Function.Execute("WalkSeller_Sell_WalkBack")
// back at loom, came from seller
end
// begin walk to guild stash
Function.Execute("WalkToGuildStashAndBack")
// WALK TO GUILD STASH, GET MATS AND COME BACK
Function.Execute setting 1 variable("ExitFunction", "input", "5000")
end
end
end
function("ExitFunction")
begin
if Keyboard.Keys has been pressed within (ms)("{<esc>}", "{input}")
begin
Macro.Restart("Yes")
end
end
function
function("WalkToGuildStashAndBack")
begin
Window.Get location("Soma Mythological Biography", "No", "no", "WinX", "WinY")
// !!! WALK FROM LOOM TO GUILD STASH, GET MATS AND GO BACK TO LOOM
Variable.Evaluate (Math)("{WinX} + 440", "x1")
// Walk from Loom to Guild Master x
Variable.Evaluate (Math)("{WinY} + 530", "y1")
// Walk from Loom to Guild Master y
Variable.Evaluate (Math)("{WinX} + 30", "x2")
// Walk from Loom to Guild Master x
Variable.Evaluate (Math)("{WinY} + 445", "y2")
// Walk from Loom to Guild Master y
Variable.Evaluate (Math)("{WinX} + 173", "x3")
// Walk from Loom to Guild Master x
Variable.Evaluate (Math)("{WinY} + 413", "y3")
// Walk from Loom to Guild Master y
Variable.Evaluate (Math)("{WinX} + 355", "x4")
// Click Guild Master NPC x
Variable.Evaluate (Math)("{WinY} + 165", "y4")
// Click Guild Master NPC y
Variable.Evaluate (Math)("{WinX} + 355", "x5")
// Click Guild Master in x
Variable.Evaluate (Math)("{WinY} + 158", "y5")
// Click Guild Master in y
Variable.Evaluate (Math)("{WinX} + 315", "x5l")
// Click Guild Stash X
Variable.Evaluate (Math)("{WinY} + 125", "y5l")
// Click guild stash Y
Variable.Evaluate (Math)("{WinX} + 280", "x6")
// Left Item from GS x
Variable.Evaluate (Math)("{WinY} + 235", "y6")
// Left Item from GS y
Variable.Evaluate (Math)("{WinX} + 335", "x8")
// Right Item from GS x
Variable.Evaluate (Math)("{WinY} + 235", "y8")
// Right item from GS y
Variable.Evaluate (Math)("{WinX} + 220", "x7")
// Draw from GS x
Variable.Evaluate (Math)("{WinY} + 380", "y7")
// Draw from GS y
Variable.Evaluate (Math)("{WinX} + 800", "x9")
// Walk right from Guild Master x
Variable.Evaluate (Math)("{WinY} + 260", "y9")
// Walk right from Guild Master y
Variable.Evaluate (Math)("{WinX} + 475", "x10")
// Walk from Guild Master to Loom x
Variable.Evaluate (Math)("{WinY} + 75", "y10")
// Walk from Guild Master to Loom y
Variable.Evaluate (Math)("{WinX} + 340", "x11")
// Walk from Guild Master to Loom x
Variable.Evaluate (Math)("{WinY} + 30", "y11")
// Walk from Guild Master to Loom y
Variable.Evaluate (Math)("{WinX} + 475", "x12")
// Walk from Guild Master to Loom x
Variable.Evaluate (Math)("{WinY} + 197", "y12")
// Walk from Guild Master to Loom y
// BEGIN WALKING
Function.Execute setting 1 variable("random_pause", "input", "550")
Mouse.Click at coordinate("{x1}", "{y1}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x1}", "{y1}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x2}", "{y2}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x2}", "{y2}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x3}", "{y3}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x4}", "{y4}", "left")
Function.Execute setting 1 variable("random_pause", "input", "1750")
Mouse.Click at coordinate("{x5}", "{y5}", "left")
Function.Execute setting 1 variable("random_pause", "input", "1750")
Mouse.Click at coordinate("{x5l}", "{y5l}", "left")
Function.Execute setting 1 variable("random_pause", "input", "1750")
Mouse.Click at coordinate("{x8}", "{y8}", "left")
Function.Execute setting 1 variable("random_pause", "input", "575")
Function.Execute setting 1 variable("ExitFunction", "input", "5000")
Mouse.Click at coordinate("{x7}", "{y7}", "left")
Macro.Pause("550")
// !!!!!!!! GUILD STASH RIGHT ITEM AMOUNT
Keyboard.Insert text("160")
// !!!!!!!! GUILD STASH RIGHT ITEM AMOUNT
Macro.Pause("550")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Keyboard.Press key("{<return>}")
Macro.Pause("550")
Mouse.Click at coordinate("{x6}", "{y6}", "left")
Macro.Pause("550")
Mouse.Click at coordinate("{x7}", "{y7}", "left")
Macro.Pause("550")
// !!!!!!!! GUILD STASH LEFT ITEM AMOUNT
Keyboard.Insert text("80")
// !!!!!!!! GUILD STASH LEFT ITEM AMOUNT
Macro.Pause("550")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Keyboard.Press key("{<return>}")
Function.Execute setting 1 variable("random_pause", "input", "550")
Keyboard.Press key("{<esc>}")
Function.Execute setting 1 variable("random_pause", "input", "1250")
Mouse.Click at coordinate("{x9}", "{y9}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x9}", "{y9}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Function.Execute setting 1 variable("ExitFunction", "input", "5000")
Mouse.Click at coordinate("{x10}", "{y10}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Mouse.Click at coordinate("{x11}", "{y11}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
Function.Execute setting 1 variable("ExitFunction", "input", "5000")
Mouse.Click at coordinate("{x12}", "{y12}", "left")
Function.Execute setting 1 variable("random_pause", "input", "3750")
end
function
function("Sell_Item_In_Seller")
begin
Variable.Evaluate (Math)("{WinX} + 95", "x")
Variable.Evaluate (Math)("{WinY} + 265", "y")
while Color.At coordinate is not within (RGB range)("41", "52", "49", "10", "{x}", "{y}")
begin
Variable.Evaluate (Math)("{WinX} + 90", "xx1")
Variable.Evaluate (Math)("{WinY} + 265", "yy1")
Mouse.Set coordinate("{xx1}", "{yy1}")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Mouse.Click("Left")
Function.Execute setting 1 variable("random_pause", "input", "95")
Variable.Evaluate (Math)("{WinX} + 215", "xx2")
Variable.Evaluate (Math)("{WinY} + 270", "yy2")
Mouse.Set coordinate("{xx2}", "{yy2}")
Function.Execute setting 1 variable("random_pause", "input", "95")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Mouse.Click("Left")
Function.Execute setting 1 variable("random_pause", "input", "95")
end
Macro.Pause("250")
end
function
function("random_pause")
begin
Variable.Evaluate (Math)("{input}*3/2", "varRandom2")
Variable.Set random number("rnd", "{input}", "{varRandom2}")
Macro.Pause("{rnd}")
end
function
function("craftArmour")
begin
Window.Get location("Soma Mythological Biography", "No", "no", "WinX", "WinY")
Variable.Evaluate (Math)("{WinX} + 565", "xx1")
Variable.Evaluate (Math)("{WinY} + 275", "yy1")
Macro.Pause("50")
Mouse.Click at coordinate("{xx1}", "{yy1}", "left")
Function.Execute setting 1 variable("random_pause", "input", "200")
Function.Execute setting 1 variable("ExitFunction", "input", "1500")
Variable.Evaluate (Math)("{WinX} + 300", "xx1")
Variable.Evaluate (Math)("{WinY} + 155", "yy1")
Mouse.Set coordinate("{xx1}", "{yy1}")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Macro.Pause("100")
Mouse.Click("Left")
Macro.Pause("50")
Variable.Evaluate (Math)("{WinX} + 105", "xx1")
Variable.Evaluate (Math)("{WinY} + 275", "yy1")
Mouse.Click at coordinate("{xx1}", "{yy1}", "left")
Macro.Pause("150")
Keyboard.Insert text("Magic Shoes")
Function.Execute setting 1 variable("random_pause", "input", "200")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Keyboard.Press key("{<enter>}")
Function.Execute setting 1 variable("random_pause", "input", "200")
Function.Execute("ExitIf2000")
begin loop("40")
Function.Execute setting 1 variable("random_pause", "input", "140")
Variable.Evaluate (Math)("{WinX} + 105", "xx1")
Variable.Evaluate (Math)("{WinY} + 415", "yy1")
Variable.Evaluate (Math)("{WinX} + 90", "xx2")
Variable.Evaluate (Math)("{WinY} + 225", "yy2")
Mouse.Set coordinate("{xx1}", "{yy1}")
Mouse.Hold button("Left")
Macro.Pause("70")
Mouse.Set coordinate("{xx2}", "{yy2}")
Mouse.Release button("Left")
Macro.Pause("140")
Keyboard.Type text("{Craft_Left_Item_Amount}")
Macro.Pause("125")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Keyboard.Press key("{<enter>}")
Macro.Pause("250")
Variable.Evaluate (Math)("{WinX} + 160", "xx1")
Variable.Evaluate (Math)("{WinY} + 415", "yy1")
Variable.Evaluate (Math)("{WinX} + 90", "xx2")
Variable.Evaluate (Math)("{WinY} + 225", "yy2")
Mouse.Set coordinate("{xx1}", "{yy1}")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Mouse.Hold button("Left")
Macro.Pause("70")
Mouse.Set coordinate("{xx2}", "{yy2}")
Mouse.Release button("Left")
Macro.Pause("140")
Keyboard.Type text("{Craft_Right_Item_Amount}")
Macro.Pause("125")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Keyboard.Press key("{<enter>}")
Macro.Pause("250")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
Variable.Evaluate (Math)("{WinX} + 325", "xx1")
Variable.Evaluate (Math)("{WinY} + 280", "yy1")
Mouse.Click at coordinate("{xx1}", "{yy1}", "Left")
Macro.Pause("50")
Mouse.Click at coordinate("{xx1}", "{yy1}", "Left")
Macro.Pause("350")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
end
end
function
function("WalkSeller_Sell_WalkBack")
begin
// Walk to Seller, sell everything and go back to loom!
Macro.Pause("500")
Keyboard.Press key("{<esc>}")
Window.Get location("Soma Mythological Biography", "No", "no", "WinX", "WinY")
Variable.Evaluate (Math)("{WinX} + 710", "x1")
// Under x
Variable.Evaluate (Math)("{WinY} + 509", "y1")
// Under y
Variable.Evaluate (Math)("{WinX} + 590", "x2")
// Next to Seller x
Variable.Evaluate (Math)("{WinY} + 360", "y2")
// Next to Seller y
Variable.Evaluate (Math)("{WinX} + 450", "x3")
// Click on Seller x
Variable.Evaluate (Math)("{WinY} + 360", "y3")
// Click on Seller y
Variable.Evaluate (Math)("{WinX} + 300", "x4")
// Open Sell Menu x
Variable.Evaluate (Math)("{WinY} + 150", "y4")
// Open Sell Menu y
Variable.Evaluate (Math)("{WinX} + 30", "x98")
// From seller to loom x
Variable.Evaluate (Math)("{WinY} + 90", "y98")
// From sellet to loom y
Variable.Evaluate (Math)("{WinX} + 35", "x99")
// to loom x
Variable.Evaluate (Math)("{WinY} + 100", "y99")
// to loom y
Function.Execute setting 1 variable("random_pause", "input", "2250")
Function.Execute setting 1 variable("ExitFunction", "input", "2000")
// BEGIN WALK FROM SELLER TO SELLER
Mouse.Click at coordinate("{x1}", "{y1}", "left")
Function.Execute setting 1 variable("random_pause", "input", "4500")
Function.Execute setting 1 variable("ExitFunction", "input", "4000")
Mouse.Click at coordinate("{x1}", "{y1}", "left")
Function.Execute setting 1 variable("random_pause", "input", "4500")
Function.Execute setting 1 variable("ExitFunction", "input", "4000")
Mouse.Click at coordinate("{x2}", "{y2}", "left")
Function.Execute setting 1 variable("random_pause", "input", "4500")
Function.Execute setting 1 variable("ExitFunction", "input", "4000")
Mouse.Click at coordinate("{x3}", "{y3}", "left")
Function.Execute setting 1 variable("random_pause", "input", "250")
Mouse.Click at coordinate("{x4}", "{y4}", "left")
Function.Execute setting 1 variable("random_pause", "input", "250")
Mouse.Click at coordinate("{x4}", "{y4}", "left")
// X:339 Y:91
// END WALK FROM LOOM TO SELLER
Function.Execute setting 1 variable("random_pause", "input", "1750")
// BEGIN SELL EVERYTHING
Function.Execute("Sell_Item_In_Seller")
// END SELL EVERYTHING
// BEGIN WALK FROM SELLER BACK TO LOOM
Function.Execute setting 1 variable("random_pause", "input", "1000")
Keyboard.Press key("{<esc>}")
Function.Execute setting 1 variable("random_pause", "input", "1000")
Mouse.Click at coordinate("{x98}", "{y98}", "left")
Function.Execute setting 1 variable("random_pause", "input", "5000")
Function.Execute setting 1 variable("ExitFunction", "input", "4000")
Mouse.Click at coordinate("{x99}", "{y99}", "left")
Function.Execute setting 1 variable("random_pause", "input", "5000")
// X: 323 Y: 73
// END WALK FROM SELLER BACK TO LOOM
end
function
Here you can already get a sneek peek of how it works on a video:
http://www.youtube.com/watch?v=p8z9cp3ocxcThis video shows how the function under hotkey ALT+4 works.
There are 4 hotkeys activated:
- ALT+1 = Craft 40 shoes
- ALT+2 = Sells any item from private stash to seller, make sure you have the seller screen available
- ALT+3 = Does 2 full runs of 40 shoes craft, run to seller, sell all shoes, run back to loom.
- ALT+4 = Does several loops of the following: 2 full runs, walk to Guild Master & take out mats, run back to loom.
For 1,3 and 4 make sure you look to the following things:
- Stand on Coordinates X: 323 Y: 73
- Make sure to have 162 linen and 82 leather in private stash
- Have your running set on in the beginnning! The macro will gather enough stamina during the craft (on alf+3 or 4)
- Make sure you always sit next to pc, when your char runs on some wrong coordinates because of blocking wandering users or npcs, the macro cannot continue; use the esc to stop it then.
If you guys have more ideas for future versions, just give me a shout!