Jump to content

Help with a project


Recommended Posts

Hello there,

I just started using the Autoit v3 a few days ago and got the idea to write my own script.

I understand a few of the functions, and I've been reading through help topics learning more as I go along...

The project that I'm looking at... Might not even be possible, I'm not sure. Any help on it would be splendid. Also. thanks in advance.

My goal: I would like to create a script for a full screen game that I play that will automate some tasks that are mind-numbing and very time consumming. Right now, it's a mining script basically... Something to tell my character to move left, drop a shovel, pick up the shovel, check and see if there is ore there, then drop a pick to mine the ore, and then continue to the next spot. Eventually, when it hits the end of a row, I would like it to attempt to recognize a certain area, (Maybe like... pixelchecksum or something to that effect) if it doesn't move, I'd like it to change direction and and continue. Once I am full of a certain type of Ore I would like it to go back to a bank and deposit the ore then loop through and continue again.

My problems: The game is comlete pixels, figuring out how to find the end of a row or to find out if an object is blocking the path... that is where I'm really having trouble.

My friends and I have been working on this bit of code, finding ways to improve it and make it run smoother, I'll include it as a starting point.

CODE
AutoItSetOption("SendKeyDelay", "10")

HotKeySet("{F1}", "Terminate")

HotKeySet("{HOME}", "mineup")

HotKeySet("{PGDN}", "mineright")

HotKeySet("{END}", "minedown")

HotKeySet("{DEL}", "mineleft")

HotKeySet("{INSERT}", "mine")

HotKeySet("{F2}", "depo")

HotKeySet("{F7}", "progcheck")

While 1

Sleep(100)

WEnd

Func Terminate()

Exit 0

EndFunc

Func mineup()

Send("{UP}{UP}", 0)

Sleep(30)

Send("{D}{a}{<}", 0)

EndFunc

Func mineright()

Send("{RIGHT}{RIGHT}", 0)

Sleep(30)

Send("{D}{a}{<}", 0)

EndFunc

Func minedown()

Send("{DOWN}{DOWN}", 0)

Sleep(30)

Send("{D}{a}{<}", 0)

EndFunc

Func mineleft()

Send("{LEFT}{LEFT}", 0)

Sleep(30)

Send("{D}{a}{<}", 0)

EndFunc

Func mine()

Send("{ENTER}{D}{b}{<}{D}{a}{<}", 0)

EndFunc

Func depo()

Send("{'}I will deposit all Ore [poor]{Enter}", 0)

Sleep(1000)

Send("{'}I will deposit all Ore [med]{Enter}", 0)

Sleep(1000)

Send("{'}I will deposit all Ore [high]{Enter}", 0)

Sleep(1000)

Send("{'}I will deposit all Ore [very high]{Enter}", 0)

EndFunc

Func progcheck()

Send("{'}How many Ore [poor] have I deposited?{Enter}", 0)

Sleep(1000)

Send("{'}How many Ore [med] have I deposited?{Enter}", 0)

Sleep(1000)

Send("{'}How many Ore [high] have I deposited?{Enter}", 0)

Sleep(1000)

Send("{'}How many Ore [very high] have I deposited?{Enter}", 0)

EndFunc

It's alot, I know, but it sounds like a fun task that I want to work on... Something to learn more about scripts and maybe improve my skills. Any help would be nice, although, I'm not asking for someone to write a script... As that kinda defeats the purpose of my learning. But arrows in the right direction, or maybe someone who can work with me through email and we can discuss it as I go along. Again, I thank you!

Cal

Link to comment
Share on other sites

You need to read up on the Send() Function a little bit more.

Send("{A}") will not work you only need {} for special keys

Send("a") is probably what you want to use some things are picky about whether or not its a capital

Send("a") lowercase

Send("A") uppercase

and you don't need to write, Send("a", 0) because 0 is default all you need is Send("a")

and the 0 after exit is not necessary neither of the 0 you used are wrong they wont effect your script in any negative way but they are not needed.

Link to comment
Share on other sites

You need to read up on the Send() Function a little bit more.

Send("{A}") will not work you only need {} for special keys

Send("a") is probably what you want to use some things are picky about whether or not its a capital

Send("a") lowercase

Send("A") uppercase

and you don't need to write, Send("a", 0) because 0 is default all you need is Send("a")

and the 0 after exit is not necessary neither of the 0 you used are wrong they wont effect your script in any negative way but they are not needed.

The code that I currently have works fine... It does exactly what I want it to. I just want to basically make a same code, along the same lines, but instead of the hotkey inputs, have it be automated... Thank you though for the tips on Send(), I'll be sure to read a little more.

Oh, and yes, I did want a capitol A, objects are listed as a-z, A-Z giving the option of 52 instead of 26. Thanks though!

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...