Sign in to follow this  
Followers 0
bacte

Some Function is not working

2 posts in this topic

Hi, I just started making a simple bot on the new Online games im playing but i have a problem when calling a certain function bcoz it does not work. I do not know if my code is correct. need help here. also if you have ideas to simplify the main script pls tell me.

function that is not working when included in the main script is

Func DetectDuraEquip() and Func RepairEquip() . All of the functions works fine when I tested it one by one.

WinActive ("???")

sleep (1000)

mousemove(382,16)

mouseclick("")

;window size 868,672

$AliveMonster = 0xF90000 ; 340,73

$DeadMonster = 0xF90000 ; 226,73

;Global $Monsters = 0xFF0000

$MaxHP = 0xBF4040 ;208,73

$LowHP = 0xBF4040 ; 141,73

$MaxMP = 0x3D75A7;215,85

$LowMP = 0x3D75A7;105,85

$Repair = 0x3954A9;818,335

$NPC = 0x5D93C4

$EquipDura = 0x5154A6;973,335(right wing); (818,336 Left Wing)

$Mob = 0

;Main Script

Do

KillMonster()

HP()

Loot() ; after the func loot the whole macro just idle or stop.

Sleep (1000)

;Do

If PixelGetColor(818,336) = $EquipDura Then

DetectDuraEquip() ; detect if wep or armor is in need of repair

sleep (1000)

RepairEquip() ; detect blcksmith and repair equip

sleep (1000)

GoToMonster() ; go back to field to kill monster

sleep (50000)

ExitLoop

EndIf

;Until PixelGetColor(818,336) <> $EquipDura

Until $Mob = 1

Func HP()

While 1

If PixelGetColor(190, 73) <> $MaxHP Then

;send ("1")

;sleep (1000)

Send ("2")

sleep (4000)

Else

ExitLoop

EndIf

WEnd

EndFunc

Func KillMonster()

Send("{Tab}")

sleep (500)

While 1

If PixelGetColor(226, 73) = $DeadMonster Then

send ("4")

sleep (2000)

send ("8")

sleep (2000)

send ("3")

sleep (2000)

send ("8")

Else

ExitLoop

EndIf

WEnd

EndFunc

Func Loot()

Send("z")

sleep(500)

Send("z")

sleep(500)

Send("z")

sleep(500)

Send("z")

sleep(500)

Send("{z down}")

sleep (4000)

Send("{z up}")

EndFunc

Func Teleport()

send ("7")

sleep (1000)

mousemove(203,259)

mouseclick("")

sleep (1000)

mousemove(235,484)

mouseclick("")

sleep (1000)

EndFunc

Func GoToRepair()

send ("0")

sleep (1000)

send ("m")

sleep (1000)

mousemove(704,143)

mouseclick("")

sleep (1000)

mousemove(732,181)

mouseclick("")

sleep (1000)

mousemove(482,60)

mouseclick("")

sleep (1000)

send ("m")

EndFunc

Func RepairEquip() ; Function im having problem with!!!not working when added to main script.

While $Repair = 0

$coord = PixelSearch(200,50,200,200, $NPC, 10, 10)

$coord = PixelSearch(200,50,250,250, $NPC, 20, 10)

$coord = PixelSearch(200,50,270,270, $NPC, 25, 10)

$coord = PixelSearch(200,50,300,300, $NPC, 30, 10)

$coord = PixelSearch(200,50,350,350, $NPC, 35, 10)

$coord = PixelSearch(200,50,370,370, $NPC, 40, 10)

$coord = PixelSearch(200,50,390,390, $NPC, 45, 10)

$coord = PixelSearch(200,50,400,400, $NPC, 10, 10)

$coord = PixelSearch(200,50,450,450, $NPC, 20, 10)

$coord = PixelSearch(200,50,470,470, $NPC, 25, 10)

$coord = PixelSearch(200,50,500,500, $NPC, 30, 10)

$coord = PixelSearch(200,50,550,550, $NPC, 35, 10)

$coord = PixelSearch(200,50,570,570, $NPC, 40, 10)

$coord = PixelSearch(200,50,590,590, $NPC, 45, 10)

$coord = PixelSearch(200,50,600,600, $NPC, 50, 10)

If Not @error Then

MouseClick("left", $coord[0], $coord[1], 1, 2)

sleep ( 1000 )

mousemove(95,441)

mouseclick("")

Sleep (1000)

send ("{esc}")

send ("{esc}")

ExitLoop

EndIf

WEnd

EndFunc

Func GoToMonster()

send ("-")

sleep (500)

mousemove(582,244)

mouseclick("")

sleep (1000)

mousemove(359,161)

mouseclick("")

sleep (500)

mousemove(259,197)

mouseclick("")

sleep (500)

mousemove(194,224)

mouseclick("")

sleep (500)

mousemove(323,416)

mouseclick("")

sleep (500)

mouseclick("")

sleep (500)

mouseclick("")

sleep (500)

EndFunc

Func DetectDuraEquip() ; Function im having problem with!!!not working.

;While 1

If PixelGetColor(818,336) = 0x5154A6 Then

Teleport()

sleep (10000)

GoToRepair()

sleep (30000)

;RepairEquip()

;sleep (20000)

;GoToMonster()

;sleep (50000)

EndIf

;WEnd

EndFunc

Share this post


Link to post
Share on other sites



First: Size 2 is more then enough.

Second: Have you read this?

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