Sign in to follow this  
Followers 0
Destruktive

Making my bot work

15 posts in this topic

#1 ·  Posted (edited)

Hi guys am new and i decided to make my own both. I read the tutorials and everything i needed to go for but their is one problem that i will need help on...

i need to get the left mouse button stay as pushed down when i put the code and let go when i want to.

also when i get the mouse button stay down i need it to move about 1 inch up from the screen and stay like that....

i am confuse on doing this so...i already finish my script but i need help on this...

Here is my script incase some1 is generous on helping me.

HotKeySet( "{Home}", "StartMainScript")

HotKeySet( "{End}", "StopMainScript")

HotKeySet( "{ESC}", "Terminate"

While 1

Sleep( 10000 );Idle

WEnd

Run( "Dragracing.exe");Run "Drag Racing"

WinActive( "Drag Racing" );Wait for title: "DragRacing"

Func StartMainScript( "{Home}" )

While 1

MouseClick( "left" [, x, y [, 1 [, 10 ]]]);Wait until clicks on bottom gas pedal.

Sleep( 5000 )

Send( "up" );Staging car at the green area.

Sleep( 2000 )

Send( "down" );Stoping at green area.

MouseDown( "left" [, x, y [, 1 [, 10]]]);Keep left mouse holding, until end of race.

MouseClickDrag( "left", x1, y1, x2, y2 [, 10];After mouse is hold down; mouse should move 1 inch north of window.

Sleep( 9000 )

Send( "up" );Shifting to 1st gear.

Sleep( 5500 )

Send( "up" );Shifting to 2nd gear.

Sleep( 10000 )

;Need a code to release Mousedown left.

WEnd;At this point should stop and terminate.

EndFunc ;==>StartMainScript

Func StopMainScript( "{END}" )

While 1

Sleep( 10000 );Idle

WEnd

EndFunc ;==>StopMainScript

Func Terminate( "{ESC}" )

Exit

EndFunc ;==>Terminate

;Not sure if this will work lets hope so.

i havent tried it yet because i also need to get the mouse coordinates where i want it to click in the first place which i dont even know how to get, its really fustrating doing this but atleast am trying my best plus its my first time doing somethning like this never intended to make a program until now.

...can anybody help me on coordinates and well if i did something wrong correct me on my script?

when i run the script i get this error...

post-40738-1222550763_thumb.jpg

Edited by Destruktive

Share this post


Link to post
Share on other sites



Hi Destruktive,

1st Welcome to the AutoIt Forums! :idiot:

Some of the following tips may not apply to you, but it may make your life a bit easier here on the forum in the future.

CODE
  • Did you know that we have an awesome search feature?

    You can find many answers to your current questions, just by typing in the right search patterns.

  • A suggestion is to use the Advanced Search mode:

  • Type your specific search term in quotes.
  • Click the forum you want to search in (the one most likely to have your information would generally be the Example Script forum and or the General Help and Support Forum).
  • Click on "Search titles only" radio button.
  • Click perform search.
The above will help you narrow down your searches and prevent you from unneccesarily posting a new thread.

[*]Also, you should try to read the Sticky posts that are at the top of each of the AutoIt Forums you enter such as:

[*]Keep in mind, the help file will be your best friend, however you may find some of the tutorials written by some of our elite forum members helpful.

[*]Forum Etiquette:

  • Making a new thread:

    • Use the Search feature first to see if your question has already been answered.
    • Look in the help file as well before even thinking of posting (When what you want could be obtained by simply reading the help file, you don't generally get a good response from your AutoIt community).
    • Titles are very important here. 1 word titles or titles like "help me", "write something for me", "I'm a noob" etc... aren't tolerated.
    • Make sure you are posting in the correct forum:

      • General Help and Support:

        • This forum is for AutoIt related support questions only. If you have a question related to another language, or nothing at all to do with AutoIt then you need to post in the chat forum, or in that languages perspective forum.
      • Example Script:

        • This forum is for AutoIt scripts/executables only.
        • Source code is preferred but not necessary, you do have the right to just post the binary of your project if you wish.
        • Please don't post questions in this forum unless it's directly related to a thread already existing.
    • Use common sense when creating a new thread.

      Ask yourself if the title is descriptive enough to even interest someone (preferably those that know what they are talking about) to even look at your thread, let alone reply in it.

    • Think about how it would show in the search feature if someone were to look for something just like you are looking for (think of the keywords you used yourself and obviously didn't find anything (because we know you used the search feature :) ) and use those types of keywords in your title as well).
  • Thread content:

    • Be descriptive with your query. (Make sure we actually know what you want to do).
    • Show you've made an effort in coding what you want (provide the reproducer code (generally no more than 50 lines as people lose interest in debugging someones script for free)).
    • Don't talk in ebonics. A lot of the forum members are adults, and a lot of them know how to help you, but talk like a child, you'll be treated as such.
    • Don't ask for help making keyloggers, spam (even if it's to do as a prank), or anything that can be thought of as malicious. You'll more than likely have the thread locked by a moderator, and take a bashing from your fellow AutoIt community.
    • When posting code, use code boxes. This can be accomplished by using [code ]<content here>[/code ] (No spaces between the brackets []).

      Using code boxes will keep the indentation and make it easier to read for others to help you.

  • Bumping your threads:

    • Use common courtesy here.

      Keep in mind every time you bump your thread to the top of the forum, you knock the other threads down a notch.

      Everyone posting for help has just as much right for their threads to get read as you do.

      Because of that, do not bump your post more than once in a 24 hour period.

      A Bump is simply posting in your thread with nothing that pertains to your query with the sole purpose of moving it up.

      Deleting previous bumps, and posting new ones is not tolerated, and the moderators can find those deletions, so do yourself a favor and don't cross that line >_< .

  • Rude or obnoxious content:

    This falls pretty much under the common sense thing. If you use it (common sense) before posting, you won't have issues.

    • Don't use foul language, remember, a lot of the community is at work when they read these threads.
    • Don't provoke or instigate an argument with someone.
  • Double Posting:

    • It's understood that sometimes there's a lag in the system, and sometimes people don't see their post go up right aways so they post again.

      If this happens to you, simply notify a moderator with the report feature in the post, and politely ask them to delete it.

    • If you're just creating another topic because your original topic is not being answered the way you want or at all, this is not tolerated. You could lose your posting privileges all together over it.
  • Non-English languages

    • If English is not your primary language, please make an attempt to interpret (yourself or online) and post that interpretation.

      We have wonderful users from around the world, so after you've done your post in English, back it up with your question also in your native tongue (You may find your answer much quicker using both).

That's it for now, I hope you have a wonderful learning experience, and hope to see you contribute to the community as your knowledge grows.

Share this post


Link to post
Share on other sites

Correction i got my mouse coordinates this is the code with coordinates

MouseClick( "left", 664, 496 )

those are original coordinates that i needed but i need help with the rest of script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HotKeySet( "{Home}", "StartMainScript")
HotKeySet( "{End}", "StopMainScript")
HotKeySet( "{ESC}", "Terminate")

While 1
    Sleep( 10000 );Idle
WEnd

Run( "Dragracing.exe");Run "Drag Racing"

WinActive( "Drag Racing" );Wait for title: "DragRacing"

Func StartMainScript(  )
    While 1
        MouseClick( "left" , 664, 496 , 1, 10);Wait until clicks on bottom gas pedal.
        Sleep( 5000 )

        Send( "up" );Staging car at the green area.
        Sleep( 2000 )
        Send( "down" );Stoping at green area.
        MouseDown( "left" , 664, 496 , 1 , 10);Keep left mouse holding, until end of race.
        MouseClickDrag( "left", 664, 496, 664, 496-96 , 10);After mouse is hold down; mouse should move 1 inch north of window.
        Sleep( 9000 )

        Send( "up" );Shifting to 1st gear.
        Sleep( 5500 )
        Send( "up" );Shifting to 2nd gear.
        Sleep( 10000 )

        ;Need a code to release Mousedown left.

    WEnd;At this point should stop and terminate.
EndFunc ;==>StartMainScript

Func StopMainScript(  )
    While 1
        Sleep( 10000 );Idle
    WEnd
EndFunc ;==>StopMainScript

Func Terminate(  )
    Exit
EndFunc ;==>Terminate

;Not sure if this will work lets hope so.

I played a little bit "debugger" and added the coordinates...

If you are asking yourself where the 96 comes from... this is the 1 inch in pixels

I used this Convertor

Edited by bluelamp

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you ill will try this. if i have any other questions could i feel free to ask?

by the way are those correct terms ( "up" ) to use the up button on the keypad?

Edited by Destruktive

Share this post


Link to post
Share on other sites

Thank you ill will try this. if i have any other questions could i feel free to ask?

by the way are those correct terms ( "up" ) to use the up button on the keypad?

aahm... no ^^

You should use {UP} and {DOWN}

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

okay i did all the changes from the previous script and i added the the {} to the up and down's this is what my script looks like now i edited a few tweaks and took away somethings i didnt need...

HotKeySet( "{Home}", "StartMainScript")

HotKeySet( "{End}", "StopMainScript")

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

While 1

Sleep( 10000 );Idle

WEnd

Func StartMainScript( "{Home}" )

While 1

MouseClick( "{left}" , 669, 498 , 1, 10);Wait until clicks on bottom gas pedal.

Sleep( 5000 )

Send( "{up}" );Staging car at the green area.

Sleep( 2000 )

Send( "{down}" );Stoping at green area.

MouseDown( "left" , 669, 498 , 1 , 10);Keep left mouse holding, until end of race.

MouseClickDrag( "left", 669, 498, 669, 498-96 , 10);After mouse is hold down; mouse should move 1 inch north of window.

Sleep( 9000 )

Send( "{up}" );Shifting to 1st gear.

Sleep( 5500 )

Send( "{up}" );Shifting to 2nd gear.

Sleep( 10000 )

;Need a code to release Mousedown left.

WEnd;At this point should stop and terminate.

EndFunc ;==>StartMainScript

Func StopMainScript( "{END}" )

While 1

Sleep( 10000 );Idle

WEnd

EndFunc ;==>StopMainScript

Func Terminate( "{ESC}" )

Exit

EndFunc ;==>Terminate

;Not sure if this will work lets hope so.

now i get this error..this is a bit fustrating when I myself dont know much about it...

ok it works okay now but the thing is when it trys to hold down the mouse on the coordinates and not let go an error cmoes out

Edited by Destruktive

Share this post


Link to post
Share on other sites

ok guys thast my script but i would like to have a config. file just so i can change the time variebles/

Can anybody help me on what to do to convert the bot and have a config file for the times of my bot to be changeable.??

Share this post


Link to post
Share on other sites

Look at "IniRead" in the help....

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

ok this is what ive tried to do here is the script and the .ini file see if am atleast a little right...

but i cant get it to work i want to be able to change the values from the config.ini file and for the bot is able to read and change the value cant get it to workk,

SCRIPT

HotKeySet( "{Home}", "StartMainScript")

HotKeySet( "{End}", "StopMainScript")

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

While 1

Sleep( 10000 );Idle

WEnd

Run( "Nitto 1320 Legends.exe" )

WinActive( "C:\Program Files\Nitto 1320 Legends\NittoLegendsBeta.exe" );Wait for title: "Nitto 1320 Legends"

Func StartMainScript( )

While 1

MouseClick( "left" , 679, 500 , 1, 10 );Clicking on Nitto window.

Sleep( 100 );Moving car.

Send( "{up}" )

$var = IniRead( "C:\this is not the file i just took it off.........\DEMON\DemonBot.ini", "Section1", "Staging", "1785" )

Sleep( 1785 );Staging at green & Stoping at perfect.

MsgBox(4096, "Result", $var)

Send( "{down}" )

$var = IniWrite( "C:\blah blah................................................\DEMON\DemonBot.ini", "Section2", "R/T", "5668" )

Sleep( 5668 );Reaction time, shifting to 1st gear.

MsgBox(4096, "Result", $var)

Send( "{up}" )

MouseClick( "left" , 679, 445, 1, 10 )

MouseDown( "left" );Pressing gas pedal at full from mouseclick position.

$var = IniWrite( "C:\blah blah blah.....................................\DEMON\DemonBot.ini", "Section3", "Shift2", "9950" )

Sleep( 9950 );Shifting to 2nd gear.

MsgBox(4096, "Result", $var)

Send( "{up}" )

Sleep( 20000 );idle off ending bot.

;Need a code to release Mousedown left.

WEnd;At this point should stop and terminate.

EndFunc ;==>StartMainScript

Func StopMainScript( )

While 1

Sleep( 10000 );Idle

WEnd

EndFunc ;==>StopMainScript

Func Terminate( )

Exit

EndFunc ;==>Terminate

;Not sure if this will work lets hope so.

my config.ini file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Staging perfect to green area.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Staging=1785

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Reaction Time and Shifting to 1st Gear

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

R/T=5668

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Shifting to 2nd Gear

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Shift2=9950

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Edited by Destruktive

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

at a quick glance...

you have var$=iniread ....... 3 times ...you need 3 different vars

eg

$var1=IniRead( "C:\this is not the file i just took it off.........\DEMON\DemonBot.ini", "Section1", "Staging", "1785" )

$var2=IniWrite( "C:\blah blah................................................\DEMON\DemonBot.ini", "Section2", "R/T", "5668" )

$var3=IniWrite( "C:\blah blah blah.....................................\DEMON\DemonBot.ini", "Section3", "Shift2", "9950" )

then the config

[section1]

staging=1785

[section2]

R/T=5668

[section3]

Shift2=9950

hope it helps

Edited by bluerein

Share this post


Link to post
Share on other sites

ok let me try that..

Share this post


Link to post
Share on other sites

okay i tried it i compiled the script and still the config file wont react to the .exe script what should i do now???

what are the $var for any way??

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

i cant seem to get a working config.ini here is a part of the script...

this is what that specific part as is...

$var1=IniRead( \"C:\\Documents and Settings\\DemonBot.ini\", \"Section1\", \"Staging\", \"1785\" )      
        Sleep( 1783, [\"Section1\"] );Staging at green & Stoping at perfect.     

        Send( \"{down}\" )

$var2=IniRead( \"C:\\Documents and Settings\\DEMON\\DemonBot.ini\", \"Section2\", \"R/T\", \"5668\" )       
        Sleep( 6035, [\"Section2\"] );Reaction time, shifting to 1st gear.

        Send( \"{up}\" ) 
        MouseClick( \"left\" , 679, 445, 1, 10 )
        MouseDown( \"left\" );Pressing gas pedal at full from mouseclick position.

$var3=IniRead( \"C:\\Documents and Settings\\DEMON\\DemonBot.ini\", \"Section3\", \"Shift2\", \"9950\" )    
        Sleep( 10000, [\"Section3\"] );Shifting to 2nd gear.
Edited by Destruktive

Share this post


Link to post
Share on other sites

can anybody help me plz??? witht he previous topic i posted.???

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