Jump to content

Runescape Power Training


 Share

Recommended Posts

We would love to see you code on ocr Manadar, but i think colormatch will also do the trick, but lets see the code.

I have also come up with a new way of handling the search area, far from perfect but a new way of doing things.

What we really need is a way of tracking the movement on background that RS does, then using my lauout it would be quite easy to make the hits fall at a random place.

it goes something like this:

Dim $i
;-----------------------------------------------------------------------------------------------------------
; Split up search area into several 34 x 34 fields, and place like a spiral going outwards from center. 
; This will ensure we always pick the ore closest to us, and not run around like a headless chicken.
; The search boxes is aproximately as big as a field in rs, and we will always stand on searchbox 0
; so we can exclude search box 0 in our search, as we cant stand on anything mineable.
; with 99 search boxes we will be able to see 5 squares to every side (except south only 3) or 34 * 5 px
;-----------------------------------------------------------------------------------------------------------
Dim $search_box[99][4]
;-----------------------------------------------------------------------------------------------------------
; this is the way the searchboxes would look like in a grid, only done for easy setup of the arrays
; if you put these numbers into excel, in 11 columns and 9 rows, you should get the point if you haven't yet
;-----------------------------------------------------------------------------------------------------------
Dim $search_setup[99] = [98,72,73,74,75,76,77,78,79,80,81,97,71,49,50,51,52,53,54,55,56,82,96,70,48,25,26,27,28,29,30,57,


83,
95,69,47,24,9,10,11,12,31,58,84,94,68,46,23,8,1,2,13,32,59,85,93,67,45,22,7,0,3,14,33,60,86,92,66,44



,21,6,5,4,15,34,61,87,91,65,43,20,19,18,17,16,35,62,88,90,64,42,41,40,39,38,37,36,63,89]
Dim $column = 89; our left starting point
Dim $row = 143; our top starting point
For $i = 0 to 98
    $search_box[$search_setup[$i]][0] = $column
    $search_box[$search_setup[$i]][1] = $row
    $search_box[$search_setup[$i]][2] = $column+33
    $search_box[$search_setup[$i]][3] = $row+33
    $column = $column + 34
    if $column = 463 then 
        $column = 89
        $row = $row + 34
    EndIf   
Next

;------------------------------------------------------------------------------------------------------------
;                                       Now for the searching part
;------------------------------------------------------------------------------------------------------------

for $i = 1 to 98
    $dummy = PixelSearch($search_box[$i][0], $search_box[$i][1], $search_box[$i][2], $search_box[$i][3], 15106873, 1)
    If Not @error Then
        MsgBox(4096, "Arraytest","We got a match", -1)
                      ;we now know the box number and we got the cordinates to make the hit random, only problem is, background is moving, so grid won't stay in place.
                      ; So if we cant find a way to fix this, well this wont work
                        exitloop
    EndIf
next
Edited by Sprille
Link to comment
Share on other sites

Using OCR you can tell "Coal mine" and "Coal ore" apart easily. They have almost the same color and the same shape, but a human is able to tell the difference easily. Using OCR you could also handle some random events, where you only have to click on the NPC to finish it. Other things that require your immediate attention can be postponed by clicking on the NPC first, and meanwhile shouting the human that is botting to give the bot some attention.

I've been working with more memory editing recently, and I think I may be able to pull the text displayed from the game, without using OCR. Edit2: Ok, memory reading fail.

.. Starting up my flash drive now to pull the code ..

Edit: Here's the code. I haven't included RuneLogin.au3 . Please know that this is not code that runs out of the box or does anything, just a big work in progress that barely works.

RuneOCR.au3

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.9.2 (beta)
 Author:         Manadar

 Script Function:
    Library of functions to read text in RuneScape through OCR.

#ce ----------------------------------------------------------------------------


#cs To Do List
    Test the functions on a different machine. The client coordinates may be wrong.
    Write OCR functions to read chat and the right click menu, also I might do the stats to see how my health has gone down or something
#ce

#include-once
#include <IE.au3>
#include <A3LScreenCap.au3>
#include <Color.au3>
#include <Array.au3>

#include <RuneCoords.au3>

Func _RS_OCR_ReadTopLeft($hwnd)
    Local $sPos[2], $wPos[2], $cPos[2]
    Local $sWidth = 450, $sHeight = 14
    Local $sStorage[$sWidth][$sHeight]
    
    WinActivate($hwnd)
    
    $sPos = _RS_Coord_GetRSCoords($hwnd)
    If @error Then Return SetError(1,0,0)
    
    If Not FileExists(@ScriptDir & "\temp\OCR\") Then _RS_OCR_Startup()
    _ScreenCap_Capture(@ScriptDir & "\temp\OCR\temp.jpg", $sPos[0]+9, $sPos[1]+10, $sPos[0] + 9 + $sWidth, $sPos[1] + 10 + $sHeight, False) ;verify
    
    SplashImageOn("",@ScriptDir & "\temp\OCR\temp.jpg",$sWidth,$sHeight,0,0,1)
    For $x = 1 to $sWidth
        For $y = 1 to $sHeight
            $sStorage[$x-1][$y-1] = PixelGetColor($x,$y)
        Next
    Next
    SplashOff()
    Return _RS_OCR_BitmapToText($sStorage,$sWidth,$sHeight)
EndFunc

Func _RS_OCR_BitmapToText($sBitmap,$sWidth,$sHeight) ; $sBitmap is an array that contains the pixels of the screen
    Local $sAccuracy = 25
    ;Dim $sAcceptedColors[3] = [0xE6E6E4, 0xDDDDDB,0xE7E8E3] works for grey.. LIKE A CHARM!!
    Local $sAcceptedColors[11] = [0xE6E6E4, 0xDDDDDB,0xE7E8E3,0xD6D56B,0xCDCC00,0xD1CF96,0xCAC917,0xD5D46A,0xC68F68,0xB8784A,0xDDDD41]
    Local $disChar[8], $j = 0
    Local $sResult = "", $spaceCheck = 0
    
    For $i = 0 to 7
        $disChar[$i] = 0
    Next
    
    
    For $x = 1 to $sWidth
        $newChar = 1
        For $y = 1 to $sHeight
            If _RS_OCR_ColorInRange($sBitmap[$x-1][$y-1],$sAcceptedColors,$sAccuracy) Then
                $sBitmap[$x-1][$y-1] = 1
                $disChar[$j] += 1
                $newChar = 0
            Else
                $sBitmap[$x-1][$y-1] = 0
            EndIf
        Next
        $j += 1
        If $newChar = 1 Then
            $spaceCheck += 1
            If $spaceCheck > 4 Then
                $sResult &= " "
                $spaceCheck = 0
            EndIf
            $sTemp = _RS_OCR_SegmentToChar($disChar)
            $sResult &= $sTemp
            If $sTemp <> "" Then $spaceCheck = 0
            $j = 0
            For $i = 0 to 7
                $disChar[$i] = 0
            Next
        EndIf
    Next
    
    Return $sResult
EndFunc

Func _RS_OCR_SegmentToChar($sBitmap)
    Local $sTotal = 0
    For $i = 0 to 7
        $sTotal += $sBitmap[$i]
    Next
    If $sTotal = 0 Then Return ""
    
    $sCharacters = IniReadSection(@ScriptDir & "\data\OCRdefinitions.ini","TopLeft")
    Local $sCharDiff[$sCharacters[0][0]+1]
    
    For $i = 1 To $sCharacters[0][0]
        $sSplit = StringSplit($sCharacters[$i][1],"-")
        For $a = 0 to 7
            $sCharDiff[$i] += Abs($sSplit[$a+1]-$sBitmap[$a])
        Next
    Next
    
    ;_ArrayDisplay($sBitmap)
    Return $sCharacters[_ArrayClosestToZeroIndex($sCharDiff)][0]
EndFunc

Func _ArrayClosestToZeroIndex(Const ByRef $avArray, $i_Base = 1) ; modified from _ArrayMinIndex
    Local $iCntr = 0, $iMinIndex = $i_Base
    
    For $iCntr = $i_Base To UBound($avArray)-1
        If Abs($avArray[$iMinIndex]) > Abs($avArray[$iCntr]) Then
            $iMinIndex = $iCntr
        EndIf
    Next
    
    Return $iMinIndex
EndFunc

Func _RS_OCR_ColorInRange($sCheckColor,$sTargetColors,$sVariation)
    For $z = 0 to UBound($sTargetColors)-1
        $sTemp = _ColorGetBlue($sCheckColor)-_ColorGetBlue($sTargetColors[$z])
        If $sTemp < ($sVariation*1.5) AND $sTemp > -1 * ($sVariation*1.5) Then
            $sTemp = _ColorGetRed($sCheckColor)-_ColorGetRed($sTargetColors[$z])
            If $sTemp < $sVariation AND $sTemp > -1 * $sVariation Then
                $sTemp = _ColorGetGreen($sCheckColor)-_ColorGetGreen($sTargetColors[$z])
                If $sTemp < $sVariation AND $sTemp > -1 * $sVariation Then
                    Return 1
                EndIf
            EndIf
        EndIf
    Next
    Return 0
EndFunc

Func _RS_OCR_Startup()
    DirCreate(@ScriptDir & "\temp\OCR\")
    If Not FileExists(@ScriptDir & "\data\OCRdefinitions.ini") Then Return SetError(1,0,0)
EndFunc

Func _RS_OCR_Shutdown()
    DirRemove(@ScriptDir & "\temp\OCR\")
EndFunc

OCRDefinitions.ini

[TopLeft]
W=8-9-2-6-6-2-9-8
a=3-6-3-3-6-5-0-0
l=10-10-0-0-0-0-0-0
k=10-10-3-4-3-1-0-0
h=10-10-2-1-6-5-0-0
e=4-6-3-3-5-3-0-0
r=6-6-2-1-0-0-0-0
_A=8-9-3-2-3-9-8-0
t=8-9-2-2-0-0-0-0
c=4-6-2-2-2-0-0-0

and here's why OCR was so hard to do:

Posted Image

Edited by Manadar
Link to comment
Share on other sites

Using OCR you can tell "Coal mine" and "Coal ore" apart easily. They have almost the same color and the same shape, but a human is able to tell the difference easily. Using OCR you could also handle some random events, where you only have to click on the NPC to finish it. Other things that require your immediate attention can be postponed by clicking on the NPC first, and meanwhile shouting the human that is botting to give the bot some attention.

I've been working with more memory editing recently, and I think I may be able to pull the text displayed from the game, without using OCR. Edit2: Ok, memory reading fail.

.. Starting up my flash drive now to pull the code ..

Edit: Here's the code. I haven't included RuneLogin.au3 . Please know that this is not code that runs out of the box or does anything, just a big work in progress that barely works.

RuneOCR.au3

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.9.2 (beta)
 Author:         Manadar

 Script Function:
    Library of functions to read text in RuneScape through OCR.

#ce ----------------------------------------------------------------------------


#cs To Do List
    Test the functions on a different machine. The client coordinates may be wrong.
    Write OCR functions to read chat and the right click menu, also I might do the stats to see how my health has gone down or something
#ce

#include-once
#include <IE.au3>
#include <A3LScreenCap.au3>
#include <Color.au3>
#include <Array.au3>

#include <RuneCoords.au3>

Func _RS_OCR_ReadTopLeft($hwnd)
    Local $sPos[2], $wPos[2], $cPos[2]
    Local $sWidth = 450, $sHeight = 14
    Local $sStorage[$sWidth][$sHeight]
    
    WinActivate($hwnd)
    
    $sPos = _RS_Coord_GetRSCoords($hwnd)
    If @error Then Return SetError(1,0,0)
    
    If Not FileExists(@ScriptDir & "\temp\OCR\") Then _RS_OCR_Startup()
    _ScreenCap_Capture(@ScriptDir & "\temp\OCR\temp.jpg", $sPos[0]+9, $sPos[1]+10, $sPos[0] + 9 + $sWidth, $sPos[1] + 10 + $sHeight, False) ;verify
    
    SplashImageOn("",@ScriptDir & "\temp\OCR\temp.jpg",$sWidth,$sHeight,0,0,1)
    For $x = 1 to $sWidth
        For $y = 1 to $sHeight
            $sStorage[$x-1][$y-1] = PixelGetColor($x,$y)
        Next
    Next
    SplashOff()
    Return _RS_OCR_BitmapToText($sStorage,$sWidth,$sHeight)
EndFunc

Func _RS_OCR_BitmapToText($sBitmap,$sWidth,$sHeight) ; $sBitmap is an array that contains the pixels of the screen
    Local $sAccuracy = 25
    ;Dim $sAcceptedColors[3] = [0xE6E6E4, 0xDDDDDB,0xE7E8E3] works for grey.. LIKE A CHARM!!
    Local $sAcceptedColors[11] = [0xE6E6E4, 0xDDDDDB,0xE7E8E3,0xD6D56B,0xCDCC00,0xD1CF96,0xCAC917,0xD5D46A,0xC68F68,0xB8784A,0xDDDD41]
    Local $disChar[8], $j = 0
    Local $sResult = "", $spaceCheck = 0
    
    For $i = 0 to 7
        $disChar[$i] = 0
    Next
    
    
    For $x = 1 to $sWidth
        $newChar = 1
        For $y = 1 to $sHeight
            If _RS_OCR_ColorInRange($sBitmap[$x-1][$y-1],$sAcceptedColors,$sAccuracy) Then
                $sBitmap[$x-1][$y-1] = 1
                $disChar[$j] += 1
                $newChar = 0
            Else
                $sBitmap[$x-1][$y-1] = 0
            EndIf
        Next
        $j += 1
        If $newChar = 1 Then
            $spaceCheck += 1
            If $spaceCheck > 4 Then
                $sResult &= " "
                $spaceCheck = 0
            EndIf
            $sTemp = _RS_OCR_SegmentToChar($disChar)
            $sResult &= $sTemp
            If $sTemp <> "" Then $spaceCheck = 0
            $j = 0
            For $i = 0 to 7
                $disChar[$i] = 0
            Next
        EndIf
    Next
    
    Return $sResult
EndFunc

Func _RS_OCR_SegmentToChar($sBitmap)
    Local $sTotal = 0
    For $i = 0 to 7
        $sTotal += $sBitmap[$i]
    Next
    If $sTotal = 0 Then Return ""
    
    $sCharacters = IniReadSection(@ScriptDir & "\data\OCRdefinitions.ini","TopLeft")
    Local $sCharDiff[$sCharacters[0][0]+1]
    
    For $i = 1 To $sCharacters[0][0]
        $sSplit = StringSplit($sCharacters[$i][1],"-")
        For $a = 0 to 7
            $sCharDiff[$i] += Abs($sSplit[$a+1]-$sBitmap[$a])
        Next
    Next
    
    ;_ArrayDisplay($sBitmap)
    Return $sCharacters[_ArrayClosestToZeroIndex($sCharDiff)][0]
EndFunc

Func _ArrayClosestToZeroIndex(Const ByRef $avArray, $i_Base = 1) ; modified from _ArrayMinIndex
    Local $iCntr = 0, $iMinIndex = $i_Base
    
    For $iCntr = $i_Base To UBound($avArray)-1
        If Abs($avArray[$iMinIndex]) > Abs($avArray[$iCntr]) Then
            $iMinIndex = $iCntr
        EndIf
    Next
    
    Return $iMinIndex
EndFunc

Func _RS_OCR_ColorInRange($sCheckColor,$sTargetColors,$sVariation)
    For $z = 0 to UBound($sTargetColors)-1
        $sTemp = _ColorGetBlue($sCheckColor)-_ColorGetBlue($sTargetColors[$z])
        If $sTemp < ($sVariation*1.5) AND $sTemp > -1 * ($sVariation*1.5) Then
            $sTemp = _ColorGetRed($sCheckColor)-_ColorGetRed($sTargetColors[$z])
            If $sTemp < $sVariation AND $sTemp > -1 * $sVariation Then
                $sTemp = _ColorGetGreen($sCheckColor)-_ColorGetGreen($sTargetColors[$z])
                If $sTemp < $sVariation AND $sTemp > -1 * $sVariation Then
                    Return 1
                EndIf
            EndIf
        EndIf
    Next
    Return 0
EndFunc

Func _RS_OCR_Startup()
    DirCreate(@ScriptDir & "\temp\OCR\")
    If Not FileExists(@ScriptDir & "\data\OCRdefinitions.ini") Then Return SetError(1,0,0)
EndFunc

Func _RS_OCR_Shutdown()
    DirRemove(@ScriptDir & "\temp\OCR\")
EndFunc

OCRDefinitions.ini

[TopLeft]
W=8-9-2-6-6-2-9-8
a=3-6-3-3-6-5-0-0
l=10-10-0-0-0-0-0-0
k=10-10-3-4-3-1-0-0
h=10-10-2-1-6-5-0-0
e=4-6-3-3-5-3-0-0
r=6-6-2-1-0-0-0-0
_A=8-9-3-2-3-9-8-0
t=8-9-2-2-0-0-0-0
c=4-6-2-2-2-0-0-0

and here's why OCR was so hard to do:

Posted Image

PLEASE NOTE, my autoit experience == 0

Posted Image

Link to comment
Share on other sites

Here is a working bot, modified from this original bot at top of post.

Auto login not quite right.

AutoScape

; *** Start added by AutoIt3Wrapper ***
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
; *** End added by AutoIt3Wrapper ***
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;Made by Generator in AutoIt Forums
;UDF by Developers of AutoIt

#include<Constants.au3>
#include<windowsConstants.au3>
#include<GUIConstants.au3>
#include<IE.au3>
#include<Misc.au3>
#include<GuiComboBox.au3>
#include<string.au3>
#include<inet.au3>
$abcdefg = 0
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Dim $mode = 0, $version = "", $start = 0
Dim $DataClt[4], $Color[2]
$DataClt[0] = "Number of tree/rock(s) to find before dropping inventory,2,28,16"
$DataClt[1] = "Number of second(s) to wait before next tree/rock,2,60,7"
$DataClt[2] = "Number of second(s) delay after right click dropping,1,5,1"
$DataClt[3] = "Number of second(s) delay after each drop,1,5,1"
HotKeySet("{ESC}", "_StopBot")
HotKeySet("{insert}", "_insertBot")
HotKeySet("{home}", "help")
HotKeySet("{end}", "hidehelp")
HotKeySet("+!o", "randoff")
_Singleton("Autoscape")
_IEErrorHandlerRegister()
#Region Welcome GUI
If FileExists("set.rs") Then
    $user1 = IniRead("set.rs", "login", "user", "")
    $pass1 = IniRead("set.rs", "login", "pass", "")
    $wrl1 = IniRead("set.rs", "world", "type", "")
    $user1 = _StringEncrypt(0, $user1, "rsuser", 5)
    $pass1 = _StringEncrypt(0, $pass1, "rspass", 5)
Else
    $user1 = ""
    $pass1 = ""
    $wrl1 = ""
EndIf

$user = InputBox("Username", "Username, Used For Relogging In and Auto Logging in (required for autominer to work) [will be saved in an ecrypted file in " & @ScriptDir & " for future use]", $user1)
$pass = InputBox("Password", "Password, Used For Relogging In and Auto Logging in (required for autominer to work)[will be saved in an ecrypted file in " & @ScriptDir & " for future use]", $pass1, "#")
$wrl = InputBox("Members or non members", "A0 = Random non members world" & @CRLF & "A1 = Random members world" & @CRLF & "", $wrl1)

IniDelete("set.rs", "login")
IniDelete("set.rs", "world")
IniWrite("Set.rs", "login", "user", _StringEncrypt(1, $user, "rsuser", 5))
IniWrite("Set.rs", "login", "pass", _StringEncrypt(1, $pass, "rspass", 5))
IniWrite("Set.rs", "world", "type", $wrl)
UDPStartup()



$helpmsg = "This is an undetectable 'Power Leveler'. It can be used on trees and ore. If set up right, it can even mine and drop Rune Essence. This program auto-mines and auto-drops, and drops only the item you select. (To disable use none.)" & @CRLF
$helpmsg &= "1. (PRESS THE INSERT BUTTON TO AUTO-LOGIN YOU DON'T NEED TO PRESS ANYTHING ELSE, PRESS INSERT WHEN RUNESCAPE LOADS)." & @CRLF
$helpmsg &= "2. Wait to log in." & @CRLF
$helpmsg &= "3. Go to a mining/tree area and mine/cut one of the item you wish to train on, then click down on the 'Tree/Rock Color' button and hold down the mouse button and drag it over the color of ore/wood you wish to collect. Drag the 'Log/Ore Color' crosshair over a part of the wood/ore that is a different color than any other item in your inventory. " & @CRLF
$helpmsg &= "4. Adjust the settings such as ore to mine, and time to wait for action by clicking the drop down box, selecting the setting and moving the slider." & @CRLF
;$helpmsg &= "5. Click Start and you will be asked if you wish to randomly talk every so often, if you click yes you need to format your sayings like this-" & @CRLF
;$helpmsg &= "6. (E.g.)flash1:My Name Is Zach / This is saying number two / This is sentance number three. You will need to use a '/' to seperate lines." & @CRLF
$helpmsg &= "5. At any given time press the 'Home' key to see this information. (press end to hide it)"



$NEWS = _INetGetSource("http://zachandlindsey.com/newnews.txt")
$NEWS = StringRegExpReplace($NEWS, "<br />", @CRLF)
$NEWS = StringRegExpReplace($NEWS, "&gt;", ">")

$newsgui = GUICreate("news and Info", 700, 500)
GUICtrlCreateEdit($NEWS, -1, -1, 350, 500)
GUICtrlCreateLabel($helpmsg, 350, -1, 350, 500)
GUISetState()
WinSetState("news and Info", "", @SW_LOCK)
WinSetOnTop("news and Info", "", 1)
WinSetState("Autoscape", "", @SW_LOCK)






$form0 = GUICreate("Autoscape", 400, 70, -1, -1, $WS_CAPTION, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$label0 = GUICtrlCreateLabel("Welcome to Autoscape...Please wait for vertification....", 10, 5, 390, 20, -1)
$progress0 = GUICtrlCreateProgress(10, 25, 240, 20, $PBS_SMOOTH)
$label1 = GUICtrlCreateLabel("Looking for Java plug-in....", 10, 50, 240, 20, -1)
GUISetState(@SW_SHOW, $form0)
For $i = 0 To 100 Step 10
    GUICtrlSetData($progress0, $i)
    Sleep(1)
Next
If Not _CheckJava() Then
    $label3 = GUICtrlCreateLabel("Get the latest Java", 260, 25, 140, 20, -1)
    GUICtrlSetData($label1, "Please install Java before continuing...")
    _HyperLink($label3)
Else
    GUICtrlCreateLabel("Version: " & $version, 260, 25, 140, 20, -1)
    $label4 = GUICtrlCreateLabel("Start", 370, 50, 30, 20, -1)

    _HyperLink($label4)
EndIf

While Not $mode
    $Info0 = GUIGetCursorInfo($form0)
    If $version == "" Then
        If $Info0[2] And $Info0[4] = $label3 Then
            While _IsPressed("01")
                Sleep(1)
            WEnd
            _GetJava()
            Exit
        EndIf
    ElseIf $Info0[2] And $Info0[4] = $label4 Then
        While _IsPressed("01")
            Sleep(1)
        WEnd
        $mode = 1
        GUIDelete($form0)
    EndIf
    Sleep(1)
WEnd


#EndRegion Welcome GUI
#Region Main GUI




$form1 = GUICreate("Autoscape", 830, 600, -1, -1, -1, $WS_EX_CLIENTEDGE)
$oIE = _IECreateEmbedded()
$guiactivex = GUICtrlCreateObj($oIE, 20, 10, 790, 513)
If $wrl = "A0" Then
    
    _IENavigate($oIE, "http://www.runescape.com/game.ws?m=0&j=1", 0)
ElseIf $wrl = "A1" Then
    
    _IENavigate($oIE, "http://www.runescape.com/game.ws?m=1&j=1", 0)

Else
    _IENavigate($oIE, "http://www.runescape.com/game.ws?m=1&j=1", 0)
EndIf


$combo0 = GUICtrlCreateCombo("", 20, 530, 400, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($combo0, String(_GetComboTxt()))
GUICtrlSetFont($combo0, 9, 400, 0, "Tahoma")
_GUICtrlComboBox_SetCurSel($combo0, 0)
$slider0 = GUICtrlCreateSlider(20, 555, 400, 20, $TBS_NOTICKS)
$label2 = GUICtrlCreateLabel("", 20, 575, 20, 20, -1)
$label5 = GUICtrlCreateLabel("", 400, 575, 25, 20, -1)
$label6 = GUICtrlCreateLabel("", 160, 575, 200, 20, -1)
GUICtrlSetFont($label6, 9.5, 400, 0, "Tahoma")
_SelectCombo($label2, $label5, $label6, $slider0, $DataClt, _GUICtrlComboBox_GetCurSel($combo0))
GUICtrlSetCursor($slider0, 0)
$button0 = GUICtrlCreateButton("+", 430, 555, 100, 40, -1)
GUICtrlSetFont(-1, 30, 400)
GUICtrlSetCursor(-1, 3)
$button1 = GUICtrlCreateButton("+", 535, 555, 100, 40, -1)
GUICtrlSetCursor(-1, 3)
GUICtrlSetFont(-1, 30, 400)
$label7 = GUICtrlCreateLabel("Tree/Rock Color", 430, 530, 100, 20, $SS_CENTER)
GUICtrlSetFont(-1, 9.5, 400, 0, "Tahoma")
$label8 = GUICtrlCreateLabel("Log/Ore Color", 535, 530, 100, 20, $SS_CENTER)
GUICtrlSetFont(-1, 9.5, 400, 0, "Tahoma")
$button2 = GUICtrlCreateButton("Start Training", 640, 530, 170, 65, -1)
GUICtrlSetFont(-1, 16, 400, 0, "Century Gothic")
GUICtrlSetOnEvent($button2, "_Start")
GUICtrlSetOnEvent($slider0, "_UpdateSlider")
GUICtrlSetOnEvent($combo0, "_Combo")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_StopBot")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW, $form1)




While 1
    $Info1 = GUIGetCursorInfo($form1)
    If $Info1[2] And $Info1[4] = $button0 Then
        While _IsPressed("01")
            Sleep(1)
        WEnd
        _GetColor(0)
    ElseIf $Info1[2] And $Info1[4] = $button1 Then
        While _IsPressed("01")
            Sleep(1)
        WEnd
        _GetColor(1)
    EndIf
    While $start
        $amount0 = StringSplit($DataClt[0], ",", 1)     
        For $i = 1 To $amount0[4]
            If $start = 0 Then ExitLoop
            $Winpos = WinGetPos($form1, "")
            $Search0 = PixelSearch($Winpos[0]+20, $Winpos[1]+10, $Winpos[0] + 780, $Winpos[1] + 523, $Color[0], 0, 1)
            
            If Not @error Then
                        
                Mousemove( $Search0[0]+2, $Search0[1]+2,2)
                Sleep(Random(900,1500,1))
                MouseClick("Left")
                Sleep(Random(900,1500,1))
                send("{left down}")
                Sleep(Random(200,500,1))
                send("{left up}")
                send("{up down}")
                Sleep(Random(200,500,1))
                send("{up up}")
                send("{right down}")
                Sleep(Random(200,500,1))
                send("{right up}")
                send("{down down}")
                Sleep(Random(200,500,1))
                send("{down up}")
                
                $amount1 = StringSplit($DataClt[1], ",", 1)
                $Timer = TimerInit()
                Do
                    Sleep(1)
                    If $start = 0 Then ExitLoop
                Until TimerDiff($Timer) > Number($amount1[4] * 1000)
            EndIf           
            Sleep(1)
        Next
        $amount2 = StringSplit($DataClt[2], ",", 1)
        $amount3 = StringSplit($DataClt[3], ",", 1)
        For $ii = 1 To 28           
            If $start = 0 Then ExitLoop         
            $WinPos0 = WinGetPos($form1, "")
            $Search1 = PixelSearch($Winpos0[0]+20 + 545, $Winpos0[1]+10 + 205, $Winpos0[0] + 810, $Winpos0[1] + 523, $Color[1], 0, 1)
            If Not @error Then
                MouseMove($Search1[0]+2, $Search1[1]+2,2)
                Sleep(Random(900,1500,1))
                MouseClick("Right")
                Sleep($amount2[4] * 1000)
                MouseMove($Search1[0]+2,$Search1[1]+35+3,2)
                MouseClick("Left")
                Sleep($amount3[4] * 1000)
            EndIf
            Sleep(1)
        Next
        Sleep(1)
    WEnd
    Sleep(1)
        
                
                
                
                
WEnd
#EndRegion Main GUI
Func _HyperLink($label)
    GUICtrlSetColor($label, 0x1B2392)
    GUICtrlSetFont($label, 8.5, 400, 4, "Arial")
    GUICtrlSetCursor($label, 0)
EndFunc   ;==>_HyperLink
Func _CheckJava()
    $regread = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start", "CurrentVersion")
    $version = String($regread)
    If Not @error Then
        Return $version And 1
    Else
        Return 0
    EndIf
EndFunc   ;==>_CheckJava
Func _GetJava()
    _IECreate("www.java.com/getjava/", 0, 1, 0, 0)
EndFunc   ;==>_GetJava
Func _Exit()
    Exit
EndFunc   ;==>_Exit
Func _GetComboTxt()
    Local $split, $combotxt = ""
    For $i = 0 To UBound($DataClt, 1) - 1
        $split = StringSplit($DataClt[$i], ",", 1)
        $combotxt = $combotxt & $split[1] & "|"
        If $i = UBound($DataClt, 1) - 1 Then StringTrimRight($combotxt, 1)
    Next
    Return $combotxt
EndFunc   ;==>_GetComboTxt
Func _SelectCombo($min, $max, $current, $slider, $array, $index)
    Local $split
    $split = StringSplit($array[$index], ",", 1)
    GUICtrlSetData($min, $split[2])
    GUICtrlSetData($max, $split[3])
    GUICtrlSetData($current, "Current Value: " & $split[4])
    GUICtrlSetLimit($slider, $split[3], $split[2])
    GUICtrlSetData($slider, $split[4])
EndFunc   ;==>_SelectCombo
Func _Combo()
    _SelectCombo($label2, $label5, $label6, $slider0, $DataClt, _GUICtrlComboBox_GetCurSel($combo0))
EndFunc   ;==>_Combo
Func _UpdateSlider()
    Local $split, $trimright
    $split = StringSplit($DataClt[_GUICtrlComboBox_GetCurSel($combo0)], ",", 1)
    $trimright = String(StringTrimRight($DataClt[_GUICtrlComboBox_GetCurSel($combo0)], StringLen($split[4])) & GUICtrlRead($slider0))
    $DataClt[_GUICtrlComboBox_GetCurSel($combo0)] = $trimright
    GUICtrlSetData($label6, "Current Value: " & GUICtrlRead($slider0))
EndFunc   ;==>_UpdateSlider
Func _GetColor($number)
    Local $Colordata
    $Colordata = PixelGetColor(MouseGetPos(0), MouseGetPos(1))
    $Color[$number] = $Colordata
EndFunc   ;==>_GetColor
Func _Start()
    GUICtrlSetState($button0, $GUI_DISABLE)
    GUICtrlSetState($button1, $GUI_DISABLE)
    GUICtrlSetState($button2, $GUI_DISABLE)
    GUICtrlSetState($slider0, $GUI_DISABLE)
    GUICtrlSetState($combo0, $GUI_DISABLE)
    $start = 1
EndFunc   ;==>_Start
Func _StopBot()

    WinSetState("Autoscape", "", @SW_UNLOCK)
    
    If $start Then
        $start = 0
        GUICtrlSetState($button0, $GUI_ENABLE)
        GUICtrlSetState($button1, $GUI_ENABLE)
        GUICtrlSetState($button2, $GUI_ENABLE)
        GUICtrlSetState($slider0, $GUI_ENABLE)
        GUICtrlSetState($combo0, $GUI_ENABLE)
        $abcdefg = 0
    EndIf
EndFunc   ;==>_StopBot
Func _insertBot()
    $Winpos = WinGetPos($form1, "")
    MouseMove($Winpos[0] + 805, $Winpos[1] + 547)
    MouseDown("left")
    Sleep("1000")
    MouseUp("left")
    MouseMove($Winpos[0] + 600, $Winpos[1] + 547)
    MouseClick("left")
    Sleep(500)
    Send("{ENTER}", 0)
    Sleep(1000)
    Send($user & "{ENTER}" & $pass, 0)
    Sleep(500)
    Send("{ENTER}", 0)
    Sleep(6000)
    MouseMove($Winpos[0] + 450, $Winpos[1] + 380)

    MouseClick("Left")
EndFunc   ;==>_insertBot

Func help()
    WinSetState("news and Info", "", @SW_SHOW)
EndFunc   ;==>help

Func hidehelp()
    WinSetState("news and Info", "", @SW_HIDE)
EndFunc   ;==>hidehelp

Func randoff()
    MsgBox(64, "Anti Randoms", "'Anti Randoms' is now off")
EndFunc   ;==>randoff
Link to comment
Share on other sites

For some reason it will not exit process when done so must close with task manager.

Works best with low detail Will work with high detail if pixel search locations are changed.

have found way to exit for sure.

replace old code for _exit() with this

Func _Exit()
    ProcessClose(@AutoItPID)
    Exit
    
EndFunc   ;==>_Exit
Edited by ODPOA
Link to comment
Share on other sites

PLEASE NOTE, my autoit experience == 0

Posted Image

It's a bit more complicated than that because there is a variable width between characters.. I've solved most of the problems that have to do with variable width. In my first version of the OCR I had problems with speed in AutoIt and tried to work around the speed problem using the wrong method. It seems much faster at the moment, or that might be my new computer, so I don't have to fall back to bad solutions.

I've now brought down every character to something simple like this:

Posted Image

I'm now coming up with a algorithm that will compare the read character (which may or may not be correct) to a pre-set group of characters. It will calculate the percentage matched and based on that pick the best possible character. It will also error out sometimes, when the background can not be told apart from the letters. ( which has already happened to me in banks sometimes, the walls are text-colored )

Edit: I have a working OCR ready. I am now building a huge list of characters.

Edited by Manadar
Link to comment
Share on other sites

It's a bit more complicated than that because there is a variable width between characters.. I've solved most of the problems that have to do with variable width. In my first version of the OCR I had problems with speed in AutoIt and tried to work around the speed problem using the wrong method. It seems much faster at the moment, or that might be my new computer, so I don't have to fall back to bad solutions.

I've now brought down every character to something simple like this:

Posted Image

I'm now coming up with a algorithm that will compare the read character (which may or may not be correct) to a pre-set group of characters. It will calculate the percentage matched and based on that pick the best possible character. It will also error out sometimes, when the background can not be told apart from the letters. ( which has already happened to me in banks sometimes, the walls are text-colored )

Edit: I have a working OCR ready. I am now building a huge list of characters.

i would love to see what comes out of this, i am a big fan of your former program (though i haven't used it in any serious application) but in conjunction with the current posted drop bot, it would seem there is a very good bot (anti-macro randoms aside)

please keep the post updated if you continue your work!

Link to comment
Share on other sites

  • 5 months later...

Hello all.

I have ran several different scripts throughout the years but have never taken the time to learn to script. I have encountered a problem and was curious to see if anyone else has had this problem or if anyone can help me fix it.

When I go to run the script I get this AutoIt Error

Line 20 (File "C... blah blah):

$form0 = GUICreate("Power Training", 400, 70, -1, -1, $WS_CAPTION,

$WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)

$form0 = GUICreate("Power Training", 400, 70, -1, -1, ^ ERROR

Error: Variable used without being declared.

When I run it in .exe form, I get this error:

Line -1:

Error: Variable used without being declared.

If anyone could possibly help me with this, that would be wonderful. I'm not using this for mining, just simply chopping trees. Thank you for your time.

Also, if anyone knows of any other script, perhaps one that will kill any mobs that are around me, that would be splended! Thank you for your time!

EDIT:

I failed to mention that I am running vista and not XP. I notice that it says that I need to use XP, could this be the reason for my errors? If so, is there a way to fix this problem?

Edited by LacruseMalvae
Link to comment
Share on other sites

  • 2 weeks later...

Hello all.

I have ran several different scripts throughout the years but have never taken the time to learn to script. I have encountered a problem and was curious to see if anyone else has had this problem or if anyone can help me fix it.

When I go to run the script I get this AutoIt Error

Line 20 (File "C... blah blah):

$form0 = GUICreate("Power Training", 400, 70, -1, -1, $WS_CAPTION,

$WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)

$form0 = GUICreate("Power Training", 400, 70, -1, -1, ^ ERROR

Error: Variable used without being declared.

When I run it in .exe form, I get this error:

Line -1:

Error: Variable used without being declared.

If anyone could possibly help me with this, that would be wonderful. I'm not using this for mining, just simply chopping trees. Thank you for your time.

Also, if anyone knows of any other script, perhaps one that will kill any mobs that are around me, that would be splended! Thank you for your time!

EDIT:

I failed to mention that I am running vista and not XP. I notice that it says that I need to use XP, could this be the reason for my errors? If so, is there a way to fix this problem?

You need to import a couple libraries. The problem may have risen due to a new version of autoit, which has different constants in different libraries. importing <WindowConstants.au3> should do the trick. If you get another error due to "variable not being declared" or whatever, just search the culprit in autoit help, and the library it belongs to should pop up.

Link to comment
Share on other sites

  • 1 month later...

this bot is not "randomised"

it is clicking the same locations even in inventory issues

so it will be "detected"

if you want you can try >

train magic to LvL43 and use superheat ores with predefined coordinates

so you will have a magic lvl 80 in 1 day with iron ores

but you will be banned in 4 day : (

please randomise clicking in limits...

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...