Sign in to follow this  
Followers 0
Xoenix

2 Questions.

6 posts in this topic

Some more question for you smart peoples ;)

I've made my bot for a game, and the Pixel detection works fine for the monsters, but only the ones that are actually in the area at the beginning of each cycle, like I want it to wait 10 seconds with no monsters anywhere before changing worlds. But at the moment if he stops attacking, a monster walks in and he doesnt attack it, I want him to, any idea how?

Also is it possible to set up 2 colours to detect? Like a monster is one colour and another is a diferent colour, and I want to be able to have my guy attack both.

Thanks so much for the help :P

Any more details just ask.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You could use TimerInit() and TimerDiff() to keep track of how long it has been since the last monster has appeared. If a monster appears, call TimerInit() again; if TimerDiff() ever reports 10,000 or more then you can do whatever is necessary to change worlds.

Detecting two types of monster:

local $colour = pixelGetColor(x, y)
if ($colour = 0x123456) then
   ; process one type of monster
elseIf ($colour = 0xabcdef) then
   ; process another type of monster
endIf
Edited by LxP

Share this post


Link to post
Share on other sites

You could use TimerInit() and TimerDiff() to keep track of how long it has been since the last monster has appeared. If a monster appears, call TimerInit() again; if TimerDiff() ever reports 10,000 or more then you can do whatever is necessary to change worlds.

Ok I'm sure thats very useful, so thanks :mad2:

Except Im not sure how to incorporate it ;)

Here the attack function:

;Attack
Func Attack()
While 1
WinWaitActive("MapleStory")
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
While @error = 0
Send ("{ALT}")
Sleep (1000)
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
Wend
Sleep (10000)
Send("{ESC}")
Sleep(600)
Send("{ENTER}")
Sleep(600)
Send("{RIGHT}")
Sleep(200)
Send("{ENTER}")
Sleep(5000)
Send ("{RIGHT down}")
Sleep (500)
Send ("{RIGHT up}")
Sleep (500)
WEnd
EndFunc

So I'd be forever grateful if you incorporate TimeInit and TimeDiff into it *Begs*

Thanks sooo much :P

Share this post


Link to post
Share on other sites

Anyone? Or could someone explain how to incorporate TimeInit and TimeDiff?

Please?

Thanks

Share this post


Link to post
Share on other sites

This should start you off:

local $time = timerInit()
while 1
    if aMonsterIsNear() then
        handleMonster()
        $time = timerInit()
    endIf
    if timerDiff($time) > 10000 then exitLoop
    sleep(100)
wEnd

; code to change worlds

Share this post


Link to post
Share on other sites

Well I tried :P

#include <GuiConstants.au3>

GuiCreate("Smart Bot - Ant Tunnel", 348, 223, 366,266)
$n = GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 366,266)
GuiCtrlSetState($n, $GUI_DISABLE)
$Button1 = GuiCtrlCreateButton("About", 80, 72, 57, 33)
$Button2 = GuiCtrlCreateButton("Stop", 200, 72, 57, 33)
$Button3 = GuiCtrlCreateButton("Start", 200, 112, 57, 33)

GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button1;Channel Button
MsgBox (0, "About", "Version 1.0 - Made by Xoenix - (Copyright) 2005")
Case $msg = $Button2;Stop Button
Terminate()
Case $msg = $Button3;Start Button
Overall()
Case Else
;;;
EndSelect
WEnd
Exit


;Terminate
Func Terminate()
Exit 0
EndFunc

Func Overall()
While 1
WinWaitActive("MapleStory")
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
While @error = 0
Send ("{ALT}")
Sleep (1000)
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
local $time = timerInit()
Wend
While 1
    If MonsterFind() then
        Attack()
        $time = timerInit()
    endIf
    if timerDiff($time) > 10000 then exitLoop
    sleep(100)
Wend
Send("{ESC}")
Sleep(600)
Send("{ENTER}")
Sleep(600)
Send("{RIGHT}")
Sleep(200)
Send("{ENTER}")
Sleep(5000)
Send ("{RIGHT down}")
Sleep (500)
Send ("{RIGHT up}")
Sleep (500)
Wend
EndFunc

;Attack
Func Attack()
While 1
WinWaitActive("MapleStory")
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
While @error = 0
Send ("{ALT}")
Sleep (1000)
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
Wend
Sleep (10000)
Send("{ESC}")
Sleep(600)
Send("{ENTER}")
Sleep(600)
Send("{RIGHT}")
Sleep(200)
Send("{ENTER}")
Sleep(5000)
Send ("{RIGHT down}")
Sleep (500)
Send ("{RIGHT up}")
Sleep (500)
WEnd
EndFunc

;Find Monster
Func MonsterFind()
While 1
$coord2 = PixelSearch( 590, 355, 768, 392, 0x557799, 0, 2 )
While @error = 0
Send ("{ALT}")
Sleep (1000)
WEnd
Wend
EndFunc

:mad2: I just have no idea, the guy keeps attacking, never stops.

I tried troubleshooting but I don't fully understand what I've got in there, someone shed some light on this?

Oh and thanks LxP for helping out ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0