Sign in to follow this  
Followers 0
Sveet

Just Some Help For A Newb...

19 posts in this topic

Hey, im kinda new to this kida stuff... i was just wondering if there was some nice tutorial for coding... was looking (hard to stay concentrated a 2:30 am) but i didnt seem to find one... at least a hint or a point in the right direction would b appreciated... one of the things i was looking for was making my script read from a config file of some sort... i was going to make a game plug-in/bot and i think that this is at least a place to start with game coding, seeing as it is pretty basic...

well, sry for the rant, plz help! if ya can post info about the config thingy, it would b very much appreciated... ty, and have a nice day/night

Share this post


Link to post
Share on other sites



When you downloaded the AutoIt v3 have a look at the AutoIt.chm file.

Under "Using AutoIt" you find "Running scripts" which give you the first couple of steps you can take...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

heh... the sad part is... i actually read that... lol... guess i was too tired to remember it...

edit: it read it... under stood it pretty much... but is there a place for tutorials other than that? ill read thru it later, but i g2g now... cya! ty for any help!

Edited by Sveet

Share this post


Link to post
Share on other sites

I'd say follow the basics of programming first.

  • Know what you want to do
  • Write it in pseudo code
  • Find the functions to do it and write it for real
If you get stuck, just shout, someone can point you in the right direction.

Share this post


Link to post
Share on other sites

pseudo code?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

sry for double post, but can u tell me how do u make the mouse move?

Edited by Sveet

Share this post


Link to post
Share on other sites

sry for double post, but can u tell me how do u make the mouse move?

Try the MouseMove function

GrahamS

Share this post


Link to post
Share on other sites

pseudo code?

Pseudo code is where you write out the script in a mixture of natural language and the programming language. It helps you work out the structure of the script without worrying too much about how you actually code it.

For instance consider this bot for a ficticious game

Run game
Loop forever
  if Target in sight then
    Fire Missile
  else if Target is on left hand side then
    turn left
  else if Target is on right hand side then
    turn right
  else
   ; no target so turn in arbitary direction
    turn random(left, right)
  endif
end forever loop

The next step would be to replace one of the natural language phrases with actual code or more pseudo code. For instance running the game is actually two parts, first launch the game and second wait until the game has loaded. For example if firing a missile in the game is done by pressing the ALT and F keys together then the next iteration might be

Lauch game
Wait until game is loaded
Loop forever
  if Target in sight then
   ; Fire Missile
    send("!F")
  else if Target is on left hand side then
    turn left
  else if Target is on right hand side then
    turn right
  else
   ; no target so turn in arbitary direction
    turn random(left, right)
  endif
end forever loop

You keep on going until all the natural language is replaced with real code. Often the natural language is kept as comments within the code (as in the Fire Missile example above.

The other thing to do is to start small and build up to your final script. For instance, the first thing is to to ensure that you can launch the game, so write and test that code. Next, you might try to see if the bot can fire the missile, whilst you fly the plane, etc. etc.


GrahamS

Share this post


Link to post
Share on other sites

thx man, i had already gotten that info by the time u posted (sry)...

i realized my idle (Rishodi) has his bot open source, so i saw it there...

Share this post


Link to post
Share on other sites

oops... i had seen it around, but how do u set the wait times between sends? i cant seem to find it again...

Share this post


Link to post
Share on other sites

("SendKeyDelay", 5)         ;5 milliseconds


GrahamS

Share this post


Link to post
Share on other sites

thx man u saved my life :D

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

my script:

;AutoSkill
;Made by Sveet
;Open source :)

$skill = myiniread("config.ini", "settings", "Skill")
$delay = myiniread("config.ini", "settings", "delay")
$window = myiniread(config.ini", "settings", "windowname")

("SendKeyDelay", $delay)
winactivate($window)
send($skill)
EXIT

now, im not sure exactly if this would work... and its not that well coded, seeing as it is my first script in any program language... i do no that i will need some error to popup if the window isnt there, and im not sure if the sendkeydelay works with the individual parts, sence they r in a function thingy (forgot name, talking about $skill).. feedback plz?

edit: forgot to add in the EXIT because im writing this up at school...

Edited by Sveet

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

;AutoSkill
;Made by Sveet
;Open source :)

$skill = myiniread("config.ini", "settings", "Skill")
$delay = myiniread("config.ini", "settings", "delay")
$window = myiniread(config.ini", "settings", "windowname")

if winexists($window)
("SendKeyDelay", $delay)
winactivate($window)
send($skill)

else
make a popup with an error ;<---- not sure

endif
exit

what i think i could do (pseudo code)...

Edited by Sveet

Share this post


Link to post
Share on other sites

is winactivate the right thing to use?

Share this post


Link to post
Share on other sites

("SendKeyDelay", 5)        ;5 milliseconds
umm... this didnt work...

Share this post


Link to post
Share on other sites

nvm, got that all fixed... now, is there a way i could make a mouse click after every send?

also, could i get something so i can use a hotkey to run my script (ei. ^S (ctrl+S)) but not quit the thing after?

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

You might like this code

;AutoSkill
;Made by Sveet
;Open source :)
hotkeyset("{pause}","pauseme"); Pause key will pause (in case you deside to continuously run it.
hotkeyset("^s","click"); hit Control+S to do your script

$skill = myiniread("config.ini", "settings", "Skill")
$delay = myiniread("config.ini", "settings", "delay")
$window = myiniread(config.ini", "settings", "windowname")

while 1
; click()
; remove the; from the line above to make this continuouly do your script
sleep(10); keeps script running and waiting for your pause.
wend


func click()
if winexists($window)
Opt ("SendKeyDelay", $delay)
winactivate($window)
send($skill)
mouseclick("left",1)
else
make a popup with an error;<---- not sure
endif
endfunc

Func Pauseme()
   $Paused = NOT $Paused
   While $Paused
       sleep(100)
       ToolTip($paused&'Script is "Paused"',0,0)
   WEnd
   ToolTip($paused)
EndFunc
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

that doesnt help me much because i need to do more than 1 skill at a time...

hmm... maybe ill check out Mr. Rishodi's code...

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