How to know which engines are used

Tips and Tricks on Events, Economy, etc.
User avatar
brunom
Dispatcher
Posts: 343
Joined: Sat Mar 20, 2010 7:37 pm
Location: Lisbon, Portugal

How to know which engines are used Unread post

Hi folks,

hi expert designers, common people and visionairies..

I've got this tricky issue I can't get my imagination to solve: I would love to have an event to trigger only if a player is not using electric engines and resorting to diesel instead.. Event editor (1.05) doesn't allow to check on locomotives count. Hence, I thought of checking for electric track.. but to my surprise, it isn't working... here's the event in question:
electric.jpg
It triggers no matter what sort of tracks I have laid! Am I being completely dumb and missing the obvious? Please help - there's a scenario almost ready waiting for me to solve this enigma...

B
User avatar
Blackhawk
CEO
Posts: 1112
Joined: Thu May 21, 2009 2:34 pm

Re: How to know which engines are used Unread post

I just tried the same thing you did under a TM install and it worked fine for me. However,when I tried under Rt3 1.05 it didn't seem to register company electric track, territory electric, or company-territory electric, it only recognized total electric track. **!!!**
User avatar
brunom
Dispatcher
Posts: 343
Joined: Sat Mar 20, 2010 7:37 pm
Location: Lisbon, Portugal

Re: How to know which engines are used Unread post

Hmm.. that will be enough I think, if... I just need to add an event making electric locos unavailable for AI companies (and possibly a cheaper price on diesel to compensate).

Thanks for the tip blackhawk. I'll let you know, in this thread, how/if it worked out.

B
User avatar
Sugus
Engineer
Posts: 569
Joined: Wed Feb 04, 2009 1:33 pm
Location: Rorschacherberg, Switzerland

Re: How to know which engines are used Unread post

Try to add an additional condition "to be checked against companies ..."
There's no business like RT business ...
User avatar
Blackhawk
CEO
Posts: 1112
Joined: Thu May 21, 2009 2:34 pm

Re: How to know which engines are used Unread post

Sugus wrote:Try to add an additional condition "to be checked against companies ..."
I tried adding "force test against companies" and that didn't seem to make a difference. I think I also tried "companyid = " Neither seemed to make a difference.
User avatar
Wolverine@MSU
CEO
Posts: 1166
Joined: Fri Nov 10, 2006 2:14 pm
Location: East Lansing, MI

Re: How to know which engines are used Unread post

I just tried a similar thing in 1.06 and it worked fine. Had it display a dialog when #Comp elec track=0 and it stopped displaying as soon as I laid electric track.
User avatar
brunom
Dispatcher
Posts: 343
Joined: Sat Mar 20, 2010 7:37 pm
Location: Lisbon, Portugal

Re: How to know which engines are used Unread post

Did a lot of testing on this just now...
basically I tried every combination of #company electric track, #territory electric track, force testing against companies, territories, players, etc. All I could think of...

RESULTS
# comp. electric track = 0
# terr. electric track = 0
IN EVERY CASE! (in 1.05, mind you..)

Total electric track counts perfectly, however.. so i just made it unthinkable for AI to build electric (it has no electric engines available).
It works as I want, but it ain't perfect and it sure isn't "clean"!.

And, of course, a player reading this will now know that I just test for " total electric track > 0 ", which means he can cheat that particular event pretty easily.. but, let's keep it quiet.
User avatar
nedfumpkin
CEO
Posts: 2163
Joined: Sat Feb 16, 2008 9:16 pm
Location: Hamilton - Canada

Re: How to know which engines are used Unread post

Did you try...?

test against all companies (you have it against on screen player)


force test against companies
company id=1 (but confirm the company number since if you delete the company and make a new one, it won't be #1)
#company electric track pieces=0
game year month=


Like everyone else, I can't see any reason why your original even shouldn't work, although I haven't tried it.
User avatar
brunom
Dispatcher
Posts: 343
Joined: Sat Mar 20, 2010 7:37 pm
Location: Lisbon, Portugal

Re: How to know which engines are used Unread post

I tried special events, writing up game messages.. just to figure it all out..

events like:
FORCE TEST AGAINST ALL COMPANIES
FORCE TEST AGAINST ALL TERRITORIES
displaying as game message:
"Counting electric track: [# Comp. elect. track], by [Company Name], in [Territory Name]"

And all sort of different triggers, testing against players, testing against specific company, etc...
I really played a bit with this, getting the counts displayed. Always = 0, apart from [Total elect. track]...
User avatar
nedfumpkin
CEO
Posts: 2163
Joined: Sat Feb 16, 2008 9:16 pm
Location: Hamilton - Canada

Re: How to know which engines are used Unread post

what about changing it to <1 just in case it is a negative number?
User avatar
Blackhawk
CEO
Posts: 1112
Joined: Thu May 21, 2009 2:34 pm

Re: How to know which engines are used Unread post

I didn't try the <1 but using the ledger to have the numbers display, the only one that worked in 1.05 was total electric track (even with force test companies, and company id). Was there something that got fixed in 1.06 that might have caused the company electric track condition to work now? I wonder if it works in earlier versions than 1.05.
User avatar
nedfumpkin
CEO
Posts: 2163
Joined: Sat Feb 16, 2008 9:16 pm
Location: Hamilton - Canada

Re: How to know which engines are used Unread post

I don't know...I'm baffled by this.
User avatar
Wolverine@MSU
CEO
Posts: 1166
Joined: Fri Nov 10, 2006 2:14 pm
Location: East Lansing, MI

Re: How to know which engines are used Unread post

Just tested it in 1.05 and it looks like you're right. It doesn't recognize company electric track or territory electric track. It does see total # electric track though, so if you prevent AIs from having electric trains, presumably they won't build electric track, and you can use "# of electric track pieces = 0" as the trigger.
User avatar
OilCan
Engineer
Posts: 832
Joined: Tue Jan 13, 2009 2:03 pm
Location: East Tennessee, USA

Re: How to know which engines are used Unread post

I ran across this little statement in the 1.06 Patch Readme:

"18. Fixes track counters for electric track pieces."

Apparently, one of the bugs of 1.05V is correct counting of electric track pieces. I guess that's why 1.06V recognizes the electric track and 1.05V does not in the test trials mentioned above.
User avatar
nedfumpkin
CEO
Posts: 2163
Joined: Sat Feb 16, 2008 9:16 pm
Location: Hamilton - Canada

Re: How to know which engines are used Unread post

Well now...see what happens when you read the documentation! I am no longer baffled by this. :)
User avatar
brunom
Dispatcher
Posts: 343
Joined: Sat Mar 20, 2010 7:37 pm
Location: Lisbon, Portugal

Re: How to know which engines are used Unread post

:-)
Good to know I wasn't wrong.. nice, for a newbie in this game.

Now, if you find in the 1.06 readme something along the lines of "Includes locos counters".. that would be super.

BM
User avatar
Wolverine@MSU
CEO
Posts: 1166
Joined: Fri Nov 10, 2006 2:14 pm
Location: East Lansing, MI

Re: How to know which engines are used Unread post

I wonder whether the "fix" for 1.05 is an easy one? Whoever developed 1.06 (sorry I forgot who): what part of the .exe code needs to be changed, and is it something anyone with a hex editor could do?
User avatar
nedfumpkin
CEO
Posts: 2163
Joined: Sat Feb 16, 2008 9:16 pm
Location: Hamilton - Canada

Re: How to know which engines are used Unread post

I suppose if someone wanted to do it they could. Here's the entry from the 1.06 source code.


The way it works is:

{ 0x26c3a is the location in the exe file, then 13 is the number of characters to be changed,

"\x8a\x83\x18\x02\x00\x00\x3c\x01\x75\x08\x01\xbe\x64" is what is there

"\x8d\xb6\x64\x76\x00\x00\xe8\xaf\x00\x00\x00\xeb\x48" is what should be. Note, the little Xs don't go in there.

So if anyone wants to go through the 1.05 exe and manually change the stuff below, it should fix it.


/* Fix Electric and Non-Electric track counters for all but game-wide. */
{ 0x26c3a, 13,
"\x8a\x83\x18\x02\x00\x00\x3c\x01\x75\x08\x01\xbe\x64",
"\x8d\xb6\x64\x76\x00\x00\xe8\xaf\x00\x00\x00\xeb\x48" },
{ 0x26ce6, 16,
"\x5d\x75\x08\x01\xbe\xc0\x1d\x00\x00\xeb\x13\x80\xf9\x02\x75\x08",
"\x5d\x8d\xb6\x5c\xa7\xff\xff\xe8\x02\x00\x00\x00\xeb\x59\x90\x8a" },
{ 0x26cf6, 16,
"\x01\xbe\xc8\x1d\x00\x00\xeb\x06\x01\xbe\xc4\x1d\x00\x00\x8b\x83",
"\x83\x18\x02\x00\x00\x3c\x01\x75\x04\x01\x3e\xeb\x10\x3c\x04\x75" },
{ 0x26d06, 16,
"\x26\x02\x00\x00\x83\xf8\x03\x75\x14\x8b\x86\xd0\x1d\x00\x00\x03",
"\x05\x01\x7e\x04\xeb\x07\x3c\x02\x75\x03\x01\x7e\x08\x80\x7b\x44" },
{ 0x26d16, 16,
"\xc7\x5f\x89\x86\xd0\x1d\x00\x00\x5e\x5b\xc2\x08\x00\x83\xf8\x01",
"\x00\x74\x03\x01\x7e\x0c\x8b\x83\x26\x02\x00\x00\x83\xf8\x03\x75" },
{ 0x26d26, 16,
"\x75\x14\x8b\x86\xd4\x1d\x00\x00\x03\xc7\x5f\x89\x86\xd4\x1d\x00",
"\x04\x01\x7e\x10\xc3\x83\xf8\x01\x75\x04\x01\x7e\x14\xc3\x8b\x03" },
{ 0x26d36, 13,
"\x00\x5e\x5b\xc2\x08\x00\x8b\x03\x8b\xcb\xff\x50\x14",
"\x8b\xcb\xff\x50\x14\x85\xc0\x74\x03\x01\x7e\x18\xc3" },
{ 0x8796d, 16,
"\x8b\xf1\x8b\x4c\x24\x0c\x8d\x44\x00\xff\x8b\xf8\x8a\x81\x18\x02",
"\x53\x8b\x5c\x24\x10\x8d\x7c\x00\xff\x8d\xb1\x51\x0d\x00\x00\xe8" },
{ 0x8797d, 12,
"\x00\x00\x3c\x01\x75\x08\x01\xbe\x51\x0d\x00\x00",
"\x73\xf3\xf9\xff\x5b\x5f\x5e\xc2\x08\x00\x90\x90" },
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: How to know which engines are used Unread post

Bumpity. So over here - Re: See India By Rail - BETA Version - RoR mentioned this post about the electric track counting bug.

I never play with electric myself, but I can see possible uses for this track counter when writing scenarios. I took a quick look in the RT3.exe and the relevant bytes are easy to find. Screenshot attached.
Electric_track_bug.png
So I can fix this easily enough. Is there any call for it? If it's likely to make a significant different to some people I don't mind doing it, but if nobody really cares I won't bother.
Post Reply