Jump to content

Recommended Posts

Posted (edited)

I just spent 50 minutes replacing 700 trains. At around 500 I noticed that I could speed the process up by double-clicking on the new engine, a little quicker than moving down to the buy button.

Then I had a look at the engine list view where you can see 5 (I originally incorrectly said 6) trains on a screen. There is a nice little replace button on each one! So I replaced the last 50 in under 2 minutes. At that pace I could have replaced 700 in less than 15 minutes!

Maybe this is common practice for some of the experienced players here, but I am putting it out there for those who don't know. Hope this saves some time, so there's more time to have fun!

PS. I wanted to insert an image to demonstrate, but I have NoScript in Firefox and I think there is conflict with the Posting system on here.

Edited by MaglevForever
  • Like 1
Posted

The engine list can be expanded from 6 trains to ~15. Click the up-arrow at the list box's upper-left corner.

 

WARNING: Blindly replacing engines will create jammed trains (where engine, tender and/or cars display in an overlapped fashion as they roll along on the main map). When in this state, a train might not stop and trade at the stations on its route. Instead, it will race from station to station burning fuel etc and not earning money.

 

Cause: There's a bug in the game having to do with calculated car placement. Somebody forgot that trains can be folded wherever they reverse direction at a station or switch. Any time you replace the engine on a train waiting in or turning around at a station or reversing through a switch, the train will become buggered.

 

Fix: One can often fix such a train by deleting its entire schedule and consist except for one station. When it reaches that station with nowhere to go next, its cars will finally be removed so that the consist and schedule can be rebuilt. Although this will not always sort the tender jammed up with its steam locomotive, the train can usually function again after being given a route and consist. One must always watch to make sure. If stripping the engine naked fails, then one must replace the engine again, this time on open track without the train in a folded position.

 

After replacing 500 engines in a hurry, you could easily have 20+ jammed trains to detect and sort out. Good luck with that.

 

BTW, The computer companies are not immune (and with their other engine-replacement bug, they may be extra vulnerable... until another replacement sorts them out by pure accident). You'll sometimes see jammed trains running around on their track never slowing down as they bounce from station to station. This contributes to their demise.

Posted

Ok, I don't think you understood what I meant. I am still unsure how to load pictures so they can be shown here, another try. post-33658-0-99627400-1371691052_thumb.j

 

I know about the problems with jammed trains. I would rather deal with them later. I should catch most of them in 20 years before replacing again, and, in the worst case, 3-4% of trains running empty wont be enough to significantly affect profits.

 

Sorry if I wasn't clear with the description, maybe full-screen train list view would have helped. Realizing also that only 5 engines are visible, oops.

Posted

707 trains?!? How can you even have enough track to run that many?

 

Sorry 'bout my confusion; I should have recalled what report you meant, but I've been playing Zeus / Poseidon for the last several weeks.

Posted

I am about to buy many more. 1000 coming up. I currently have 160,000 miles of track. Am really taking this to the max.

 

I hope this helps someone who needs new trains but is daunted by the task of replacement. It basically makes a four step process, two step.

 

Of course, there are drawbacks, like you mentioned with the bug. Also, you don't get as much information to analyze by not having the routing map visible. But for large scenarios it is nice.

Posted

God bless your mouse Meglev. 

When I realized the engine replacement is a long tedious work, I made a robot to make my life easier. It can replace your 707 trains in 3 minutes.

If you are interested, I will upload it here.

Posted

This is the robot I made : RT2Robot_Trains.zip

 

 

WARNING: This is infected with Trojan horse SHeur4.ANVH

 

My computer is now infected (and I haven't even run the EXE). I am fighting a disinfection war. All users delete! (and need I say, take down the upload).

Posted

Sorry guys, but you can relax.

This framework is somehow too powerful, because it will take control of your mouse and keyboard, my own computer's anti-virus software will give me a warning when I use it. 

Since only I can trust my own program, it's a pity you may not be able to use mine. Deleting it should have no affect to your computer, you can relax, jeff.

Gobalopper, I have to rely on this framework because without it, the source code is meaningless.

Posted

Aha... Then the hard-to-delete "infected" file thrown into my Windoze temp folder might have been an artifact left behind after my anti-virus software interrupted the unzip. Even after I set its permissions to let me delete it, I was denied permission, which got me a little excited :(

 

Fascinating video. Did you need to insert small pauses in the script to give the GUI time to change frames? How did you terminate the loop so that you didn't wrap to train 1? I'd still enjoy reading the source code if it's at all English-readable. I think most of us could script an engine replacement app using something like Autohotkey or some other GUI tester for windows. In one of my jobs in the 90's, I did a number of GUI-automation scripts using GUI-test program called QA Partner. It was great fun. I couldn't afford pro software like QAP, but there are some open-source tools around.

 

What a GUI test engine does is generate Windoze "messages" as if the cursor were moving, the mouse clicking, and the keyboard stroking. These messages flow through Windoze just like the stimuli you would normally generate with your hands. Windoze passes the messages to apps in both raw and interpreted forms. The app you're testing (or in our case, automating) receives a steady fire-hose of messages (including tons of raw cursor-hover updates; and every mouse-click is broken down into a button-down and button-release before it is ever interpreted by the OS as a click or dbl-click). If you can rely on certain controls always being at certain coordinates, then mouse-click automation is as simple as scripting clicks and dbl-clicks having various fixed locations on the screen (or relative to a particular window, if you know its name in Windoze).

 

However, if the coordinates aren't so fixed, then you want a Windoze debugging tool that tells you what secondary messages are being generated in response to your raw input. For instance, a right-click at {211,333} could be translated by windows as a button activation, complete with the name of the button and the name of the app (and subwindow) within which the message is being sent. Armed with such codes, one can script button activations without moving the mouse (or even knowing where the buttons are). You could click on train #1 without knowing where it is on the map.

 

I'll take a look at GUI-test freeware for Windoze XP and see if I can find something not written in Chinese ;) Now we just need a way to solve the jammed-trains bug...

 

Update: AutoHotkey comes with a tool called WindowSpy that can log clicks according to coordinates and as control-activations. This is where I am going.

Posted

Jeff, sorry again for getting you nervous.

 

Thank you. The source code is attached to this post, the syntax is based on VB, quite readable in English. But it has its own file format, so I copy it into a .txt file. To answer your brief questions: Delay has to be added while needed. I didn't test if the train detail screen loop back to the first train. Because number of total trains needs to be input in the program control panel GUI. Looping back actually will save a step of dragging the train list box up to the top.

 

I wonder if you are talking about the yellow shadow around the cursor and the red dot while clicking. This feature is actually provided by my video recorder BB FlashBack. It's free and very powerful. 

 

Yes, coordinates is actually a big problem, a lot of script developers are struggling to deal with this problem. However, Railroad Tycoon II solve this problem naturally. Since RT2 only has 800*600 and 1024*768 two screen modes. If your screen is bigger, there will be some blank margin beside your full screen game, which can not be accessed by your cursor.  My coordinates are based on 1024*768, so it should work unless you use a 800*600 resolution screen.

 

I think there will be similar free open source framework, good luck!

Train robot source code.txt

Posted

Thanks for the source code, it's illuminating. I'm curious why any effort in bulk retiring. Is there any scenario in which you would retire all trains? Maybe if you like to wreck "enemy" companies...

 

Some interface thoughts:

 

For the script to achieve a known state from almost any state of the game, it might want to start with ESC, ESC. This should drop it into the main screen.

 

There are keystrokes that can replace some of the mouse clicks:

 

'2' will choose trains for listing

'L' brings up the detailed list screen

HOME chooses the top item (train) in a list.

DOWN will move down a train in the train list

RIGHT will move to the next train when in a train detail screen

DOWN will move down an engine in the purchase list

PAGE-DOWN will move down 7 engines (or to the last engine) in the purchase list

ENTER will purchase the currently highlighted engine in the purchase list

 

However, I can't find a hotkey for the replace button, so at least some clicks will probably need to stay in any script.

 

I like the color tests for error conditions (like "You can't afford that!"). I wonder if you can test for uniquely black pixels in the breakdown and robbery icons so can can even avoid clicking replacement on trains that can't be replaced. Maybe icon placement isn't reliable; do they stack if there's more than one?

 

Autohotkey's spy program isn't very good with RT2's full screen mode (though I may not yet know how to use it properly). Unfortunately, my machine has never been able to run RT2 in windowed mode (it complains about screen resolution even though I have plenty). Your coordinates for clicking will probably come in handy if/when I get down to writing a script.

Posted

Thank you, Jeff. These hot keys should be useful in the future robot projects. Especially the HOME and PAGE DOWN keys. These should save some time in finding a train.

I do start with pressing ESC 3 times in the beginning. This will return to main interface wherever you are. The deepest one I can find is the "not enough money" window when hiring a manager.

Although I won't change any in my current robot, debugging is painful. :blink:

 

Getting the pix color is one of the most important functions of this framework. If correctly programmed, it can read. They also sell some color similarity analysis APIs, they can surely solve the icon inconsistent color problem. Although I won't need this, I just press an extra ENTER after replacing. When a train can not be replaced, it simply moves on to next one. 

Posted

I do start with pressing ESC 3 times in the beginning. This will return to main interface wherever you are. The deepest one I can find is the "not enough money" window when hiring a manager.

 

Aha, that's what that was. I had read ESC 3 as two keystrokes: ESC followed by typing the number 3

 

I found another tool to supplement the win spy. "Pulover's Macro Creator v3.7.5". It's crude, but it records GUI events and coordinates that may be useful in AutoHotkey.

 

Update:

 

The Macro Creator is even more versatile than I'd thought. It can record, then edit, then run Windows GUI actions. For instance, after the steps taking the game to the detail screen for (the first) train, I put a loop around the actions that replace the engine and move to the next train.

 

My macro will now serve my purposes, but I am too lazy to (learn all of the features needed to) generalize it by prompting for user input and testing pixels for game conditions. Instead, any time I decide to use it, I'll have to tweak a few things (the number of trains, whether to start at the first train, and which engine to select).

 

This will let me, for instance, put the game on the train where I want the macro to start replacing, and then it will replace a batch of engines with an engine type selected for that batch. It's a compromise between total automation and some modicum of engine specialization (and, as I said, laziness in the face of a new tool.

 

One happy accident: By using keys like {PgDn}, {Down} and then {Enter} to buy my engines, the "Can't buy... broken down" message box is well handled. It ignores all of the movements and then clears away on the stroke of {Enter}.

 

I heartily recommend the tool or something like it. Just be careful to check the app's name for Trojan Horse news, then download from a reputable site and scan any EXE before running it.

Posted

I was away for a while. I see lots of action happening here for once.

 

outofmage, how many trains do you have in your scenario? I just went past 1,000. Most of mine are short distance freight to try to soak industry and get the cities to grow. I am very glad you posted the macro tool. Thanks again.

 

Jeffry, I have played on 5 years and had to fix 8-9 routes where the trains got corrupted when they were replaced. In the 1800s it is much simpler just to retire them and buy a new one.

But I missed one on a little wool siding out of Yuma. It was folded, but somehow got stretched along its route. I noticed that it blocked the route for my other trains, but thought that maybe it was an event that I hadn't seen, so I left it. Now 5+ years later I want to build some lines into New Mexico and I cannot level the mountain the way I want. I have deleted all trains and stations, but still have the the track it was routed on which I can't bulldoze. It gives the error of a train being too close, even though it is isolated track with no trains on it. Any ideas? I tried to go back and replay from where I replaced trains. It happened after I replaced the last few trains which don't even use this track. If I replay from the point I had replaced half the trains it works fine. (The trains involved were early ones.) Any ideas?

 

I have put so much time into it that I would hate to have to back-track. Let me know if you want to take a look. I am guessing that it is something else, an unexplainable game glitch, but a way to get rid of that track would be greatly appreciated.

Posted

Jeff, maybe we should start another thread talking about the robot. We must have more to share.

 

Maglev, in my North America 1870s, I had about 500 trains; in US Center 1940s I had about 200. I found these trains are enough to halt every cargo on the map. How many cargo do you halt a year? I managed to halt 700 in North America 1870s (started in 1830). You were playing US history I assume, I didn't try to halt every cargo on that map, I would like to see your game saving.

 

About that glitch, I think it is triggered by replacing track blocked train while about to depart the station. The cars pulled by this engine will be shown on screen one by one during departing, if it's been blocked by the previous departing train, the show-up will be paused, but the train replacement will force to reload all the cargo on the screen, that may lead to this glitch.  

I make this glitch happen less often by building more stations and separate tracks, which leads to less track block, although you've already done that. But still, how come you have so many cargoes for 1000 trains to halt?

Posted (edited)

I have not had a lot of experience with large scenarios. I am playing more for fun and learning as I go. I estimated with the number of trains I bought for a particular run. I tried to buy enough so they would haul everything in boom times. Maybe I have bought a few too many. When I get to 1920 I will rework my routes, and remove lots of these freight trains. I have worked out that with slow trans-continental routes taking 3 years or more, you can fill them in boom times and by the time they arrive it could be depression already, taking a lot out of your revenue. I have yet to make 100 million profit in one year.

 

My track is much, much more inefficient than yours. To get crossings over straight tracks I turn many corners. US History is hard to do diagonally in the early years.

 

Anyway any ideas on how I can fix that track near Yuma would be appreciated, thanks.

 

USH092 South Build.zip

 

 

P.S. I don't mind if you talk about the robot on this thread.

 

Edit: Replaced corrupted attachment.

Edited by MaglevForever
Posted
outofmage, how many trains do you have in your scenario? I just went past 1,000.

 

Yikes! 1000? You definitely need one of these automation tools. If you choose the macro creator, I'll send you a sample file I just ran (you could customize it for your number of trains and choice of new engine).

 

I missed one on a little wool siding out of Yuma. It was folded, but somehow got stretched along its route. I noticed that it blocked the route for my other trains, but thought that maybe it was an event that I hadn't seen, so I left it. Now 5+ years later I want to build some lines into New Mexico and I cannot level the mountain the way I want. I have deleted all trains and stations, but still have the the track it was routed on which I can't bulldoze. It gives the error of a train being too close, even though it is isolated track with no trains on it.

 

That's bizarre  :(

 

How much track is locked? Can you write it off and route around it?

 

I don't have any ideas yet, but I can look at it.

 

PS: This is the perfect thread for talking about "robots", since the automation is for replacing engines more quickly

Posted

I've looked at your saved game, wow!

 

I'm flummoxed. I've never encountered this glitch before, and I can't fix it. Short of hacking the saved game, I don't think you can ever delete the affected track. My advice is to use what you can and jump-cross others that shall never have traffic in the way. The grade may be imperfect (and slightly wrinkled), but more powerful engines are coming, and they'll get over it.

Posted

Meglev, I can't fix this glitch either. I tried to destroy it with destroy/flooding events, but it led to game crash. I do believe the game will crash too if you bankrupt your own company. Unfortunately, you might have to load the previous saving if you can't stand this piece of glitched track.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.