Thank you for the update. While you were "afk" I fixed it myself adding more than 1 yellow color too, I'm using like 10 different yellows and it's working great(Didn't lose ANY yellow items, I just need to drop some legendary to check the color to add to the "color list" if necessary too.
I don't want to sound rude or something like that, but I made some improvements in the code here and feel free to use them in this script if you want to, I guess it will help everyone, but it's your script, so it's up to you hahaha
I will explain everything that I changed, so if you think it's usefull somehow, as I said, feel free to use.
First, I made a array of the yellow colors, so we don't need to add a lot of "If LootItem($yellow1) Then", $yellow2, etc,etc
On Constant files, removed the $yellow variable and created an array and a variable to hold the array size, so we dont need to hardcode it in the GhomRun.au3
Ps: I'm not that good with pixels etc, so I kind checked a lot of yellow colors that might appear in the rare items(aka yellow loot), but it still fast to get them and in rare cases it find one of those colors in the ground when you walk to the middle of the room, I didn't removed it because I guess it give us more random actions in our character to help agains a banishiment.
Code:
Global Const $YellowSize = 11 ;Size of the array
Global Const $YellowTable[$YellowSize] = [0xFFFF00, 0xEAEA00, 0xE1E100, 0xEEEE01, 0xE8DC3C, 0xDDDD00, 0xE8E800, 0xE9E900, 0xEBEB00, 0xE5E500, 0xFAFA00]
; 255-255-0 234-234-0 225-225-0 238-238-01 232-220-60 221-221-0 232-232-0 233-233-0 235-235-0 229-229-9 250-250-0
Loot() function:
Code:
If $pickupYellow = 1 Then
if $ResolutionRatio = 3 Then
If LootItem($yellow_1680) Then
$amarello = $amarello + 1
ContinueLoop
EndIf
EndIf
;Changes here
For $i = 0 to $YellowSize - 1
If LootItem($YellowTable[$i]) Then
$amarello = $amarello + 1
ContinueLoop
EndIf
Next
EndIf
Remember to add a "Return True" before the last line of the function Loot(), to be exactly, before the "EndFunc ;==>Loot"
LootItem() function - Just added a Sleep() if it found the color, because sometimes you need to walk to the item, so it will give the function some time to walk->pickup the loot, not really necessary I guess, but might be better if for some reason you are far away from the item:
Code:
If Not @error Then
MouseClick("left", $coords[0], $coords[1], 1, 10)
Sleep(Random(1000,2000))
Return True
Else
In the main function of the "Kill Ghom" file I also added a variable just to hold the Loot() function return, because most of times looks like the script was executing the Loot() then walking to the middle of the room before the Loot() function ends since it had no return(void method), so it would like Try loot->Walk->Found a loot in the first Loot call->Walk Back->Get crazy and get TP, so it is just to really wait the Loot() function return, wich I made return True just in case(talked about that above):
Main loop
Code:
$dis_ent = false
$loot_ok = false ;NEw variable
local $kill_flag = False
.
.
If FightBoss() Then
$TotalTime = $TotalTime + TimerDiff($TimeStart)
$NumOfKills = $NumOfKills + 1
Sleep(1000)
$loot_ok = Loot()
;Send("{PRINTSCREEN}")
Sleep(1000)
Gold()
Sleep(1000)
$loot_ok = Loot()
Sleep(1000)
Else
Last, but not least, it kind worries me about that spell spam that the script keep doing, 4-3-2-1, 4-3-2-1 all the time where we have some skills with a high cooldown(Following the build in the first post, like Akarant skill that it's 90 seconds(at least here in my character), so I created a cooldown checker based in the last time you casted that spell, as I said I'm not that good with this Pixel thing, I'm still doing some researchs about that, so I'm not checking the cooldown skill color, so the only thing that might happen here is, the script press the skill number(1,2,3 or 4) and for some reason it wasn't casted, so it will wait until the "Cooldown" in the script is good to try cast again, to be honest it didn't happened to me anymore after some adjustments that I made, so if you want to, you can use it and maybe make it less hardcoded too and maybe the possibility to edit it in the script GUI.
SO, let's go. In the GhomFights file, before the Func wizard():
Code:
If Not IsDeclared("usepotion") Then $usepotion = 1
If Not IsDeclared("$xratio") Then $xratio = 1
If Not IsDeclared("$yratio") Then $yratio = 1
#include <Date.au3> ;Library needed to get the system time
;The spells CD, might be changed, unfortunately I used the spells name, but it can be changed to a "neutral" name, like $Skill1_CD
Const $AKARANT_CD = 90
Const $JUDGMENT_CD = 20
Const $LAWS_OF_VALOR_CD = 30
Const $HEAVENS_FURY_CD = 20
;An default date to initialize the variables below
Const $Default_Date = "1970/01/01 [00:00:00]" ;Do not change this
;Variables that will hold the last time the spell was used - Set the default value to them in the first execution, didn't find anything to help this "shit code" on AutoIt Documentation
$last_Akarant = $Default_Date
$last_Judgment = $Default_Date
$last_Laws = $Default_Date
$last_Heavens = $Default_Date
I've added two new functions to help us to cleanup the crusader() function and to make it more realistic:
Code:
;Returns if we can cast the spell, parameters are, the last time we used the spell and the spell cooldown in seconds
Func canCast($lastCast, $cooldown)
If(_DateDiff('s', $lastCast, _NowCalc()) > $cooldown) Then
Return True
Else
Return False
EndIf
EndFunc
;Function to verify all the 4 spells cooldown and cast them if you can cast, if you can cast it, it will wait some miliseconds to not spam spells and to avoid the next spell to not be casted, it press the Skill button twice because it's more efective after some tests that I made
Func castCrusaderSpells()
If(canCast($last_Heavens, $HEAVENS_FURY_CD)) Then
$last_Heavens = _NowCalc()
Send("4")
Sleep(200)
Send("4")
Sleep(Random(700, 1000))
EndIf
If(canCast($last_Laws, $LAWS_OF_VALOR_CD)) Then
$last_Laws = _NowCalc()
Send("3")
Sleep(200)
Send("3")
Sleep(Random(700, 1000))
EndIf
If(canCast($last_Judgment, $JUDGMENT_CD)) Then
$last_Judgment = _NowCalc()
Send("2")
Sleep(200)
Send("2")
Sleep(Random(700, 1000))
EndIf
If(canCast($last_Akarant, $AKARANT_CD)) Then
$last_Akarant = _NowCalc()
Send("1")
Sleep(200)
Send("1")
Sleep(Random(700, 1000))
EndIf
Return True
EndFunc
With the two functions above, we can replace all the lines in the crusader() function like this:
Code:
Send("4")
Sleep(200)
Send("3")
Sleep(200)
Send("2")
Sleep(200)
Send("1")
To this simple line:
Code:
castCrusaderSpells()
An example how is the begining of my cusader() function:
Code:
Func crusader() ;Code by wasssaaa and tonyv
HotKeySet("{F1}", "_Close")
;Start Fight
MouseClick("Left", Round(370 * $x_ratio) + Random(-10, 10), Round(600 * $y_ratio) + Random(-10, 10)) ; Move against wall
Sleep(200)
MouseMove(Round(728 * $x_ratio) + Random(-10, 10), Round(280 * $y_ratio) + Random(-10, 10)) ; Point mouse straight
Sleep(5000)
castCrusaderSpells()
Sleep(Random(100,300))
Send("{SHIFTDOWN}")
Sleep(200)
MouseDown("Right")
$rflag = True
Sleep(5000)
Also I added a lot of Random() codes, to again help us against a banishiment, so we won't always click in the same X/Y of the screen, anyway, I'm uploading the script I'm using atm with my changes, it's based in the version 241, if you think it's unecessary or abusive of my part I can remove the attachment.
Ps: It do NOT has any improvements from the original version 242 from the first post like the new "You are dead" check, so feel free to use it at your own risk.
Thanks and keep doing the great work : )