Jump to content
Sign in to follow this  
TAScott

WHAT! is wrong with this script

Recommended Posts

Ok i'll tell you the purpose of it,, at the start it clicks the healer guy,, then waits 5 seconds, then exits and hits battle monsters,,, It is sapposed to read one of the last pixels in the monsters health,, if that pixel is red,, it will move the mouse to the attack button and press the attack button ,, then again press the second attack button. Then it is sapposed to wait 10 seconds for the monster to respond with an attack. From there I want The (if then) statement (Where it reads the pixel) to loop until that pixel is black (Meaning the monster has died),, Then I want the script to repeat itsself,, Im sorry for posting so much bullcrap,, Im noob,, I really need to finish this tonight,, Thanks

Sleep(2000)

MouseMove(616,515)

MouseDown("left")

MouseUp("left")

Sleep(5000)

MouseMove(919,665)

MouseDown("left")

MouseUp("left")

sleep(500)

MouseMove(890,577)

MouseDown("left")

MouseUp("left")

sleep(10000)

Do

$Color = PixelGetColor(850,640)

if Hex($Color,6) = 0xDD0000 or 0xFF0000 or 0xEE0000 or 0xCC0000 or 0xBB0000 or 0xAA0000 Then

; do MouseMove(619,361)MouseDown("left")MouseUp("left")MouseMove(644,308)MouseDown("left")MouseUp("left")Sleep(10000)

EndIf

Until Hex($Color,6) = 0x181818

Edited by TAScott

Share this post


Link to post
Share on other sites

if Hex($Color,6) = 0xDD0000 or 0xFF0000 or 0xEE0000 or 0xCC0000 or 0xBB0000 or 0xAA0000 ThenoÝ÷ Ù(hºW[y«­¢+ØÀÌØí!àô!à ÀÌØí
½±½È°Ø¤)%ÀÌØí!àôÁáÀÀÀÀ½ÈÀÌØí!àôÁáÀÀÀÀ½ÈÀÌØí!àôÁáÀÀÀÀ½ÈÀÌØí!àôÁá
ÀÀÀÀ½ÈÀÌØí!àôÁá   ÀÀÀÀ½ÈÀÌØí!àôÁáÀÀÀÀQ¡¸

Kurt

Share this post


Link to post
Share on other sites

It's still fucking up??,, whats wrong:(?

"Doesn't work" needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

_Kurt fixed your color comparisons.

Nahuel and JesusIsKing both pointed you in the right direction.

What exactly do you need now?

Replace MouseMove/Down/Up with MouseClick

You have no code in your If statement, just a comment. (which will not be executed)

The only loop you wrote does nothing until a pixel is a specific shade of gray.

When this loop ends, what happens? Do you have more code?


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

I Was just going to test this part,, if I could get help with this part i would learn a little from it and continue to finish the script,, and A shade of grey????,,, its sapposed to be,, When it locates that pixel and its red,, its sapposed to move the mouse to the correct location and click then move and click again (To attack),, then I wanted that to repeat Until the Pixel Turns Black (The monster will be dead)

Share this post


Link to post
Share on other sites

WHAT DO I DO,, I've tried switching the pixel,, but it wont do what its sapposed to after it checks if the pixel is red

Post your updated code or PM it to me... Without seeing this, we can't tell whether you took any of our suggestions, or are still at square one.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Im a noob but would this work?

include <Array.au3>

Dim $avArray
$avArray = _ArrayCreate("0xDD0000", "0xFF0000", "0xEE0000", "0xCC0000", "0xBB0000", "0xAA0000")
Dim $avArray1 = 0x181818
Sleep(2000)
MouseClick("Left",616,515)
Sleep(5000)
MouseClick("Left",919,665)
While 1
    Sleep(100)
    If PixelGetColor(850,640)== Hex($avArray,6) Then
        MouseClick("Left",619,361)
        Sleep(300)
        MouseClick("Left",644,308)
        Sleep(10000)
    Until PixelGetColor(850,640)== Hex($avArray1,6)
Else
    Sleep(100)
WEnd

Share this post


Link to post
Share on other sites

Im a noob but would this work?

Not bad, but it won't work.

You're missing an EndIf, and you would need to check each array value individually.

I worked with TAScott to get it working, but he's going to study up and revisit it later.

A more structured approach is needed because of other game factors. (Player health, random encounters, etc...)

Here's where we left it, in case anyone's interested.

While 1
    Sleep(2000)
    MouseClick("left", 616, 515, 0) ; Click the healer guy
    Sleep(5000)
    MouseClick("left", 919, 665, 0) ; Exit?
    Sleep(500)
    MouseClick("left", 890, 577, 0) ; Hits battle monsters
    Sleep(10000)
    Do
        $Color = PixelGetColor(849, 638) ; Get color of monster health
        Switch $Color
            Case 0xDD0000, 0xFF0000, 0xEE0000, 0xCC0000, 0xBB0000, 0xAA0000 ; Check if it's Red
                MouseClick("left", 619, 361, 0) ; Click First Attack
                MouseClick("left", 644, 308, 0) ; Click Second Attack
                Sleep(10000)
        EndSwitch
        Sleep(100)
    Until $Color = 0x181818 ; Monster health is gray
    Sleep(5000)
    MouseClick("left", 625, 506, 0) ; Monster is dead
WEnd

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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  

×
×
  • Create New...