Jump to content

Small tool for bot makers.


fastnick1oo
 Share

Recommended Posts

This is my small tool to help bot makers.

It checks pixel color form coords x and y inputed in it and saves it in GUIPixelGetColor.ini file (for easy copy/paste these numbers).

#include <GuiConstants.au3>

$title = "K4"
If WinExists($title) Then Exit

$GUI = GUICreate($title, 110, 78)
$button = GUICtrlCreateButton("OK", 35, 38, 40)
GUICtrlCreateLabel("x:", 10, 13, 10)
$x = GUICtrlCreateInput("", 20, 10, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("y:", 60, 13, 10)
$y = GUICtrlCreateInput("", 70, 10, 30, 20, $ES_NUMBER)

GUISetState(@SW_SHOW)

While 1
 $msg = GUIGetMsg()

 Select
  Case $msg = $GUI_EVENT_CLOSE
   Exit

  Case $msg = $button
   $x = GuiCtrlRead($x)
   $y = GuiCtrlRead($y)
   GUISetState(@SW_HIDE)
   Sleep(100)
   $getcolor = PixelGetColor($x, $y)
   IniWrite("GUIPixelGetColor.ini", $x & " " & $y, "value", $getcolor)
   Msgbox(0, $title, "PixelGetColor from " & $x & ", " & $y & " (" & $getcolor & ") has been saved in ini file.")
   GUISetState(@SW_SHOW)
 EndSelect
WEnd

Everything is ok until you push OK button second time, then $x and $y are 0 (even if input boxes aren't empty). Whats wrong with this script?

SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

Try this

#include <GuiConstants.au3>

$title = "K4"
If WinExists($title) Then Exit

$GUI = GUICreate($title, 110, 78)
$button = GUICtrlCreateButton("OK", 35, 38, 40)
GUICtrlCreateLabel("x:", 10, 13, 10)
$_x = GUICtrlCreateInput("", 20, 10, 30, 20, $ES_NUMBER)
GUICtrlCreateLabel("y:", 60, 13, 10)
$_y = GUICtrlCreateInput("", 70, 10, 30, 20, $ES_NUMBER)

GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()

Select
  Case $msg = $GUI_EVENT_CLOSE
   Exit

  Case $msg = $button
   $x = GuiCtrlRead($_x)
   $y = GuiCtrlRead($_y)
   GUISetState(@SW_HIDE)
   Sleep(100)
   $getcolor = PixelGetColor($x, $y)
   IniWrite("GUIPixelGetColor.ini", $x & " " & $y, "value", $getcolor)
   Msgbox(0, $title, "PixelGetColor from " & $x & ", " & $y & " (" & $getcolor & ") has been saved in ini file.")
   GUISetState(@SW_SHOW)
EndSelect
WEnd
Link to comment
Share on other sites

hmm the $_x is the handle for that inputbox. No the text entered. So is you chance the handle code ($x) The inputbox won't work anymore.

So it should read the inpubox to an other variable.

I hope I explained it well. I'm dutch you know... B)

So, good luck.

Ghastly_MIB

Link to comment
Share on other sites

I think i got the point, thx. B)

I've made some modifications, so right now it looks like this:

#include <GuiConstants.au3>
#NoTrayIcon

$title = "K4's Helper v0.3"
If WinExists($title) Then Exit

$GUIwidth = 120
$GUIheight = 185
$GUI = GUICreate($title, $GUIwidth, $GUIheight, -1, -1, $WS_POPUP)

$button1 = GUICtrlCreateButton("PixelGetColor", $GUIwidth/2-50, 50, 100)
$button2 = GUICtrlCreateButton("MouseMove", $GUIwidth/2-50, 80, 100)
$button3 = GUICtrlCreateButton("Exit", $GUIwidth/2-50, 110, 100)
GUICtrlCreateLabel("X is", $GUIwidth/4-10, 5, 20, 20, $SS_CENTER)
$_x = GUICtrlCreateInput("0", $GUIwidth/4-25, 25, 50, 20, $ES_NUMBER & $ES_CENTER)
GUICtrlSetLimit($_x, 4)
GUICtrlCreateLabel("Y is", $GUIwidth/4+$GUIwidth/2-10, 5, 20, 20, $SS_CENTER)
$_y = GUICtrlCreateInput("0", $GUIwidth/4+$GUIwidth/2-25, 25, 50, 20, $ES_NUMBER & $ES_CENTER)
GUICtrlSetLimit($_y, 4)
$context = GUICtrlCreateContextMenu()
$about = GUICtrlCreateMenuitem("About", $context)
GUICtrlCreateLabel("MouseGetPos", $GUIwidth/2-40, 142, 80, 20, $SS_CENTER)

GUISetState(@SW_SHOW)

While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = ""
   $pos = MouseGetPos()
   GUICtrlCreateLabel($pos[0] & ", " & $pos[1], $GUIwidth/2-30, 161, 60, 20,  $SS_CENTER)
   Sleep(300)
  Case $msg = $GUI_EVENT_CLOSE Or $msg = $button3
   Exit
  Case $msg = $button1
   $x = GuiCtrlRead($_x)
   $y = GuiCtrlRead($_y)
   GetColor()
   GUISetState(@SW_SHOW)
  Case $msg = $button2
   $x = GuiCtrlRead($_x)
   $y = GuiCtrlRead($_y)
   Move()
  Case $msg = $about
   MsgBox(0, $title, "Kecz4p's Helper for BoTmakers.")
 EndSelect
WEnd

Func GetColor()
 GUISetState(@SW_HIDE)
 Sleep(100)
 $getcolor = PixelGetColor($x, $y)
 IniWrite("Helper.ini", $x & " " & $y, "dec", $getcolor)
 IniWrite("Helper.ini", $x & " " & $y, "hex", "0x" & Hex($getcolor, 6))
 Msgbox(0, $title, "PixelGetColor from " & $x & ", " & $y & " (dec:" & $getcolor & ", hex: 0x" & Hex($getcolor, 6) & ") has been saved in ini file.")
EndFunc

Func Move()
 GUICtrlSetState($_x, $GUI_DISABLE)
 GUICtrlSetState($_y, $GUI_DISABLE)
 GUICtrlSetState($button2, $GUI_DISABLE)
 MouseMove($x, $y, 5)
 GUICtrlSetState($_x, $GUI_ENABLE)
 GUICtrlSetState($_y, $GUI_ENABLE)
 GUICtrlSetState($button2, $GUI_ENABLE)
EndFunc
SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...