[Release] Metallurgy Bot Beta

03/30/2010 16:12 casshem#241
dio, upload your script bro. I really can't get this to function with mabi on windows 7 32 bit @-@. Look at my bmp; I don't see what's wrong with it:

[Only registered and activated users can see links. Click Here To Register...]

That .bmp was taken during daylight hours while holding down alt...and it still doesn't work.

[Edit] Woot, I got it working now. The only problem I'm no confronting is the fact it's not picking up the ores, but that's because I didn't make my own .bmps. Wish me luck.

[Edit#2] I made my own custom ore.bmp, but the bot still doesn't pickup the ores. All it does is go to all the site.bmp and doesn't collect anything. This is the script I am using:
Quote:
#include <ImageSearch.au3>
Global $Paused
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
MsgBox(0,"Metallurgy Bot","Click OK and then bring up the Mabinogi window")
sleep(2000)
Send("{ALTDOWN}")
While 1
$x=0
$y=0
$result = _ImageSearch("site.BMP",1,$x,$y,60)
if $result=1 Then
Send("{ALTUP}")
Send("{F9}")
sleep(4000)
MouseClick("left",$x,$y,3)
Sleep(15000)
Send("{ALTDOWN}")
$x=0
$y=0
$result = 0
$result = _ImageSearch("ore.BMP",1,$x,$y,120)
If $result=1 Then
MouseClick("left",$x,$y)
sleep(3000)
EndIf
EndIf
WEnd
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc
03/30/2010 16:47 diometer#242
This is the source code that I use. The reason why I have been hesitating to post it is because there is a bug during which I try to swap out the broken sieves but it fails sometimes. I have not debugged it yet because I have been lazy, I'll post an updated version once I fix that.

My code works if you position your mabi window to the top left corner of your destop as I use _ImageSearchArea to make it faster so some positioning is required. But I'm sure the brighter of us will be able to pick apart my code anyway ;).

Quote:
#include <ImageSearch.au3>
; change the following to YOUR game resolution!
Global $width = 1280
Global $height = 720
;Global $width = 1840
;Global $height = 1048
Global $quick_search = 1
Global $Paused
Global $x
Global $y
Global $site_x
Global $site_y
Global $ore_x
Global $ore_y
Global $broken_x
Global $broken_y
Global $new_x
Global $new_y
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;MsgBox(0,"starting","press ok")
sleep(2000)

While 1

$hud = _ImageSearch("hud.BMP",1,$x,$y,60)
If $hud=1 Then
Sleep(500)
Send("{\ 1}")
Sleep(500)
EndIf
$hud=0

Send("{ALTDOWN}")

If $quick_search=1 Then
$site = _ImageSearchArea("gold.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
If $site=0 Then
$site = _ImageSearchArea("silver.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
;$site = _ImageSearchArea("iron.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
EndIf
Else
$site = _ImageSearch("gold.BMP",1,$site_x,$site_y,60) OR _ImageSearch("silver.BMP",1,$site_x,$site_y,60)
;$site = _ImageSearch("gold.BMP",1,$site_x,$site_y,60) OR _ImageSearch("iron.BMP",1,$site_x,$site_y,60)
$quick_search = 1
EndIf

If $site=1 Then
Send("{ALTUP}")
Sleep(500)
Send("{F1 5}")
Sleep(1000)
$broken = _ImageSearchArea("broken.BMP",1,$width/2+10-230,$height/2+30-50,$width/2+10+230,$height/2+30+50,$broken_x,$broken_y,150)
;$broken = _ImageSearch("broken.BMP",1,$broken_x,$broken_y,15 0)
If $broken=1 Then
Send("{i 1}")
Sleep(500)
MouseMove(0,0)
$broken_tool = _ImageSearch("broken_tool.BMP",1,$broken_x,$broken _y,80)
If $broken_tool=1 Then
$new = _ImageSearch("new_sieve.BMP",1,$new_x,$new_y,80)
If $new=1 Then
MouseMove($broken_x,$broken_y,10)
Sleep(50)
MouseClick("left",$broken_x,$broken_y,0)
Sleep(1000)
MouseMove($new_x,$new_y,10)
Sleep(50)
MouseClick("left",$new_x,$new_y,0)
Sleep(1000)
MouseMove($broken_x,$broken_y,10)
Sleep(50)
MouseClick("left",$broken_x,$broken_y,0)
Sleep(1000)
Else
Terminate()
EndIf
$new = 0
EndIf
$broken_tool = 0
Send("{i 1}")
Sleep(500)
ContinueLoop
Else
Sleep(3000)
MouseClick("left",$site_x,$site_y,3)
if $quick_search=1 Then
Sleep(12000)
Else
Sleep(15000)
EndIf
EndIf
$broken=0

Send("{ALTDOWN}")
$ore = _ImageSearchArea("ore.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $ore = _ImageSearch("ore.BMP",1,$ore_x,$ore_y,100)
If $ore=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$ore=0

$ore2 = _ImageSearchArea("ore.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $ore2 = _ImageSearch("ore.BMP",1,$ore_x,$ore_y,100)
If $ore2=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$ore2=0

$garnet = _ImageSearchArea("garnet.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $garnet = _ImageSearch("garnet.BMP",1,$ore_x,$ore_y,100)
If $garnet=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$garnet=0

$topaz = _ImageSearchArea("topaz.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $topaz = _ImageSearch("topaz.BMP",1,$ore_x,$ore_y,100)
If $topaz=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$topaz=0

$emerald = _ImageSearchArea("emerald.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $emerald = _ImageSearch("emerald.BMP",1,$ore_x,$ore_y,100)
If $emerald=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$emerald=0

$spinel = _ImageSearchArea("spinel.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $spinel = _ImageSearch("spinel.BMP",1,$ore_x,$ore_y,100)
If $spinel=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$spinel=0

$diamond = _ImageSearchArea("diamond.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $diamond = _ImageSearch("diamond.BMP",1,$ore_x,$ore_y,100)
If $diamond=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$diamond=0

Send("{ALTUP}")
Sleep(500)
Else
MouseClickDrag("right",600,350,650,350)
$quick_search = 0
Sleep(500)
EndIf
WEnd

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
Sleep(2000)
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc
Everything included with MY set of screenshots: [Only registered and activated users can see links. Click Here To Register...]
03/30/2010 17:34 casshem#243
*Clap Clap Clap* Nice work! I am very impressed with the amount of effort you put into the detail of this bot. It is almost self sustaining with the fact that it switches sieves within it's own inventory. The only problem I see with that is if the user doesn't have premium services because the bot would run out of ore space before it uses up all of its sieves. Then again, *light bulb flashes above head* you could have a trade box with yourself opened that handles the sieves!!!

Time to work on my own set of .bmp and test out what seems to be a very beautiful bot.
03/30/2010 17:38 diometer#244
It doesn't help in terms of speed because you have to search that many times if you want to pick up more than 1 item anyway. And! I like seeing that I got diamonds :>.

[EDIT] Actually I lied, you are right, it will help with time (I forgot that only 1 type of gem drops at a time). Excellent suggestion. I will just change the names of all the gems to be labeled with Jewel.

Plus, I'm limiting my searching area to a 200x200 pixel box around the centre of the screen anyway, so it's fast :). This also helps when some one else is around you and you don't start trying to pick up their items.

[EDIT2] Yea I'm using extended inventory. Right now I'm using an alt off my main account but I started working on an alt on a separate account. It is possible to get r1 prod mastery and r6 metallurgy with a few free RBs and be under lvl 30. It's just a bit tedious xD.

[EDIT3] The bot does get stuck sometimes when you run out of spawns. My new version "should" fix that but nothing for now. The run time for this bot with 7 sieves is around 2 hours before it dies (should everything work perfectly).
03/30/2010 18:07 casshem#245
Quote:
Originally Posted by diometer View Post
It doesn't help in terms of speed because you have to search that many times if you want to pick up more than 1 item anyway. And! I like seeing that I got diamonds :>.

[EDIT] Actually I lied, you are right, it will help with time (I forgot that only 1 type of gem drops at a time). Excellent suggestion. I will just change the names of all the gems to be labeled with Jewel.

Plus, I'm limiting my searching area to a 200x200 pixel box around the centre of the screen anyway, so it's fast :). This also helps when some one else is around you and you don't start trying to pick up their items.

[EDIT2] Yea I'm using extended inventory. Right now I'm using an alt off my main account but I started working on an alt on a separate account. It is possible to get r1 prod mastery and r6 metallurgy with a few free RBs and be under lvl 30. It's just a bit tedious xD.

[EDIT3] The bot does get stuck sometimes when you run out of spawns. My new version "should" fix that but nothing for now. The run time for this bot with 7 sieves is around 2 hours before it dies (should everything work perfectly).
You could just put "Ore" in the names of the jewels and have it check the screen three times. 2 for actual ores and a third in case you had two ores drop + a gem like this:

Quote:
#include <ImageSearch.au3>
Global $width = 1280
Global $height = 720
;Global $width = 1840
;Global $height = 1048
Global $quick_search = 1
Global $Paused
Global $x
Global $y
Global $site_x
Global $site_y
Global $ore_x
Global $ore_y
Global $broken_x
Global $broken_y
Global $new_x
Global $new_y
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;MsgBox(0,"starting","press ok")
sleep(2000)

While 1

$hud = _ImageSearch("hud.BMP",1,$x,$y,60)
If $hud=1 Then
Sleep(500)
Send("{\ 1}")
Sleep(500)
EndIf
$hud=0

Send("{ALTDOWN}")

If $quick_search=1 Then
$site = _ImageSearchArea("gold.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
If $site=0 Then
$site = _ImageSearchArea("silver.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
;$site = _ImageSearchArea("iron.BMP",1,$width/8+10,$height/4+30,$site_x+$width/4*3,$site_y+$height/2,$site_x,$site_y,60)
EndIf
Else
$site = _ImageSearch("gold.BMP",1,$site_x,$site_y,60) OR _ImageSearch("silver.BMP",1,$site_x,$site_y,60)
;$site = _ImageSearch("gold.BMP",1,$site_x,$site_y,60) OR _ImageSearch("iron.BMP",1,$site_x,$site_y,60)
$quick_search = 1
EndIf

If $site=1 Then
Send("{ALTUP}")
Sleep(500)
Send("{F1 5}")
Sleep(1000)
$broken = _ImageSearchArea("broken.BMP",1,$width/2+10-230,$height/2+30-50,$width/2+10+230,$height/2+30+50,$broken_x,$broken_y,150)
;$broken = _ImageSearch("broken.BMP",1,$broken_x,$broken_y,15 0)
If $broken=1 Then
Send("{i 1}")
Sleep(500)
MouseMove(0,0)
$broken_tool = _ImageSearch("broken_tool.BMP",1,$broken_x,$broken _y,80)
If $broken_tool=1 Then
$new = _ImageSearch("new_sieve.BMP",1,$new_x,$new_y,80)
If $new=1 Then
MouseMove($broken_x,$broken_y,10)
Sleep(50)
MouseClick("left",$broken_x,$broken_y,0)
Sleep(1000)
MouseMove($new_x,$new_y,10)
Sleep(50)
MouseClick("left",$new_x,$new_y,0)
Sleep(1000)
MouseMove($broken_x,$broken_y,10)
Sleep(50)
MouseClick("left",$broken_x,$broken_y,0)
Sleep(1000)
Else
Terminate()
EndIf
$new = 0
EndIf
$broken_tool = 0
Send("{i 1}")
Sleep(500)
ContinueLoop
Else
Sleep(3000)
MouseClick("left",$site_x,$site_y,3)
if $quick_search=1 Then
Sleep(12000)
Else
Sleep(15000)
EndIf
EndIf
$broken=0

Send("{ALTDOWN}")
$ore = _ImageSearchArea("ore.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $ore = _ImageSearch("ore.BMP",1,$ore_x,$ore_y,100)
If $ore=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$ore=0

$ore2 = _ImageSearchArea("ore.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $ore2 = _ImageSearch("ore.BMP",1,$ore_x,$ore_y,100)
If $ore2=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$ore2=0

$ore3 = _ImageSearchArea("ore.BMP",1,$width/2+10-100,$height/2+30-100,$width/2+10+100,$height/2+30+100,$ore_x,$ore_y,100)
; $ore2 = _ImageSearch("ore.BMP",1,$ore_x,$ore_y,100)
If $ore3=1 Then
MouseClick("left",$ore_x,$ore_y)
MouseMove($ore_x,$ore_y-50)
Sleep(300)
EndIf
$ore3=0


Send("{ALTUP}")
Sleep(500)
Else
MouseClickDrag("right",600,350,650,350)
$quick_search = 0
Sleep(500)
EndIf
WEnd

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
Sleep(2000)
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc

Also, I see what you mean by the searching area. It seems like a good idea, but I'll have to see how that actually works out.

[Edit 2] I love how you just took this project under your wing; you've made some really great improvements...actually, you revamped the whole damn original script and how it flows xD!
03/30/2010 18:21 diometer#246
Ok basically, in my V2 of this code (which uses a completely different action order in terms of loading skill and everything to optimize speed). I will be searching indefinitely until I pick up all the loot that I found. The reason why I opted to not rename gems as ore is simply because it feels like an insult to the gems :<. You CAN very well do it and make a "simpler" code but meh? XD
03/30/2010 18:41 casshem#247
I'll keep working on your old script as I think it has great potential if coupled with the itemdb trick mention by someone other than me in this thread.

Are you going to keep the switching sieves feature in v2? It was a rather good idea as it makes the bot more independent. Also, in v1, do you have to start off with your inventory opened?
03/30/2010 18:51 diometer#248
No you need to start off with you inv closed. I will keep all the features here ofc and only add new ones in V2. Basically other than optimizing the order in which we do things, I'm going to add in various checks like making sure inventory is open when switching... etc, etc.

[EDIT] You should search for ores 4x. Diamonds can drop at the same time as gems :P.
03/30/2010 18:54 aclazer#249
Nice job :awesome: im quite impressed that someone actually released something useful for once and for a keylogger
03/30/2010 20:51 diometer#250
MetallurgyV2 Alpha is almost ready. I will test it when I get home.

New Features:
- Window can be placed anywhere on screen as long as its still within the monitor
- Window size independence
- Location reset if metallurgist gets stuck in a spot with no ores
- 3 different site search radii
- Completely new run order
- Picks up any and all drops <- used with itemdb.xml appending of Ore to each name
- Sieve switching should always work now
- Improved speed of searching by limiting search area for pretty much everything
- No longer "waiting" for skill to finish, looks at skill bubble to know what to do <- this requires some testing
- Attempt to make bot "multi-task"
- Auto switch to Mabi window at start
- Pauses script when Mabi window loses focus

I believe thats all the features for now. Maybe you guys can come up with some new ideas.
03/30/2010 21:45 casshem#251
Wow, looks promising; can't wait until you get home. Just make sure you don't run into anymore accidents :x

I do have 1 suggestion: Try and create a way for the bot to eat inv food by pressing ctrl+k because hunger affects drop rate (not sure if that's correct or not).
03/30/2010 22:01 diometer#252
I have never heard of hunger affecting anything before except your SP pool. And metallurgy doesn't use enough SP to really make it a concern. At least, I have never noticed the drop rate of my gems to go down when I bot for long periods of time.

[EDIT] I am looking through the itemdb.xml file. I located the information for these items but cannot find where it defines the name it displays when its on the floor. Is it in another file?

[EDIT2] ^ Scratch that, found the location for the change.
03/30/2010 23:31 casshem#253
Quote:
Originally Posted by diometer View Post
I have never heard of hunger affecting anything before except your SP pool. And metallurgy doesn't use enough SP to really make it a concern. At least, I have never noticed the drop rate of my gems to go down when I bot for long periods of time.

[EDIT] I am looking through the itemdb.xml file. I located the information for these items but cannot find where it defines the name it displays when its on the floor. Is it in another file?

[EDIT2] ^ Scratch that, found the location for the change.
Make sure it looks something like this:
Quote:
Text_Name1="Topaz Ore" Generation="7"
Original:
Quote:
Text_Name0="Topaz" Generation="7"
03/30/2010 23:34 diometer#254
What mine now looks like:

Code:
<Mabi_Item ID="64042" DB_StoreType="1" Category="/jewel/topaz/" XML="<xml base_size="10" dropanimation="item_appear02" />" Text_Name0="Topaz" Generation="7" Season="3" SubSeason="0" Text_Name1="Topaz Ore" Text_Desc1="_LT[xml.itemdb.21864]" Bundle_Type="0" Bundle_Max="0" Price_Buy="10000" Price_Sell="0" Attr_ActionFlag="0" Attr_Type="1001" Attr_Grade="0" File_FieldMesh="item_Topaz_i" File_InvImage="item_Topaz" Inv_XSize="1" Inv_YSize="1" App_WeaponActionType="0" App_WearType="ss" App_UseC4Layer="true" App_Color1="73" App_Color2="73" App_Color3="73" App_ColorOrder="0" App_SittingType="0" Taste_Beauty="10" Taste_Indivisuality="5" Taste_Luxury="20" Taste_Toughness="-7" Taste_Utility="0" Taste_Rarity="0" Taste_Meaning="0" Taste_Adult="0" Taste_Maniac="0" Taste_Anime="0" Taste_Sexy="5" Par_BlockUseFlag="False" Food_BlockUseFlag="False" />
I'll test it when I get home. =/

[EDIT] <- not really an edit but didn't want to double post

Tested and debugged it, works MUCH MUCH MUCH faster than v1 of the bot. In v1 6 sieves unblessed lasts me 3 hours. I ran the new bot for 2 hours and broke 9 sieves. There are still some minor issues to be worked out but heres a basic pseudo code for people to chew on.

Code:
start char in a site with ores

search for a site

while 1
	load skill

	if tool broken
		change tool
		loot
		CONTINUE

	if skill not loading
		loot
		CONTINUE
		
	look for loots

	wait for skill to finish loading if not already

	click on dig site

	wait for skill to exit ready phase (start flashing)

	search for new site (while "sieving")

	if site found
		wait for skill bubble to disappear
	else
		rotate screen and try again 4x before bailing to fail state
		if fail state
			wait for skill to finish
			loot
			
			open map
			find reset location
			wait 18 seconds
			search for new site

	CONTINUE
Also, since I put around 12 hours of work into this new bot, and it works great. I do not wish to see a huge increase in metallurgy bots. When I started this v2 project, I had envisoned a bot, which when ran, will be almost indistinguishable from a human controlled metallurgist. I have yet to do a speed test with a human controlled metallurgist to see how well I have accomplished that goal but I am happy with results thus far. I am going to release a MetallurgyLite publicly (soon hopefully) which will NOT include location reset NOR sieve swapping. You may pm me if you want the full bot, but I may choose to ignore your request.

PS: casshem, I'll send you the full bot when I'm done.

[EDIT2] Going to start a new thread for my bot
03/31/2010 18:05 casshem#255
Once again, you've amazed me! :pimp: Good work (=b'.')=b