Sign in to follow this  
Followers 0
Seagul

Nostale Macro

11 posts in this topic

#1 ·  Posted (edited)

K if you havent played the basic game is space to target space to attack or you can use skill which I have done. Kills 7 monsters then sits, I tried pixel for the healthbar which is green but I failed this time. Id like to use the sit as well as pixel for emergency potions.

Have any ideas to improve my code for NOSTALE

4 is loot

5 is rest

q is skill

Edited 7.30 pm cst add some of Xenos suggestions. I've never messed with gui yet but is there a way to incorperate just a dialog with the kills count "should work" and how long its been running.

HotKeySet("{PAUSE}","Escape")

Dim $GetHealth, $Color, $kills
$GameWinTitle = "Nostale"

WinActivate($GameWinTitle, "")
WinWaitActive($GameWinTitle, "", 5)

$Color = 0x00AA00; Health Color
$kills = 0

While 1
   $SearchResult = PixelSearch(313, 130, 313, 131, $Color, 20)
   If @error Then
         MouseClick("Left" , 815, 163, 1 , 0); Added to return to coords.
         Sleep(500)
         Send("{5}")
         Sleep("10000")
         Send("{5}")
   Else
         Send("{SPACE}")
         Sleep(200)
         Send("{q}")
         Sleep(5000)
         Send("{4}")
         $kills = $kills + 1
    EndIf
WEnd

Func Escape()
Exit 0
EndFunc
Edited by Seagul

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I searched for a screenshot online and created this function based on it which you can adapt. Basically it returns one when the health gets so low, but I have ABSOLUTELY no idea if it works since I don't have the game and have never played it.

Func LowLife ( )
    $Color = PixelSearch ( 90, 21, 91, 22, 5120573, 20 )
    If $Color Then Return 1
    If Not $Color Then Return 0
EndFuncoÝ÷ Ù¬ÊÚ.±è­(!µ·ºÚ"µÍÚ[HBYÝÓYH

H[ÙÐÞ
    ][ÝÑØ[YHÝ   ][ÝË  ][ÝÖ[ÝYHÈÝÉÌÌÎÉ][ÝÈ
BÛYBÑ[
Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

I did the search so that there could be some space for color change. Like I said I have never played the game and am unsure of everything. Tell me if it works.


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

I searched for a screenshot online and created this function based on it which you can adapt. Basically it returns one when the health gets so low, but I have ABSOLUTELY no idea if it works since I don't have the game and have never played it.

Func LowLife ( )
    $Color = PixelSearch ( 90, 21, 91, 22, 5120573, 20 )
    If $Color Then Return 1
    If Not $Color Then Return 0
EndFuncoÝ÷ Ù¬ÊÚ.±è­(!µ·ºÚ"µÍÚ[HBYÝÓYH

H[ÙÐÞ
    ][ÝÑØ[YHÝ   ][ÝË  ][ÝÖ[ÝYHÈÝÉÌÌÎÉ][ÝÈ
BÛYBÑ[

Also... there's needs to be parenthesis around the number for sleep, I think V2 had no parenthisis didn't it?

So instead of Sleep 1 (1 - 10 is the same anyway here (at least in my test))... it would be Sleep(10)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

It has been a while for you hasn't it :P... LowLife will alway return 1 whether it's found or not that way... also there's no need for If Not $Color Then Return 0 because if it were the color it would have already returned 1... just a heads up.

Maybe something like:

Func LowLife()
    PixelSearch(90, 21, 91, 22, 5120573, 20)
    If Not @error Then Return 1
    Return SetError(1, 0, 0)
EndFunc

Also... there's needs to be parenthesis around the number for sleep, I think V2 had no parenthisis didn't it?

So instead of Sleep 1 (1 - 10 is the same anyway here (at least in my test))... it would be Sleep(10)

it has been awhile.... the reason I left these forums was because I started using linux exclusively but recently I have started using windows again. the 'Sleep 1' thing is a REALLY old habbit I got using V2.

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The REST button (5) is repeating it .I had tried it in the game.

It repeats it (5) TWICE but sometimes only ONCE.

I think theres somthign wrong somwhere.

Can anyone fix it?

--------------------------------------------------------------

for the first loop it only types ;

1. "5" for once

2.then sleep for 15000

3.then type "5" again

4.sleeps again

2nd loops onward,this might happen;

1. "5" for twice (which can also be represented by "55")

2.then sleep for 15000

Edited by dlshoong

Share this post


Link to post
Share on other sites

I think this is the last one I created its lil dif from topic, I get confuse cus when I change each version I had number to end or something wierd lol.

HotKeySet("{PAUSE}","Escape")
$GameWinTitle = "Nostale"

WinActivate($GameWinTitle, "")
WinWaitActive($GameWinTitle, "", 5)

While 1
        $x = 0
        Send("{ESC}"); Gets rid of Basic Dialogs
    Do
        Send("{SPACE}")
        Sleep(200)
        Send("{q}")
        Sleep(5000)
        Send("{4}")
        $x = $x+ 1
    Until $x = 7
       ;MouseClick("Left" , 842, 199, 1 , 0); Return Near Middle Map
        MouseClick("Left" , 795, 213, 1 , 0); Left Middle
        Sleep(500)
        Send("{5}")
        Sleep("10000")
        Send("{5}")
WEnd

Func Escape()
Exit 0
EndFunc

Share this post


Link to post
Share on other sites

Func GetOwnHealth()
    $y = 130 - 72 + $Pos[1]
    $intX = 217 - 109 + $Pos[0]
    $endX = 354 - 109 + $Pos[0]
    For $x = $intX to $endX
        If PixelGetColor($x,$y) == 1447446 Then
            ExitLoop
        EndIf
    Next
    Return Int(($x-$intX)/($endX-$intX)*100)
EndFunc

Func GetTargetHealth()
    $y = 173 - 72 + $Pos[1]
    $intX = 481 - 109 + $Pos[0]
    $endX = 590 - 109 + $Pos[0]
    For $x = $intX to $endX
        If PixelGetColor($x,$y) == 5395026 Then
            ExitLoop
        EndIf
    Next
    If $x == $endX+1 Then
        If Not (PixelGetColor($x-1,$y) == 447521) Then
            Return -1
        EndIf
    EndIf
    Return Int(($x-$intX)/($endX-$intX)*100)
EndFunc

My bot pwns yours, and I'm not releasing. :lmao:

Share this post


Link to post
Share on other sites

Doubt it, I could train some high level peas on you then tele to miniland in friendlist and your pwned bot would die.

Share this post


Link to post
Share on other sites

Func GetOwnHealth()
    $y = 130 - 72 + $Pos[1]
    $intX = 217 - 109 + $Pos[0]
    $endX = 354 - 109 + $Pos[0]
    For $x = $intX to $endX
        If PixelGetColor($x,$y) == 1447446 Then
            ExitLoop
        EndIf
    Next
    Return Int(($x-$intX)/($endX-$intX)*100)
EndFunc

Func GetTargetHealth()
    $y = 173 - 72 + $Pos[1]
    $intX = 481 - 109 + $Pos[0]
    $endX = 590 - 109 + $Pos[0]
    For $x = $intX to $endX
        If PixelGetColor($x,$y) == 5395026 Then
            ExitLoop
        EndIf
    Next
    If $x == $endX+1 Then
        If Not (PixelGetColor($x-1,$y) == 447521) Then
            Return -1
        EndIf
    EndIf
    Return Int(($x-$intX)/($endX-$intX)*100)
EndFunc

My bot pwns yours, and I'm not releasing. :whistle:

Thanks you Manadar for this code made it all much easier.

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

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