Trainstation bot

05/17/2013 06:32 christiaantje#1
UPDATE 28/8/2015
Me and Tenebrae are now working together on the pixel federation trainstation bot.
We created a website for our brand new trainstation bot.
Go check it out on:
[Only registered and activated users can see links. Click Here To Register...]

Happy botting!

OLD POST:
################################################## ########
I created a bot for the facebook game Trainstation. U might want to adjust it to personalize it for ur own needs/setup. But it is a good start for botting on any facebook game, that requires the same actions over and over again. Or/And color depending clicks/keyinputs.

Version update: 1.4

Feel free to use it :):):):) I wrote the script in ACTool so u will need to download ACTool from [Only registered and activated users can see links. Click Here To Register...]

I got alot of questions about the script and people tell me it doesnt work. If u want help to set up the trainstation bot, just pm me or connect to my teamspeak flum.aionallstars.com:11807

Code:
(*
Trainstation bot by flum

Have problems or questions feel free to contact me on teamspeak 3 Address:   flum.aionallstars.com:11807

-Functions
Send your trains out every 10 minutes + goes to docking to click on the trains.
Delete flags for you. Keeps track and logs the amount of trains it dispatches.
Keeps tracks of errors, able to reconnect if ur internet connection restarts.
Makes screenshots of ur materials + exp bar.


-Requirements
Screen resolution 1366 768
Chrome or Firefox.
The 1 click passenger and cargo upgrade for ur station.
Basic knowledge about AC tool scripting
 
-Run notes
Start the script first, then within 5 sec open trainstation fullscreen.

-Config notes
If u set constants delflag 0 to anything else it will start to delete the amount of flags from the giftbox.
Change internation 0 if u dont want to send int trains.

0.2 send trains every 10 min
0.3 minor bug fixes
0.4 added del flag function
0.5 changed flag function for easy use
0.6 send int function added
0.7 click dockin station implemented
0.8 color check implemented for better check
0.9 changed mouse cord. for int trains
1.0 code clean up
1.1 error logger
1.2 train send tracker
1.3 screenshot material/exp
1.4 reconnecter


*)
constants
  send = 10
  bar = 1
  delflag = 0 
  train = 0
  run = 0
  dock = 0
  date = 0
  time = 0
  reason = 0
  trigger = 0
  main = 1
end


constructs
  File1=File
  File2=File
  File3=File
end

call setup 
call main

procedure main //Clicks on all the trains on the main screen
  call flag
  while $main = 1
    compute trigger = $trigger + 1 //set trigger timer
    compute run = $run + 1
    MousePos 1251, 650
    call cc
    MousePos 1250, 639
    call cc
    MousePos 1250, 630
    call cc
    MousePos 1250, 619
    call cc
    MousePos 1250, 605
    call cc
    MousePos 1251, 592
    call cc
    MousePos 1251, 592
    call cc
    call errorlog
    call dock
    if $time > 3600000 //every hour make a screenshot of your materials and exp bar
      call screenexp
      call screenmaterial
      call log
      SetConst time = 0
      SetConst train = 0
      SetConst dock = 0
    end
  end
end

procedure flag //If deflag set, delete $deflag number
  if $delflag > 0
    set main = 0
    MousePos 71, 717
    call click
    MousePos 807, 238
    call click
    loop $delflag
      MousePos 387, 420
      call click
      MousePos 734, 492
      call click
    end
  else
  end
end

procedure dock //If dock is avaiable go there and click on the trains
  LoadRGB 212, 69
  if {RGBGreen} > 129
    compute dock = $dock + 1
    MousePos 212, 69
    call click
    delay 2 sec
    compute time = $time + 2000
    MousePos 1252, 667
    call click
    MousePos 1250, 656
    call click
    MousePos 1250, 646
    call click
    MousePos 1249, 636
    call click
    MousePos 1249, 625
    call click
    MousePos 1249, 616
    call click
    MousePos 1250, 609
    call click
    MousePos 30, 715
    call click
    delay 2 sec
    compute time = $time + 2000
  else
    //Timestamp DOK load screen not found Red {RGBRed} Blue {RGBblue} Green {RGBGreen}
  end
end

procedure getcolor //checks if the train clicked from main is a "dispatchable train" if yes dispatch it 
  delay 1 sec
  compute time = $time + 1000
  LoadRGB 339, 143
  if {RGBGreen} = 247
    compute train = $train + 1
    CASE $send
    when 6
      MousePos 547, 421
    when 10
      MousePos 758, 419
      if $trigger > 2
        FormatDateTime date = {now}, m/d/yy h-n //If train is dispatched bot it still active
        FileOpen File3, C:\train\a_active.txt
        FileAppend File3
        FileWrite File3, A
        FileClose File3
        setconst trigger = 0
      end
    else
    end
    call click
  else
  end
end

procedure screenmaterial //Makes a screenshot of your material
  FormatDateTime date = {now}, m.d.yy h.n
  MousePos 1319, 70
  call click
  SaveScreen C:\train\screens\material\$date .bmp
  MousePos 590, 641
  call click
end

procedure screenexp //Makes a screenshot of your exp bar
  FormatDateTime date = {now}, m.d.yy h.n
  MousePos 774, 76
  delay 500
  compute time = $time + 500
  SaveScreen C:\train\screens\exp\$date .bmp
  delay 500
  compute time = $time + 500
end


procedure errorlog //Checks if there is any errors going on + handling them.
  LoadRGB 634, 350
  FormatDateTime date = {now}, m/d/yy h:n
  case {RGBGreen}
  when 173
    setconst reason = normal
  when 160
    setconst reason = normal
  when 28
    setconst reason = normal
  when 254
    setconst reason = disconnect
  when 236
    setconst reason = lvlup
  when 8
    setconst reason = achievment
  else
    setconst reason = undefined
  end
  if $reason = normal
  else
    FileOpen File2, C:\train\a_errorlog.txt //Logs any error
    FileAppend File2
    FileWrite File2, $date $reason Red {RGBRed} Blue {RGBblue} Green {RGBGreen}
    FileClose File2
  end
  if $reason = achievment
    MousePos 568, 582
    call click
  end
  if $reason = disconnect
    call reconnect
  end
  if $reason = lvlup
    MousePos 568, 639
    call click
  end
end

procedure reconnect //Reconnects  
  keys {esc}
  delay 2 sec
  compute time = $time + 2000
  if $bar = 1
    MousePos 537, 621
    call click
  else
    MousePos 551, 663
    call click
  end
  delay 10 sec
  compute time = $time + 10000
  call setup
  delay 5 sec
  compute time = $time + 5000
end

procedure setup //Sets trainstation full screen
  if $bar = 1
    MousePos 1079, 331
    call click
  else
    MousePos 1081, 373
    call click
  end
  MousePos 780, 363
  call click
  MousePos 244, 717
  call click
  MousePos 541, 398
  call click
  delay 2 sec
  compute time = $time + 2000
  MousePos 31, 735
  call click
  delay 2 sec
  compute time = $time + 2000
end


procedure log //Keeps track on every train u dispatch, + amount of times it went to docks
  FormatDateTime date = {now}, m/d/yy h:n
  FileOpen File1, C:\train\a_trainlog.txt
  FileAppend File1
  FileWrite File1, $date - train: $train - dock: $dock - run: $run
  FileClose File1
end

procedure cc
  call click
  call getcolor
end

procedure click
  leftclick
  delay 500
  compute time = $time + 500
end
If u dont get my trainstation bot working. Or u have questions, tips suggestions. Feel free to PM me your skype and i would be glad to help u out. Happy botting!

################################################## ########
05/17/2013 11:52 ĆΔŘŦỮЖØ#2
How to use?
05/18/2013 00:42 christiaantje#3
I wrote it in AC Tool download AC-Tool and copy and paste the script in and follow the instructions.
06/18/2013 04:44 boelxz#4
what editing I need for 1024 x 768 screen resolution?
07/04/2013 00:56 apflesk#5
I would really appreciate some help to make this for 1920*1080. is there anyone that can help me with this? :)
08/07/2013 16:16 Jebin#6
how to use this
09/23/2013 19:37 dyrstad#7
can someone please help me to set it up with 1024 x 768 screen resolution?

It use all my gems now :-/
09/23/2013 22:33 Awesome Trainers Maker :D#8
To the creator, I'd recommend checking if AC Tool can get monitor size.
And based that set the mouse position.
or just call the functions that handles the click of each and each item inside game (using Assembly).
10/09/2013 00:44 moonfairy05#9
I wish I was able to use it but it is soooo complicated!
10/20/2013 04:21 BeaverHunter#10
I am curious if there is a downloadable tool you are using to get mouse coordinates while trainstation is in full screen mode ...or a hot key style program that gives mousecords while in another non modal window....what tool you use to deermine mouse calls????

otherwise i have to write a java program that stamps the mouse cords on my hot key to add aditional functions to this script
10/26/2013 19:58 quad474#11
I have checked this and it doesnt work. I believe it is a trick. Otherwise please tell how to use this actool program with this bot.
11/29/2013 17:12 Krzysiek5657#12
simpler (because just only sending trains for 6 min)
resolutnion: 1024x768
Quote:
constants
main = 1
end

delay 5 sec
call main
procedure main
while $main = 1
MousePos 670, 659
call click
call click
MousePos 343, 406
call click
MousePos 670, 646
call click
call click
MousePos 343, 406
call click
MousePos 670, 622
call click
call click
MousePos 343, 406
call click
MousePos 670, 570
call click
call click
MousePos 343, 406
call click
delay 30 sec
end
end

procedure click
leftclick
delay 500
end
12/12/2013 17:53 christiaantje#13
Hi Krzysiek5657,

ur script looks pritty nice. But my script is still alot better, since it has functions to send international trains. Also it checks if the train send window is open. + it picks up if there are any trains waiting in the docks. ;)
But ya, u can use my script as a start and work with it to make ur own custumized one. AC tool is a great program. If anyone needs help or has questions about making bots in Ac tool. feel free to PM me or visit me on teamspeak adress: flum.aionallstars.com:11807
12/12/2013 18:13 jarit#14
Add a backlink on the webside.
12/12/2013 20:58 abyss0709#15
can any 1 help me with a cityville bot


thanxxxx