Sign in to follow this  
Followers 0
Ginseng

Looking for Guidence on Script

2 posts in this topic

I've recently started playing a MMO again after a few years of been inactive and i've noticed whilst playing that most people on the server are now much higher (obviously), so i decided to make a script to help me level when i basically cant be arsed, so having wrote a script for a previous game i thought it would be easy however since writing my last script i've been writing CSS coding and HTML coding so im having trouble remembering the commands for AutoIt.

Here's what i got so far. I've commented in the Script Code on what im expecting or trying to do in certain parts of the script.

;I need the script to activate the game client window before starting the script however im not sure how to do this with a game client.

;Title = GameName
;Class = RwAppClass

;WinActivate("GameName", "RwAppClass") - i think this is what i need to do but not sure.
While 1
Func 1;Search Monster
    
    send("{Tab}");targets monster - displaying hp bar on top of client
    sleep(100)
    $Coord1 = PixelSearch(418, 48, 0xE74542);searches mobs hp bar for Red Color
    
;If PixelSearch = Red, Then Jump to Func 2
;If PixelSearch = Black, Then Jump to Func 3
    
EndFunc
    
Func 2;Fight
    
    Send("3");shortcut in game for attack
        While 2
            $Coord2 = PixelSearch(418, 48, 0x212421);searches mobs hp bar for Black Color
            If @Error Then
        ;Repeat Search until HP Bar = Black
        Else
        ;If not @Error then run Func 3
        WEnd

;What i expect the above to do:
    
;At this point i want the script to attack 
;until the monster dies (IE: HP Bar = Black) 
;however it can take anything from 5-20 seconds
               ;to kill the monster so how can i write the script
;to repeat the pixelsearch during the fight 
;so even if the monster dies in 5 seconds it detects 
               ;this and moves on to Func 3 and picks up items if any
    
;I think the code i wrote above will work how i want it to but not sure.
    
EndFunc

Func 3;Pick Up
    
    $Coord2 = PixelSearch(0, 0, 0xFFFFBF);Checks for a Yellow Color on the Game Window
    If @Error Then end Script and start from begining.
    
;Okay im not sure if this next part is possible 
;but i want the PixelSearch to only check the top 
;75% of the Game Client Window as the lower 25%
;is all the User Interface and not of importance
    
;1 - 5 items maybe more can drop from a monster when killed so the pickup key has to be pushed a few times
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    
EndFunc
WEnd

;Script without comments.
;I need the script to activate the game client window before starting the script however im not sure how to do this with a game client.

;Title = GameName
;Class = RwAppClass

;WinActivate("GameName", "RwAppClass") - i think this is what i need to do but not sure.

While 1
Func 1  
    send("{Tab}")
    sleep(100)
    $Coord1 = PixelSearch(418, 48, 0xE74542)
EndFunc
    
Func 2
    Send("3")
        While 2
            $Coord2 = PixelSearch(418, 48, 0x212421) 
            If @Error Then
        Else
        WEnd
EndFunc

Func 3
    $Coord2 = PixelSearch(0, 0, 0xFFFFBF) 
    If @Error Then end Script and start from begining.
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
    send("{SPACE}")
    sleep(100)
EndFunc
WEnd

If someone can have a look at the top code and rewrite my code below to match what im looking for in the top section i'd be very grateful, the script isnt too complex dispite all the comments.

In a nutshell its basically 3 parts.

Search - this targets a monster by using the tab key ingame

->

Fight - based on color of monster HP Bar (Red = Fight, Black = Stop and go onto Pick Up)

->

Pick Up - based on text color of the item name names on the floor (Yellow = Pick Up, No Yellow = Back to Search)

Thanks for any help.

Share this post


Link to post
Share on other sites



We don't really support bots or encourage them.

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