Jump to content

Just Some Help For A Newb...


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

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

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

Link to comment
Share on other sites

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

;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
Link to comment
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?

Link to comment
Share on other sites

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.

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