# percentage?

## Recommended Posts

I'm trying work out the percentage of catches against casts.

At the beginning of my function i have

```\$numofcasts += 1oÝ÷ Øw«z+&ÉÊ{^+_j)^vÚj×!jëh×6             \$castfail += 1
\$math = \$numofcasts - \$castfail
\$math1 = \$numofcasts/100*\$math
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & 100 - \$math1 & "%")oÝ÷ Øw«z+&ÉÊ{^+]¡ëj×!jëh×6               \$math = \$numofcasts - \$castfail
\$math1 = \$numofcasts/100*\$math
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & 100 - \$math1 & "%")```

How come if it catches 1 out of 1 attempts it gets 99.99%?

It also then lowers the percent every time a fish is caught?

Thanks

##### Share on other sites

```\$numCasts=1
\$successfulCasts=1
\$percentageCaught=\$successfulCasts*100/\$numCasts
MsgBox(0,"Percentage of catches",\$percentageCaught&"% successful catches")```

##### Share on other sites

```\$numCasts=1
\$successfulCasts=1
\$percentageCaught=\$successfulCasts*100/\$numCasts
MsgBox(0,"Percentage of catches",\$percentageCaught&"% successful catches")oÝ÷ Ûú®¢×£(ºWm+Ø§¶²¢¸ v¥r^jëh×6 #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=Fish Progression.exe
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
#Include <Misc.au3>
opt("SendKeyDelay",50)
HotKeySet("{pause}", "Quit")
Global \$searchL, \$searchT, \$searchR, \$searchB, \$color, \$numofcasts, \$castfail, \$bait, \$Pole, \$numofbait
\$prog = "Fish Progression"

#Region ### START Koda GUI section ### Form=
\$MainGUI = GUICreate(\$prog & " - Setup", 237, 163)
\$Group1 = GUICtrlCreateGroup("Bait?", 8, 8, 217, 49)
\$Baitbox = GUICtrlCreateCombo("None", 16, 24, 201, 25)
GUICtrlSetData(-1, "Shiny Bauble|Sharpened Fish Hook|Nightcrawlers|Flesh Eating Worm|Bright Baubles|Aquadynamic Fish Lens|Aquadynamic Fish Attractor")
GUICtrlCreateGroup("", -99, -99, 1, 1)
\$Group1 = GUICtrlCreateGroup("Pole?  *", 8, 50, 217, 49)
\$polebox = GUICtrlCreateCombo("", 16, 66, 201, 25)
GUICtrlSetData(-1, "Fishing Pole|Blump Family Fishing Pole|Strong Fishing Pole|Darkwood Fishing Pole|Big Iron Fishing Pole|Seth's Graphite Fishing Pole|Nat Pagle's Extreme Angler FC-5000|Nat's Lucky Fishing Pole|Bone Fishing Pole|Jeweled Fishing Pole|Mastercraft Kalu'ak Fishing Pole|Arcanite Fishing Pole")
GUICtrlCreateGroup("", -99, -99, 1, 1)
\$Label1 = GUICtrlCreateLabel("To stop the bot at anytime press the Pause key", 8, 102, 226, 17)
\$Label1 = GUICtrlCreateLabel("* Required Feild", 8, 119, 226, 17)
\$Start = GUICtrlCreateButton("Start", 8, 138, 219, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$Start
runbot()
EndSwitch
WEnd

Func runbot()
GUISetState(@SW_HIDE, \$MainGUI)
ToolTip('Making sure World of Warcraft is Active, and zooming in',0,0,"",2)
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft")
Sleep(2000)
Send("{Home}") ; Zoom in WoW
Send("{Home}")
Send("{Home}")
Send("{Home}")
Send("{Home}")

sleep(2000)
\$dll = DllOpen("user32.dll") ; Read somewhere thats User32.ddl speeds up _IsPressed detection?
ToolTip('Equiping ' & \$Pole & "! Please wait...",0,0,"",2)
Send("/Equip " & \$Pole & "{enter}") ; Equip Fishing Pole
; Select the upper left of the search area
ToolTip('Click in the top left corner of the search area',0,0,"",2)
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure WoW stays active while user is selecting position
If _IsPressed("01",\$dll) Then ExitLoop ; Exit loop when user left clicks
WEnd
\$mouse = MouseGetPos()
\$searchL = \$mouse[0]
\$searchT = \$mouse[1]

Sleep(1000)

; Select the lower right of the search area
ToolTip('Click in the bottom right corner of the search area',0,0,"",2)
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure Wow stays active while user is selecting position
If _IsPressed("01",\$dll) Then ExitLoop ; Exit loop when user left clicks
WEnd
\$mouse = MouseGetPos()
\$searchR = \$mouse[0]
\$searchB = \$mouse[1]

Sleep(1000)

ToolTip('',0,0,"",2)
Send(1) ; Cast fishing
Sleep(2000) ; Gives enough time for blobber to deploy

; Present a GUI to show the color at the mouse cursor
\$colourgui = GUICreate("",200,100,(@DesktopWidth/4)-100,@DesktopHeight-125,\$WS_POPUP,\$WS_EX_TOPMOST) ; Create a large borderless GUI that is always on top so user can see the color
GUISetState(@SW_SHOW)

; Wait for a colour to be clicked on
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure Wow stays active while user is selecting color
\$mouse = MouseGetPos()
\$color = PixelGetColor(\$mouse[0],\$mouse[1])
ToolTip("Find the Dark Red and click it, if Fishing timer runs out press 1 on your keyboard and try again.",0,0) ; Create a Tooltip away from cursor that the user can use to select a color, mousing over bobber changes its color!
GUISetBkColor("0x" & Hex(\$color,6),\$colourgui) ; Update gui with color seen
If _IsPressed("01",\$dll) Then ExitLoop; Exit loop when user left clicks
WEnd

ToolTip("Thank you for selecting the colour!",0,0,"",2)
Sleep(500)
GUISetState(@SW_HIDE) ;hide \$ColourGUI

; Wait for the first right-click to begin
ToolTip('Wait for the splash and catch the fish',0,0,"",2)
While _IsPressed("02",\$dll) = 0 ; Wait until the user right-click
Sleep(10)
Wend
DllClose(\$dll) ; Close DLL

Sleep(500)
; sleep while Auto-looting <<< Thank you Blizzard xD
ToolTip("Initializing Bot...",0,0,"",2)
Sleep(Random(1890,3124))
Fishforreal()
EndFunc

Func Fishforreal()
If \$bait = "None" Then
sleep(1)
Else
ToolTip("Unequiping " & \$Pole & "! Please Wait...",0,0,"",2)
Send("/run PickupInventoryItem(16) PutItemInBackpack() {Enter}")
ToolTip("Equiping " & \$bait & "! Please Wait...",0,0,"",2)
Send("/use " & \$bait & "{Enter}")
Send("/use " & \$Pole & "{Enter}")
ToolTip("Re-equiping " & \$Pole & "! Please Wait...",0,0,"",2)
Send("/Equip " & \$Pole & "{enter}")
\$numofbait +=1
EndIf
\$ColourGUI = GUICreate("PaintWindow", 600, 85, (@DesktopWidth/2 - 300), 25, \$WS_POPUP, \$WS_EX_LAYERED)
GUISetBkColor(0x0000F4)
GUISetFont(12, 800, 0, "Comic Sans MS")
\$title = GUICtrlCreateLabel(\$prog, 8, 8, 140, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Statuslable = GUICtrlCreateLabel("Status: Idle", 182, 8, 400, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$castnum = GUICtrlCreateLabel("Number of casts: 0", 8, 32, 190, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Baitnum = GUICtrlCreateLabel("Bait used: 0", 182, 32, 190, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Accurseynum = GUICtrlCreateLabel("Percentage Caught: N/A", 8, 56, 300, 24)
GUICtrlSetColor(-1, 0x0000FF)
WinSetOnTop("PaintWindow","",1)
ToolTip("",0,0,"",2)
GUICtrlSetData(\$Baitnum, "Bait used: 0 " & \$numofbait)
_WinAPI_SetLayeredWindowAttributes(\$ColourGUI, 0x0000F4, 250)
GUISetState()
; The actual bot
While -1
While -1
WinActivate("World of Warcraft")
GUICtrlSetData(\$Statuslable, "Status: Casting...")
Sleep(1000)
Send("1") ; Use the first slot of the cast bar to start fishing
\$numofcasts += 1
GUICtrlSetData(\$castnum, "Number of casts: " & \$numofcasts)
GUICtrlSetData(\$Statuslable, "Status: Waiting for Blobber...")
Sleep(3000)
\$timer = TimerInit() ; Set a timeout for finding bobber
While -1
GUICtrlSetData(\$Statuslable, "Status: Searching for Bobber...")
\$bobber = PixelSearch(\$searchL,\$searchT,\$searchR,\$searchB,"0x" & Hex(\$color,6),10,1) ; Look for user selected color in a large area in the center of the screen
;\$bobber = PixelSearch(\$searchL,\$searchT,\$searchR,\$searchB,"0x" & Hex(0x461B0E,6),10,1) ; Look for user selected color in a large area in the center of the screen

If @error <> 1 Then ExitLoop ; When color is found, bail out of the loop to start looking for splash
If TimerDiff(\$timer) > 10000 Then
\$castfail += 1
\$math = \$numofcasts - \$castfail
\$math1 = \$numofcasts/100*\$math
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & 100 - \$math1 & "%")
Sleep(1000)
WinActivate("World of Warcraft")
ExitLoop 2
EndIf
Wend
\$timer = TimerInit() ; Set a timeout for finding splash
MouseMove(\$bobber[0], \$bobber[1]) ; Move the mouse to the bobber (so the user knows what this script is looking at, and hopefully doesn't move the mouse)
While -1
GUICtrlSetData(\$Statuslable, "Status: Searching for Splash...")
\$splash = PixelSearch(\$bobber[0]-10,\$bobber[1]-10,\$bobber[0]+10,\$bobber[1]+10,"0x" & Hex(\$color,6),10,1) ; Search a tiny 20x20 square for the bobber color
If @error = 1 Then ExitLoop ; When the color isn't found, the bobber just bobbed (Splash Detected!)
If TimerDiff(\$timer) > 13000 Then
\$castfail += 1
\$math = \$numofcasts - \$castfail
\$math1 = \$numofcasts/100*\$math
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & 100 - \$math1 & "%")
Sleep(1000)
WinActivate("World of Warcraft")
Exitloop 2
EndIf
Wend
GUICtrlSetData(\$Statuslable, "Status: Splash Detected!")
Sleep(Random(100,500))
MouseClick("Right", \$bobber[0], \$bobber[1], 1, 0) ; Even if the user moves the mouse, this instantly moves it to the bobber and right-clicks
Sleep(2000)
GUICtrlSetData(\$Statuslable, "Status: Waiting to fish again")
\$math = \$numofcasts - \$castfail
\$math1 = \$numofcasts/100*\$math
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & 100 - \$math1 & "%")
Sleep(1000)
Wend
Wend
EndFunc

; Quit the script when the user presses {pause}
Func Quit()
Exit
EndFunc

Func _WinAPI_SetLayeredWindowAttributes(\$hwnd, \$i_transcolor, \$Transparency = 255, \$dwFlages = 0x03, \$isColorRef = False)
; #############################################
; You are NOT ALLOWED to remove the following lines
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Author(s): Prog@ndy
; #############################################
If \$dwFlages = Default Or \$dwFlages = "" Or \$dwFlages < 0 Then \$dwFlages = 0x03

If Not \$isColorRef Then
\$i_transcolor = Hex(String(\$i_transcolor), 6)
\$i_transcolor = Execute('0x00' & StringMid(\$i_transcolor, 5, 2) & StringMid(\$i_transcolor, 3, 2) & StringMid(\$i_transcolor, 1, 2))
EndIf
Local \$Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", \$hwnd, "long", \$i_transcolor, "byte", \$Transparency, "long", \$dwFlages)
Select
Case @error
Return SetError(@error, 0, 0)
Case \$Ret[0] = 0
Return SetError(4, _WinAPI_GetLastError(), 0)
Case Else
Return 1
EndSelect
EndFunc  ;==>_WinAPI_SetLayeredWindowAttributes```

Thanks

##### Share on other sites

If you use basic math reasoning you could have figured it out for yourself. Here, I'll be nice and show you:

`GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%")`

(get rid of \$math and \$math1 - not needed)

##### Share on other sites

And before you ask, use this to round it off:

`Round((\$numofcasts-\$castfail)*100/\$numofcasts)`

##### Share on other sites

If you use basic math reasoning you could have figured it out for yourself. Here, I'll be nice and show you:

```GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%")oÝ÷ Ú­®'hMú«ajwtß©¶g¢ÙÞy×þ«¨µäájy2¢ëaÌ(®K¥ªí~º&Â§×Ú[-¡Æ­rÈmê^­Ç§µ¨v+,j®Äáz«¨´÷«qéíjjè!¶«¨¶ËbV©¥æ«²ØhHw«z+0«Hb~'Ûhjëh×6 #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=Fish Progression.exe
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
#Include <Misc.au3>
opt("SendKeyDelay",50)
HotKeySet("{pause}", "Quit")
Global \$searchL, \$searchT, \$searchR, \$searchB, \$color, \$numofcasts, \$castfail, \$bait, \$Pole, \$numofbait
\$prog = "Fish Progression"

#Region ### START Koda GUI section ### Form=
\$MainGUI = GUICreate(\$prog & " - Setup", 237, 163)
\$Group1 = GUICtrlCreateGroup("Bait?", 8, 8, 217, 49)
\$Baitbox = GUICtrlCreateCombo("None", 16, 24, 201, 25)
GUICtrlSetData(-1, "Shiny Bauble|Sharpened Fish Hook|Nightcrawlers|Flesh Eating Worm|Bright Baubles|Aquadynamic Fish Lens|Aquadynamic Fish Attractor")
GUICtrlCreateGroup("", -99, -99, 1, 1)
\$Group1 = GUICtrlCreateGroup("Pole?  *", 8, 50, 217, 49)
\$polebox = GUICtrlCreateCombo("", 16, 66, 201, 25)
GUICtrlSetData(-1, "Fishing Pole|Blump Family Fishing Pole|Strong Fishing Pole|Darkwood Fishing Pole|Big Iron Fishing Pole|Seth's Graphite Fishing Pole|Nat Pagle's Extreme Angler FC-5000|Nat's Lucky Fishing Pole|Bone Fishing Pole|Jeweled Fishing Pole|Mastercraft Kalu'ak Fishing Pole|Arcanite Fishing Pole")
GUICtrlCreateGroup("", -99, -99, 1, 1)
\$Label1 = GUICtrlCreateLabel("To stop the bot at anytime press the Pause key", 8, 102, 226, 17)
\$Label1 = GUICtrlCreateLabel("* Required Feild", 8, 119, 226, 17)
\$Start = GUICtrlCreateButton("Start", 8, 138, 219, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$Start
runbot()
EndSwitch
WEnd

Func runbot()
GUISetState(@SW_HIDE, \$MainGUI)
ToolTip('Making sure World of Warcraft is Active, and zooming in',0,0,"",2)
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft")
Sleep(2000)
Send("{Home}") ; Zoom in WoW
Send("{Home}")
Send("{Home}")
Send("{Home}")
Send("{Home}")

sleep(2000)
\$dll = DllOpen("user32.dll") ; Read somewhere thats User32.ddl speeds up _IsPressed detection?
ToolTip('Equiping ' & \$Pole & "! Please wait...",0,0,"",2)
Send("/Equip " & \$Pole & "{enter}") ; Equip Fishing Pole
; Select the upper left of the search area
ToolTip('Click in the top left corner of the search area',0,0,"",2)
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure WoW stays active while user is selecting position
If _IsPressed("01",\$dll) Then ExitLoop ; Exit loop when user left clicks
WEnd
\$mouse = MouseGetPos()
\$searchL = \$mouse[0]
\$searchT = \$mouse[1]

Sleep(1000)

; Select the lower right of the search area
ToolTip('Click in the bottom right corner of the search area',0,0,"",2)
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure Wow stays active while user is selecting position
If _IsPressed("01",\$dll) Then ExitLoop ; Exit loop when user left clicks
WEnd
\$mouse = MouseGetPos()
\$searchR = \$mouse[0]
\$searchB = \$mouse[1]

Sleep(1000)

ToolTip('',0,0,"",2)
Send(1) ; Cast fishing
Sleep(2000) ; Gives enough time for blobber to deploy

; Present a GUI to show the color at the mouse cursor
\$colourgui = GUICreate("",200,100,(@DesktopWidth/4)-100,@DesktopHeight-125,\$WS_POPUP,\$WS_EX_TOPMOST) ; Create a large borderless GUI that is always on top so user can see the color
GUISetState(@SW_SHOW)

; Wait for a colour to be clicked on
While -1
If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure Wow stays active while user is selecting color
\$mouse = MouseGetPos()
\$color = PixelGetColor(\$mouse[0],\$mouse[1])
ToolTip("Find the Dark Red and click it, if Fishing timer runs out press 1 on your keyboard and try again.",0,0) ; Create a Tooltip away from cursor that the user can use to select a color, mousing over bobber changes its color!
GUISetBkColor("0x" & Hex(\$color,6),\$colourgui) ; Update gui with color seen
If _IsPressed("01",\$dll) Then ExitLoop; Exit loop when user left clicks
WEnd

ToolTip("Thank you for selecting the colour!",0,0,"",2)
Sleep(500)
GUISetState(@SW_HIDE) ;hide \$ColourGUI

; Wait for the first right-click to begin
ToolTip('Wait for the splash and catch the fish',0,0,"",2)
While _IsPressed("02",\$dll) = 0 ; Wait until the user right-click
Sleep(10)
Wend
DllClose(\$dll) ; Close DLL

Sleep(500)
; sleep while Auto-looting <<< Thank you Blizzard xD
ToolTip("Initializing Bot...",0,0,"",2)
Sleep(Random(1890,3124))
Fishforreal()
EndFunc

Func Fishforreal()
If \$bait = "None" Then
sleep(1000)
Else
ToolTip("Unequiping " & \$Pole & "! Please Wait...",0,0,"",2)
Send("/run PickupInventoryItem(16) PutItemInBackpack() {Enter}")
ToolTip("Equiping " & \$bait & "! Please Wait...",0,0,"",2)
Send("/use " & \$bait & "{Enter}")
Send("/use " & \$Pole & "{Enter}")
ToolTip("Re-equiping " & \$Pole & "! Please Wait...",0,0,"",2)
Send("/Equip " & \$Pole & "{enter}")
\$numofbait +=1
EndIf
\$ColourGUI = GUICreate("PaintWindow", 600, 85, (@DesktopWidth/2 - 300), 25, \$WS_POPUP, \$WS_EX_LAYERED)
GUISetBkColor(0x0000F4)
GUISetFont(12, 800, 0, "Comic Sans MS")
\$title = GUICtrlCreateLabel(\$prog, 8, 8, 140, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Statuslable = GUICtrlCreateLabel("Status: Idle", 182, 8, 400, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$castnum = GUICtrlCreateLabel("Number of casts: 0", 8, 32, 190, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Baitnum = GUICtrlCreateLabel("Bait used: 0", 182, 32, 190, 24)
GUICtrlSetColor(-1, 0x0000FF)
\$Accurseynum = GUICtrlCreateLabel("Percentage Caught: N/A", 8, 56, 300, 24)
GUICtrlSetColor(-1, 0x0000FF)
WinSetOnTop("PaintWindow","",1)
ToolTip("",0,0,"",2)
GUICtrlSetData(\$Baitnum, "Bait used: 0 " & \$numofbait)
_WinAPI_SetLayeredWindowAttributes(\$ColourGUI, 0x0000F4, 250)
GUISetState()
; The actual bot
While -1
While -1
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%")
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%") ; coding it twice seems to fix the display error
WinActivate("World of Warcraft")
GUICtrlSetData(\$Statuslable, "Status: Casting...")
Sleep(1000)
Send("1") ; Use the first slot of the cast bar to start fishing
\$numofcasts += 1
GUICtrlSetData(\$castnum, "Number of casts: " & \$numofcasts)
GUICtrlSetData(\$Statuslable, "Status: Waiting for Blobber...")
Sleep(3000)
GUICtrlSetData(\$Statuslable, "Status: Searching for Bobber...")
\$timer = TimerInit() ; Set a timeout for finding bobber
While -1
\$bobber = PixelSearch(\$searchL,\$searchT,\$searchR,\$searchB,"0x" & Hex(\$color,6),10,1) ; Look for user selected color in a large area in the center of the screen
;\$bobber = PixelSearch(\$searchL,\$searchT,\$searchR,\$searchB,"0x" & Hex(0x461B0E,6),10,1) ; Look for user selected color in a large area in the center of the screen

If @error <> 1 Then ExitLoop ; When color is found, bail out of the loop to start looking for splash
If TimerDiff(\$timer) > 10000 Then
\$castfail += 1
;----------------------------------------
Sleep(1000)
WinActivate("World of Warcraft")
ExitLoop 2
EndIf
Wend
\$timer = TimerInit() ; Set a timeout for finding splash
MouseMove(\$bobber[0], \$bobber[1]) ; Move the mouse to the bobber (so the user knows what this script is looking at, and hopefully doesn't move the mouse)
While -1
GUICtrlSetData(\$Statuslable, "Status: Searching for Splash...")
\$splash = PixelSearch(\$bobber[0]-10,\$bobber[1]-10,\$bobber[0]+10,\$bobber[1]+10,"0x" & Hex(\$color,6),10,1) ; Search a tiny 20x20 square for the bobber color
If @error = 1 Then ExitLoop ; When the color isn't found, the bobber just bobbed (Splash Detected!)
If TimerDiff(\$timer) > 13150 Then
\$castfail += 1
;------------------------------------
Sleep(1000)
WinActivate("World of Warcraft")
Exitloop 2
EndIf
Wend
GUICtrlSetData(\$Statuslable, "Status: Splash Detected!")
Sleep(Random(75,175))
MouseClick("Right", \$bobber[0], \$bobber[1], 1, 0) ; Even if the user moves the mouse, this instantly moves it to the bobber and right-clicks
Sleep(2000)
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%")
GUICtrlSetData(\$Accurseynum, "Percentage Caught: " & (\$numofcasts-\$castfail)*100/\$numofcasts & "%") ; coding it twice seems to fix the display error
GUICtrlSetData(\$Statuslable, "Status: Waiting to fish again")
Sleep(1000)
Wend
Wend
EndFunc

; Quit the script when the user presses {pause}
Func Quit()
Exit
EndFunc

Func _WinAPI_SetLayeredWindowAttributes(\$hwnd, \$i_transcolor, \$Transparency = 255, \$dwFlages = 0x03, \$isColorRef = False)
; #############################################
; You are NOT ALLOWED to remove the following lines
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Author(s): Prog@ndy
; #############################################
If \$dwFlages = Default Or \$dwFlages = "" Or \$dwFlages < 0 Then \$dwFlages = 0x03

If Not \$isColorRef Then
\$i_transcolor = Hex(String(\$i_transcolor), 6)
\$i_transcolor = Execute('0x00' & StringMid(\$i_transcolor, 5, 2) & StringMid(\$i_transcolor, 3, 2) & StringMid(\$i_transcolor, 1, 2))
EndIf
Local \$Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", \$hwnd, "long", \$i_transcolor, "byte", \$Transparency, "long", \$dwFlages)
Select
Case @error
Return SetError(@error, 0, 0)
Case \$Ret[0] = 0
Return SetError(4, _WinAPI_GetLastError(), 0)
Case Else
Return 1
EndSelect
EndFunc  ;==>_WinAPI_SetLayeredWindowAttributes```

Thanks

##### Share on other sites

And before you ask, use this to round it off:

`Round((\$numofcasts-\$castfail)*100/\$numofcasts)`

I don't need to round it off but thanks anyway.

## Create an account

Register a new account

×

• Wiki

• Back

• Git