Sign in to follow this  
Followers 0
InunoTaishou

PixelGetColor in minimized window, or something similar

10 posts in this topic

Hello AutoIt forums, I've been trolling these forums the past couple of days looking at examples, learning and adapting them to a Shiny Charmander Hunter bot (Playing Pokemon FireRed on an Emulator and I wanted a shiny starter and Black Charizard = pure awesome +1 if you know what I'm saying!)

Now it's working fine if it's the active window, but I would <3 to be able to run this in the background so I can do something else while it hunts (in case it doesn't find it over night). This is really my first ever big program project (made small little other programs to find coords of mouse/hex color) and I got up to page one of the Do While in VB before I stopped.

A couple things I would like help with (Examples would be greatly greatly appreciated)

1. Being able to recognize the colors while minimized

2. If something fails restart the script? (Would <3 to know how to do this)

3. Instead of using coordinates of mouse from my resolution (1920x1280) I would love to know how to do coordinates of the windowing the script is running off of

4. I had to keep doing Send("{x DOWN}") and Send("{x UP}") because the Send("{x}") was going fast it wasn't register in the emulator window and giving a lot of fails if there is a way to extend the Sen("{x}") by default without having to DOWN and UP it would make the script look a whole lot cleaner.

Please keep in mind that I am very noob at coding but would like to learn more, anything else that you could think of that might be cool for something like this LMK (Don't just do it for me either please, give an example how to do it and explaining it works a lot better than just saying do this :), if that makes sense lol)

Global $UnPaused
HotKeySet("{Home}", "TogglePause")
HotKeySet("{End}", "Terminate")
AutoitSetOption("PixelCoordMode", 0)
AutoItSetOption("WinTitleMatchMode",2)
AutoItWinSetTitle("Shiny Hunter Bot")

While 1
Sleep(100)
ToolTip("Script is Paused",0,0)
WEnd

Func TogglePause()
$UnPaused = NOT $UnPaused
While $UnPaused
ToolTip("Start Menu",0,0)
$sloop = 0
$ploop = 0
Do
Sleep(250)
$start = PixelGetColor(650,230) ;Coordinates of the Press Start screen
Sleep(250)
If $start = 0x400000 Then
Sleep(750)
Send("{x DOWN}")
Sleep(50)
Send("{x UP}")
Sleep(500)
ToolTip("Profile",0,0)
Else
ToolTip("Start Color Failed",0,0)
ExitLoop
Sleep(1000)
EndIf
$sloop = $sloop + 1
Until $sloop = 1
Do
Sleep(500)
$profile = PixelGetColor(400,500) ;Coordinates of the Profile select screen
Sleep(100)
If $profile = 0x505890 Then
Sleep(750)
Send("{x DOWN}")
Sleep(50)
Send("{x UP}")
ToolTip("Hunting",0,0)
Sleep(500)
Else
ToolTip("Profile Color Failed",0,0)
Exitloop
Sleep(1000)
EndIf
$ploop = $ploop + 1
Until $ploop = 1
If $sloop+$ploop >= 2 Then
Sleep(500)
Send("{z}")
Sleep(1000)
Send("{x DOWN}") ;Select Pokemon
Sleep(50)
Send("{x UP}")
Sleep(850)
Send("{x DOWN}") ;Get past message
Sleep(50)
Send("{x UP}")
Sleep(750)
Send("{x DOWN}") ;Confirm
Sleep(50)
Send("{x UP}")
Sleep(750)
Send("{z DOWN}") ;Get past message
Sleep(50)
Send("{z UP}")
Sleep(1500)
Send("{z DOWN}") ;No
Sleep(50)
Send("{z UP}")
Sleep(1500)
Send("{z DOWN}") ;Gary's message
Sleep(50)
Send("{z UP}")
Sleep(1500)
Send("{s DOWN}") ;Open Menu
Sleep(100)
Send("{s UP}")
Sleep(500)
Send("{x DOWN}") ;Select "Pokemon"
Sleep(50)
Send("{x UP}")
Sleep(500)
Send("{x DOWN}") ;Select Charmander
Sleep(50)
Send("{x UP}")
Sleep(500)
Send("{x DOWN}") ;Summary
Sleep(50)
Send("{x UP}")
Sleep(500)
Else
$sloop = 0
$ploop = 0
EndIf
$shiny = PixelGetColor(200,240)
$female = PixelGetColor(330, 130)
If $shiny <> 0xD84848 Then ;Shiny Charmander
ToolTip("Shiny Charmander Found, checking sex",0,0)
If $female = 0xF8B870 Then ;Gender Color
ToolTip("Shiny Female Charmander Found!",0,0)
Sleep(2500)
Send("{z DOWN}")
Sleep(50)
Send("{z UP}")
Sleep(750)
Send("{z DOWN}")
Sleep(50)
Send("{z UP}")
Sleep(750)
Send("{z DOWN}")
Sleep(50)
Send("{z UP}")
Sleep(750)
Send("{DOWN DOWN}")
Sleep(50)
Send("{DOWN UP}")
Sleep(750)
Send("{DOWN DOWN}")
Sleep(50)
Send("{DOWN UP}")
Sleep(750)
Send("{DOWN DOWN}")
Sleep(50)
Send("{DOWN UP}")
Sleep(750)
Send("{x DOWN}") ;Selecting save
Sleep(75)
Send("{x UP}")
Sleep(750)
Send("{x DOWN}") ;Yes
Sleep(75)
Send("{x UP}")
Sleep(750)
Send("{x DOWN}") ;Yes
Sleep(75)
Send("{x UP}")
Sleep(5000) ;Saving
WinActivate("Notepad")
WinWaitActive("Notepad")
Send("Congrats Kyle you got yourself a shiny Female Charmander!")
Exit
Else
ToolTip("Male shiny Charmander, Skipping",0,0)
EndIf
ElseIf $shiny = 0xD84848 Then ;Not Shiny
ToolTip("Not a shiny Charmander :(",0,0)
Sleep(1000)
ToolTip("Restarting",0,0)
Send ("{a DOWN}")
Send ("{s DOWN}")
Send ("{x DOWN}")
Send ("{z DOWN}")
Sleep(50)
Send ("{a UP}" )
Send ("{s UP}")
Send ("{x UP}")
Send ("{z UP}")
Sleep(250)
$sleep = 0
$ploop = 0
Sleep(1000)
ToolTip("Skipping Intro",0,0)
Sleep(1000)
Send("{x DOWN}")
Sleep(100)
Send("{x UP}")
Sleep(2500)
EndIf
WEnd
EndFunc

Func Terminate()
Exit 0
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello AutoIt forums, I've been trolling these forums the past couple of days looking at examples, learning and adapting them to a Shiny Charmander Hunter bot (Playing Pokemon FireRed on an Emulator and I wanted a shiny starter and Black Charizard = pure awesome +1 if you know what I'm saying!)

Hi there, unfortunately it's against forum rules to help with game bots. Sorry!

Edited by MrMitchell

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Even on games that do not have a EULA and I've read dozens of posts on this very forum about bots for java games/flash games/d2game etc.

One thing I left out

5. Being able to recognize names with a mouseover (Like games) if that's possible that would be great to know how to do

Edited by InunoTaishou

Share this post


Link to post
Share on other sites

In before the lock


A true renaissance man

Share this post


Link to post
Share on other sites

Even on games that do not have a EULA

Yea

I've read dozens of posts on this very forum about bots for java games/flash games/d2game etc.

Those are all either old and/or locked.

Share this post


Link to post
Share on other sites

Yea

Those are all either old and/or locked.

So i'm trying to learn autoit by doing something I enjoy doing and autoit's basically going to say "Fuck you"?

Well good thing I have friends who can help me.

Share this post


Link to post
Share on other sites

InunoTaishou,

autoit's basically going to say "Fuck you"?

No, we are going to say in a very patient and calm voice, please read the Forum Rules - and especially the bit that says:

"Do not discuss any of the following:

Automating games or game servers. This rule is zero tolerance"

If you have problems with that, then let me remind you that this our forum and so we ask that you respect our rules while you are here. Please remember that you paid nothing for AutoIt nor to join this forum - so we owe you nothing in return. :)

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

So i'm trying to learn autoit by doing something I enjoy doing and autoit's basically going to say "Fuck you"?

Well good thing I have friends who can help me.

Just because you enjoy it doesn't make it okay, right or acceptable.

There are rules and they were put in place for very good reasons.

It's nothing personal. It's about the negative image the language gets for being previously used by people creating bots. The Devs are trying to shed that image.


A true renaissance man

Share this post


Link to post
Share on other sites

One of the other things to keep in mind is there are many folks who play games - multi player games who pay good money only to have the experience ruined by some bloke with a bot (for example in WOW) who kills them and steals their stuff when they start to play for the thief uses a bot and they didn't. For the guy who has the bot they usually think "whats the big deal?".

Most people don't use bots. They play the game as the designers intended it to be played.

Think about that when you are on the receiving end of a bot attack. It isn't fun, it isn't fair, and it isn't cool.

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

A second thing is we have lots of trouble from AV companies who label AutoIt as a game cheat tool. (It isn't. it is a language). By using AutoIt to make bots one only makes the problem worse for the folks who use AutoIt for commercial use. (Package building, application monitoring, application development just to name a few.)

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

Last thing - this is Jon's Forum. His rules. He allows us to be here but he runs the place. If he made a rule saying for example one is not allowed to talk about making packages for WinZip and you will be banned if you do, well then, that would be enforced and there is nothing you can do about it. Again -Jon's sandbox and he lets us play in it.

Share this post


Link to post
Share on other sites

InunoTaishou,

As you seem disinclined to respond despite being online there is little point in keeping this open. As you can see from those who responded we do take the rules seriously here, so please respect them in future. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0