Jump to content

Need Advice


Halldor
 Share

Recommended Posts

Alright i'm new to AutoIT, but so far i'm having a lot of fun with a project.

The goal with my script, is to have pixelgetcolor on a loop, looking for changes at 2 different cords, if the color matches, i want it to do X until the color changes then i want it to do Y.

I managed to do this fine with just IF/Else, i ran into problems when i added my second part of coding, that introduced the second pixelgetcolor loop,

Now i was not exactly sure how to use IF/Else for this, seeing as i have more then 2 statements, and IF/Else seems to my limited knowledge to allow for 2 (or 3 with if elseif, else)

Here is the majority of the code, the reason for all the sleep, is i have been looping both the If/Else statements in a While(9999999999) loop, and it seems to be really laggy, the sleep helped,

Any suggestions as to how to do this more effectively ?

ToolTip("info", 0, 0)
Sleep(250)

Sleep(3000)
ToolTip("")
Sleep(250)
$b = "121455"
$var = "16711680"
Sleep(250)
Sleep(250)
Local $px = PixelGetColor(473, 358)
Sleep(250)

If $px == $var Then
Sleep(250)
Sleep(250)
$x MouseClick("left")
Sleep(700)


Else
Sleep(250)
Send("{h down}")
Sleep(250)
Sleep("1000")
ToolTip("You have no valid target, You Inbred")
EndIf


Sleep(250)
$c = PixelGetColor(432, 22)
Sleep(250)

Sleep(250)
If $c == $b Then
Sleep(250)
Send("{h down}")
Sleep("1000")
Send("{h up}")

Else
Sleep(250)
ToolTip("a message")
Sleep(250)
ToolTip("")
EndIf
Edited by Halldor
Link to comment
Share on other sites

  • Developers

WinActivate("mygame")

Welcome.

Let me start with a question: have you read our Forum rules?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Welcome.

Let me start with a question: have you read our Forum rules?

Jos

I shamefully admit to not having read them, but not from a lack of trying. Can you point me in their general direction ?

And regarding the script, i would just like the best way to loop this all, and some general advice if there is a better way to write it, not asking anyone to write this for me, only looking for a "xxx might be a better way to accomplish this)

Edited by Halldor
Link to comment
Share on other sites

I'm not the boss, but you should leave the posts alone.

That way all the information is still here and everybody's part continues to make sense without edit.

Do whatever you want with your scripts, just don't discuss game automation here.

I think the idea is game automation discussion takes away from the utility of this forum.

Moderation becomes more necessarily and too many immature people start debating.

The rules are the rules, take your shoes off at the door.

Best of luck.

Edited by Xandy
Link to comment
Share on other sites

  • Developers

Found it, too bad you guys don't allow any scripting for games, even if the game allows it, should i delete the post ?

Agree and we tried it .... the remains can still be found in the archives ... :(

Just leave your posts.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...