RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

HELLO EVERYONE!!

So I've started work on a sucessor/replacement for the "North American Track Set" aka "NA TRACK SET", for now of which I'll just be calling "North American Track Set (or NATS) 2"

AT the moment I'm struggling with just getting some basics down because even though I'm mostly reusing the code from NATS 1 which works just fine when unmodified (RAIL vehicles can be bought on all track types, El.Rail can only be bought on ELRL or DUAL types, and 3RD rail stuff can only be bought and run on 3RD/MTRO railtypes).

When trying to do my own thing despite reusing most of the code, nothing is listening and actually doing what I want.

RAIL : Allowing both RAIL and ELRL/Electric trains to be purchaed and run on the tracks.
ELRL : Same as RAIL
3RDR : Either nothing appears or only Metro/3RD stuff will appear and nothing else will run on it, not even RAIL
DUAL/3RDT : Same as 3RDR/MTRO, or just doesnt allow one to buy Electric/ELRL vehicles.

I'll provide some examples of code for each of the 4 rail types in hopes that maybe someone can help me figure out why NOTHING is listening to me and p***ing me right the fk off.
Last edited by NekoMaster on 26 Aug 2020 04:47, edited 3 times in total.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Railtype code not working, tracks not allowing "vehicles"

Post by NekoMaster »

Code: Select all


//	#####################################################################################################################

//	(CLASS 1) VERY LOW SPEED (RAIL)
//	=============================================================================

item(FEAT_RAILTYPES, 				rail, ID) {
	property {
	
	    label: 						"RAIL";
		
		introduction_date: 			PARAMETER_RAILTYPE_CLASS_1_INTRODUCTION_YEAR;
		
		name: 						string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		toolbar_caption:			string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		menu_text: 					string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		build_window_caption: 		string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		autoreplace_text: 			string(STRING_RAILTYPE_AUTOREPLACE__________CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		new_engine_text:			string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_RAIL);
		
		compatible_railtype_list: 	["RAIL"];

		powered_railtype_list: 		["RAIL"];

		alternative_railtype_list: 	["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];

		construction_cost:			CONST_COST;
		maintenance_cost:			MAINT_COST;
		
//		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);

		speed_limit:				PARAMETER_RAILTYPE_CLASS_1_MAX_SPEED km/h;

#ifdef INTROS
		introduces_railtype_list:	[INTROS];
#endif

#ifdef REQS
		requires_railtype_list:		[REQS];
#endif

		acceleration_model:			ACC_MODEL_RAIL;
		map_colour:					93;
		sort_order:					3;
	}
	
	graphics {
		track_overlay:   			ground_switch_overlay_CLASS_1_SAAN;
		underlay:        			ground_switch_underlay_CLASS_1_SAAN;
		tunnels:         			tunnel_track_CLASS_1_SAAN_switch;
		level_crossings: 			level_crossing_CLASS_1_SAAN_switch;
		bridge_surfaces: 			bridge_CLASS_1_SAAN_switch;
		
	//	depots:						SWITCH_01_DEPOTS_BRICK_RED_MODERN_GREY;	
		fences:          			SWITCH_02_FENCING_WOOD;
		signals:					SWITCH_04_SIGNALS_SEMAPHORE_SEARCHLIGHT;

		/* no default graphics anymore: no_fences; */
	}
}

Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Railtype code not working, tracks not allowing "vehicles"

Post by NekoMaster »

Code: Select all


//	#####################################################################################################################

//	(CLASS 1) VERY LOW SPEED (ELRL)
//	=============================================================================

item(FEAT_RAILTYPES, 				elrl, ID) {
	property {
	
	    label: 						"ELRL";
		
		introduction_date: 			PARAMETER_RAILTYPE_CLASS_1_INTRODUCTION_YEAR;
		
		name: 						string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		toolbar_caption:			string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		menu_text: 					string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		build_window_caption: 		string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		autoreplace_text: 			string(STRING_RAILTYPE_AUTOREPLACE__________CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		new_engine_text:			string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_ELRL);
		
		compatible_railtype_list: 	["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];

		powered_railtype_list: 		["RAIL", "ELRL"];

		alternative_railtype_list: 	["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];


		construction_cost:			CONST_COST;
		maintenance_cost:			MAINT_COST;
		
		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);

		speed_limit:				PARAMETER_RAILTYPE_CLASS_1_MAX_SPEED km/h;

#ifdef INTROS
		introduces_railtype_list:	[INTROS];
#endif

#ifdef REQS
		requires_railtype_list:		[REQS];
#endif

		acceleration_model:			ACC_MODEL_RAIL;
		map_colour:					93;
		sort_order:					3;
	}
	
	graphics {
		track_overlay:   			ground_switch_overlay_CLASS_1_SAAE;
		underlay:        			ground_switch_underlay_CLASS_1_SAAE;
		tunnels:         			tunnel_track_CLASS_1_SAAE_switch;
		level_crossings: 			level_crossing_CLASS_1_SAAE_switch;
		bridge_surfaces: 			bridge_CLASS_1_SAAE_switch;
		
	//	depots:						SWITCH_01_DEPOTS_BRICK_RED_MODERN_GREY;	
		fences:          			SWITCH_02_FENCING_WOOD;
		signals:					SWITCH_04_SIGNALS_SEMAPHORE_SEARCHLIGHT;

		/* no default graphics anymore: no_fences; */
	}
}

Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Railtype code not working, tracks not allowing "vehicles"

Post by NekoMaster »

Code: Select all


//	#####################################################################################################################

//	(CLASS 1) VERY LOW SPEED (3RD RAIL)
//	=============================================================================

item(FEAT_RAILTYPES, 				SAA3, ID) {
	property {
	
	    label: 						"SAA3";
		
		introduction_date: 			PARAMETER_RAILTYPE_CLASS_1_INTRODUCTION_YEAR;
		
		name: 						string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		toolbar_caption:			string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		menu_text: 					string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		build_window_caption: 		string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		autoreplace_text: 			string(STRING_RAILTYPE_AUTOREPLACE__________CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		new_engine_text:			string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_MTRO);
		
		compatible_railtype_list: 	["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];

		powered_railtype_list: 		["RAIL", "MTRO", "3RDR"];

//		alternative_railtype_list: 	[STANDARD_GAUGE_NOT_ELECTRIFIED];


		construction_cost:			CONST_COST;
		maintenance_cost:			MAINT_COST;
		
//		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);
		
		speed_limit:				PARAMETER_RAILTYPE_CLASS_1_MAX_SPEED km/h;

#ifdef INTROS
		introduces_railtype_list:	[INTROS];
#endif

#ifdef REQS
		requires_railtype_list:		[REQS];
#endif

		acceleration_model:			ACC_MODEL_RAIL;
		map_colour:					93;
		sort_order:					3;
	}
	
	graphics {
		track_overlay:   			ground_switch_overlay_CLASS_1_SAA3;
		underlay:        			ground_switch_underlay_CLASS_1_SAA3;
		tunnels:         			tunnel_track_CLASS_1_SAA3_switch;
		level_crossings: 			level_crossing_CLASS_1_SAA3_switch;
		bridge_surfaces: 			bridge_CLASS_1_SAA3_switch;
		
	//	depots:						SWITCH_01_DEPOTS_BRICK_RED_MODERN_GREY;	
		fences:          			SWITCH_02_FENCING_WOOD;
		signals:					SWITCH_04_SIGNALS_SEMAPHORE_SEARCHLIGHT;

		/* no default graphics anymore: no_fences; */
	}
}

Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Railtype code not working, tracks not allowing "vehicles"

Post by NekoMaster »

Code: Select all


//	#####################################################################################################################

//	(CLASS 1) VERY LOW SPEED (DUAL SYSTEM)
//	=============================================================================

item(FEAT_RAILTYPES, 				SAAZ, ID) {
	property {
	
	    label: 						"SAAZ";
		
		introduction_date: 			PARAMETER_RAILTYPE_CLASS_1_INTRODUCTION_YEAR;
		
		name: 						string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		toolbar_caption:			string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		menu_text: 					string(STRING_RAILTYPE_NAME_________________CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		build_window_caption: 		string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		autoreplace_text: 			string(STRING_RAILTYPE_AUTOREPLACE__________CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		new_engine_text:			string(STRING_RAILTYPE_VEHICLE_CONSTRUCTION_CLASS_1_VERY_LOW_SPEED_RAIL_DUAL);
		
		compatible_railtype_list: 	["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];

		powered_railtype_list: 		["RAIL", "ELRL", "MTRO", "3RDR", "DUAL", "3RDT"];

//		alternative_railtype_list: 	[STANDARD_GAUGE_NOT_ELECTRIFIED];

		construction_cost:			CONST_COST;
		maintenance_cost:			MAINT_COST;
		
		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);
		
		speed_limit:				PARAMETER_RAILTYPE_CLASS_1_MAX_SPEED km/h;

#ifdef INTROS
		introduces_railtype_list:	[INTROS];
#endif

#ifdef REQS
		requires_railtype_list:		[REQS];
#endif

		acceleration_model:			ACC_MODEL_RAIL;
		map_colour:					93;
		sort_order:					3;
	}
	
	graphics {
		track_overlay:   			ground_switch_overlay_CLASS_1_SAAZ;
		underlay:        			ground_switch_underlay_CLASS_1_SAAZ;
		tunnels:         			tunnel_track_CLASS_1_SAAZ_switch;
		level_crossings: 			level_crossing_CLASS_1_SAAZ_switch;
		bridge_surfaces: 			bridge_CLASS_1_SAAZ_switch;
		
	//	depots:						SWITCH_01_DEPOTS_BRICK_RED_MODERN_GREY;	
		fences:          			SWITCH_02_FENCING_WOOD;
		signals:					SWITCH_04_SIGNALS_SEMAPHORE_SEARCHLIGHT;

		/* no default graphics anymore: no_fences; */
	}
}

Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Railtype code not working, tracks not allowing purchase/running of "vehicles"

Post by Transportman »

I think you don't understand how the various *_railtype_list attributes work, as with the current code you would get some funny results with RAIL and ELRL.
RAIL can only run on RAIL, but as it has MTRO and 3RDR in it's alternative_railtype_list, vehicles with that label might end up having RAIL as their main label.
ELRL can also run on RAIL and is even powered. This one also has MTRO and 3RDR in its alternative_railtype_list, so MTRO and 3RDR vehicles might also end up as seeing ELRL as their main label.

So, I would think you need the following (values between brackets might not apply for what you want):
RAIL:
compatible: ELRL, SAAZ, (SAA3) - powered: ELRL, SAAZ, (SAA3) - alternative: not applicable

ELRL:
compatible: ELRL, SAAZ, (SAA3) - powered: not applicable/SAAZ - alternative: not applicable

SAA3:
compatible: (RAIL, ELRL), SAAZ - powered: SAAZ - alternative: MTRO, 3RDR

SAAZ:
compatible: RAIL, ELRL, SAA3- powered: ELRL, SAA3- alternative: not applicable

Then RAIL and ELRL behave as the default track types, with added functionality that the vehicles can be pulled on your other tracks (and possibly run on their own), while SAA3 falls back to the 3rd rail/metro track for track sets coded with the old label and SAAZ really works for tracks that have vehicles for it.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Railtype code not working, tracks not allowing purchase/running of "vehicles"

Post by NekoMaster »

Transportman wrote: 24 Aug 2020 17:51 I think you don't understand how the various *_railtype_list attributes work, as with the current code you would get some funny results with RAIL and ELRL.
RAIL can only run on RAIL, but as it has MTRO and 3RDR in it's alternative_railtype_list, vehicles with that label might end up having RAIL as their main label.
ELRL can also run on RAIL and is even powered. This one also has MTRO and 3RDR in its alternative_railtype_list, so MTRO and 3RDR vehicles might also end up as seeing ELRL as their main label.

So, I would think you need the following (values between brackets might not apply for what you want):
RAIL:
compatible: ELRL, SAAZ, (SAA3) - powered: ELRL, SAAZ, (SAA3) - alternative: not applicable

ELRL:
compatible: ELRL, SAAZ, (SAA3) - powered: not applicable/SAAZ - alternative: not applicable

SAA3:
compatible: (RAIL, ELRL), SAAZ - powered: SAAZ - alternative: MTRO, 3RDR

SAAZ:
compatible: RAIL, ELRL, SAA3- powered: ELRL, SAA3- alternative: not applicable

Then RAIL and ELRL behave as the default track types, with added functionality that the vehicles can be pulled on your other tracks (and possibly run on their own), while SAA3 falls back to the 3rd rail/metro track for track sets coded with the old label and SAAZ really works for tracks that have vehicles for it.
Thanks for the response though I'm still not having any luck.

I tried your suggestion for compatible and powered railtypes for a TEST Dual System/SAAZ rail and STILL nothing shows up from sets that have Diesel/Steal, Electric, and Metro/3rd Rail vehicles.
(Not even the 3rd rail trains and locomotives from my NARS Add-on Set appear in the purchase list).

This is the code I have thats giving me issue.

Code: Select all

item(FEAT_RAILTYPES, 				SAAZ, 						00) {
	property {
	
	    label: 						"SAAZ";

		sort_order:					47;	//SHOULD COME AFTER THE DEFAULT RAILTYPES FOR TESTING!
		
		name: 					string(STRING_RAILTYPE_NAME_TEST);
		toolbar_caption:			string(STRING_RAILTYPE_NAME_TEST);
		menu_text: 				string(STRING_RAILTYPE_NAME_TEST);
		build_window_caption: 			string(STRING_RAILTYPE_NAME_TEST);
		autoreplace_text: 			string(STRING_RAILTYPE_NAME_TEST);
		new_engine_text:			string(STRING_RAILTYPE_NAME_TEST);
		
		introduction_date: 			date(1700,1,1);
		speed_limit:				161 km/h;
		construction_cost:			10;
		maintenance_cost:			10;
		
		compatible_railtype_list: 	["RAIL", "ELRL", "SAA3"];
		powered_railtype_list: 		["ELRL", "SAA3"];
//		alternative_railtype_list: 	[""];	DISABLED, NOT APPLICABLE

		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);
		acceleration_model:			ACC_MODEL_RAIL;
		map_colour:					95;
	}
The tracks show up, they appear in the rail list after Maglev, and I can build them just fine, but again, when I look int he depot to buy a rail vehicle/train, theres just an empty blank list with no trains or wagons.

At the moment the only files/code i have is the Main PNML file, "header.pnml", "sprite_templates.pnml", and "railtest_saaz.pnml". I dont think there should be anything else influencing my code.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

This is litterally the simplest I've witteled my code down to just a SINGLE railtype to try and get stuff working with and STILL nothing appears on this railtype from any set I've tested.

HOPEFULLY This is simple enough for anyone to put into a PNML file and compile for themselves. I REALLY Don't understand what the hell is going on here and I'm becoming very discouraged.

Code: Select all

//	#####################################################################################################################
//	#####################################################################################################################
//	#####################################################################################################################
//	#
//	#	NORTH AMERICAN TRACK SET 2:		TEST CODE																		#
//	#
//	#####################################################################################################################
//	#####################################################################################################################
//	#####################################################################################################################

	grf	{
	
		grfid:							"NM\20\08";
		name:							string(STRING_HEADER_GRF_NAME);
		desc:							string(STRING_HEADER_GRF_DESC);
		url:							string(STRING_HEADER_GRF_LINK);
		version:						010101;
		min_compatible_version:			000000;	
		
	}

//	#####################################################################################################################

	item(FEAT_RAILTYPES, 				SAAZ, 						00) {
		property {
		
			label: 						"SAAZ";

			sort_order:					47;	//SHOULD COME AFTER THE DEFAULT RAILTYPES FOR TESTING!
			
			name: 						string(STRING_RAILTYPE_NAME_TEST);
			toolbar_caption:			string(STRING_RAILTYPE_NAME_TEST);
			menu_text: 					string(STRING_RAILTYPE_NAME_TEST);
			build_window_caption: 		string(STRING_RAILTYPE_NAME_TEST);
			autoreplace_text: 			string(STRING_RAILTYPE_NAME_TEST);
			new_engine_text:			string(STRING_RAILTYPE_NAME_TEST);
			
			introduction_date: 			date(1700,1,1);
			speed_limit:				161 km/h;
			construction_cost:			10;
			maintenance_cost:			10;
			
			compatible_railtype_list: 		["RAIL", "ELRL", "SAA3"];
			powered_railtype_list: 			["ELRL", "SAA3"];
			//alternative_railtype_list: 	["MTRO"];

			railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);
			acceleration_model:			ACC_MODEL_RAIL;
			map_colour:					95;
		}
	}
	
//	#####################################################################################################################
//	#####################################################################################################################
//	#####################################################################################################################
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Quast65
Tycoon
Tycoon
Posts: 2661
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Quast65 »

1. Have to ask, just to check, what year are you playing your testgame and are trains already available then?
Just to check that you are not testing in a year where no trains would be available anyway (as I see that your tracks are available from 1700).
(You know the, is the device plugged in question ;-) )

2. Hopefully more useful...
I have been experimenting with railtypes a while ago and I emphasize experimenting ;-)
As it has been a while ago (almost a year), I cant really remember what exactly I did to get it to work, but I believe the trick for me was to start with railtypes that replaced label "RAIL" and "ELRL" (and in my case also "MGLV") and then add the powered railtype list to those.
I can remember that suddenly I did get trains in my depots.
Here is my code, No guarantees ;-)
FARTS_v001.nml
(159.09 KiB) Downloaded 59 times
EDIT:
As you can see from my code, I dont use alternative and compatible railtype lists, just the powered. Could be that the magic is there..
I can remember I fiddled around with those for a while and not using Alternative and Compatible did the trick for me.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

Quast65 wrote: 26 Aug 2020 08:42 1. Have to ask, just to check, what year are you playing your testgame and are trains already available then?
Just to check that you are not testing in a year where no trains would be available anyway (as I see that your tracks are available from 1700).
(You know the, is the device plugged in question ;-) )

2. Hopefully more useful...
I have been experimenting with railtypes a while ago and I emphasize experimenting ;-)
As it has been a while ago (almost a year), I cant really remember what exactly I did to get it to work, but I believe the trick for me was to start with railtypes that replaced label "RAIL" and "ELRL" (and in my case also "MGLV") and then add the powered railtype list to those.
I can remember that suddenly I did get trains in my depots.
Here is my code, No guarantees ;-)
FARTS_v001.nml

EDIT:
As you can see from my code, I dont use alternative and compatible railtype lists, just the powered. Could be that the magic is there..
I can remember I fiddled around with those for a while and not using Alternative and Compatible did the trick for me.
Answer 1 : I test in the year 2100, and yes theres vehicles, I keep the "Vehicles never expire" setting on (have done so for probably the last 15 years :) )

As for 2: Its not like I haven't made a railset before with its own railtypes, the problem is that even trying to reuse my old code with any SLIGHT modifications to anything (without touching the railtype stuff) causes stuff to get weird where only one type vehicle appears (like metro/3rd rail) or NOTHING at all.

I have NO clue as to why NOTHING I use works and to make a North American Track Set 2 with more railtypes, I need to be able to make my own railtypes aside from RAIL, ELRL, MGLV, etc.

(IN NA Track Set 1, I used the typical railtype lables like SAAN, SCAZ, SEAN, SAAE, etc for stuff)
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Quast65
Tycoon
Tycoon
Posts: 2661
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Quast65 »

1. Had to check to be sure ;-)

2.
With regards to a clue, as I stated before, I do not use Alternative and/or Compatible lists in my code.
As far as I can remember those were also causing issues with me, losing them solved it.

Further more I can see some other differences with your label "RAIL" and mine:

Code: Select all

item(FEAT_RAILTYPES, FAR0) {
 property {
  label: "RAIL";
  introduction_date: date(1800,1,1);
  name: string(STR_TRACK_TYPE_FAR0);
  toolbar_caption: string(STR_CONSTRUCTION_FAR0);
  menu_text: string(STR_MENU_FAR0);
  build_window_caption: string(STR_BUILD_CAPTION_FAR0);
  autoreplace_text: string(STR_AUTOREPLACE_FAR0);
  new_engine_text: string(STR_NEW_ENGINE_FAR0);
  powered_railtype_list: ["FAR1", "FAR2", "FAR3", "FAE1", "FAE2", "FAE3", "FAT0", "FAT1", "FAT2", "FAT3"];
  construction_cost: 5;
  maintenance_cost: 1;
  speed_limit: 0;      
  acceleration_model: ACC_MODEL_RAIL;
  map_colour: 65;
 }
In my Powered Railtype List, I don have "RAIL", whereas in your code it is there.
Maybe changing that helps…

I am just trying to help by showing some differences between your code and mine.
I dont know why my code works, but it does work ;-)

And I do believe its something to do with the railtype lists, as I said before, I can remember fiddeling A LOT with those until suddenly everything worked with the code I posted.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Transportman »

If that is the only railtype in your NewGRF and you do not load a train set that has track_type pointing to that track, no vehicles will appear on it because there is no track saying it is compatible with your track. The default vehicles will be for the default track types of the game (RAIL, ELRL, MONO, MGLV), which do not define to be compatible with your custom railtype, your NARS add-on might not recognize the SAAZ label and as it has no alternative_railtype_list, will also not be found with a different label.

I think to have vehicles available on it, You need to redefine those default tracks to actually be compatible with your "SAAZ" rail.

With the below two tracks, I managed to get the default OpenTTD electric vehicles to appear on both tracks. The first is a stripped version of the Dutch Trackset yard rail, with modified compatible_ and powered_ lists, the second is your code you posted earlier.

Code: Select all

/*  This file is part of The Dutch Track Set
 *  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *  You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

//Defines YARD (Universal 40 km/h)
item(FEAT_RAILTYPES,item_YARD) {
	property {
		//Naming
		label:						"ELRL";
		name:						string(STR_NAME_YARD);
		toolbar_caption:			string(STR_TOOL_YARD);
		menu_text:					string(STR_MENU_YARD);
		build_window_caption:		string(STR_BUIL_YARD);
		autoreplace_text:			string(STR_REPL_YARD);
		new_engine_text:			string(STR_NENG_YARD);
		sort_order:					01;		

		//Properties of the rail
		compatible_railtype_list:	["RAIL","SAAZ"];
		powered_railtype_list:		["RAIL","SAAZ"];
		acceleration_model:			ACC_MODEL_RAIL;

		//Costs
		construction_cost:			8;
		maintenance_cost:			8;

		//Graphics and other stuff
		station_graphics:			RAILTYPE_STATION_NORMAL;
		railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);

		
		//The track should be available when there are both DC and AC trains, but not when only one of them is available, because that would introduce all tracks
		introduction_date:			date(1800,01,01);
	}
}

Code: Select all

item(FEAT_RAILTYPES,SAAZ) {
		property {
		
			label: 						"SAAZ";

			sort_order:					47;	//SHOULD COME AFTER THE DEFAULT RAILTYPES FOR TESTING!
			
			name: 						string(STRING_RAILTYPE_NAME_TEST);
			toolbar_caption:			string(STRING_RAILTYPE_NAME_TEST);
			menu_text: 					string(STRING_RAILTYPE_NAME_TEST);
			build_window_caption: 		string(STRING_RAILTYPE_NAME_TEST);
			autoreplace_text: 			string(STRING_RAILTYPE_NAME_TEST);
			new_engine_text:			string(STRING_RAILTYPE_NAME_TEST);
			
			introduction_date: 			date(1700,1,1);
			speed_limit:				161 km/h;
			construction_cost:			10;
			maintenance_cost:			10;
			
			compatible_railtype_list: 		["RAIL", "ELRL","XXXX"];
			powered_railtype_list: 			["ELRL","XXXX"];
			//alternative_railtype_list: 	["MTRO"];

			railtype_flags:				bitmask(RAILTYPE_FLAG_CATENARY);
			acceleration_model:			ACC_MODEL_RAIL;
			map_colour:					95;
		}
	}
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

Well I was kinda figuring that I might have to at least start with some of the default railtypes like RAIL and ELRL and than go on from that.

Perhaps I'll give that a try, set up RAIL and ELRL as Class 1 (24 km/h) Rail ANd El.Rail types (and than after that, try adding Third Rail SAA3 and Dual System SAAZ)


At the end of the day I just want the track types to be avilable to all past and future sets as basic railtypes with speed limits, I'm not looking to make anything "Special" for a specific vehicle set since in North america low speed and high speed tracks tend to get used for what ever but do have their dedicated uses (like industrial/branch line trains on Class 1 or Class 2 very low speed tracks, or running a Pseudo-High speed train on Class 6 - Class 7 High speed tracks (Class 8 is currently being constructed in some places, and Class 9 doesnt exist yet))

I figure once I can get at least one set of Class 1 Railtype tracks, than I can just copy the code, change up whats needed, and basically keep going like I did with the NA Track Set v1 when I figured out how to use the stuff in NuTracks.


HOPEFULLY if I get stuff working, YOu guys wont hear form me again, but I wouldn't count on it. I'm having "breakfast" right now and still waking up so I'll have to get to work later.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

NOPE Still having issues, and this time I thought things would be alright.

So I decided to put the code for RAIL and ELRL in the main PNML file (for now, I might move them to their own files later), and added an #include for Normal Class 1 RAIL aka SAAN.

RAIL and ELRL work as they should, but of course my Class 1 RAIL/SAAN shows NOTHING at all as usual.

RAIL AND ELRL code from the Main PNML File.

Code: Select all

//	#################################
//	#	INCLUDE:	RAILTYPE CODE	#
//	█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████

//	(REDEFINE THE DEFAULT RAILTYPES!)

//	#############################################################################
//	RAIL
//	=============================================================================

	item(FEAT_RAILTYPES,					RAIL,			01	)	{	//ALWAYS FEAT_RAILTYPES FIRST, THAN YOUR OWN INTERNAL RAILTYPE NAME, AND THE LAST NUMBER IS THE ID
	
		property	{

//					-------------------------------------------------------------
//					THE BASICS FIRST!
//					-------------------------------------------------------------
		
					label:					"RAIL";			//DEFAULT UNPOWERED RAIL
					sort_order:				01;				//RAILS DEFAULT SORT PUTS IT FIRST IN THE DROPDOWN LIST!
					map_colour:				00;				//THE RAILS COLOR IN THE WORLD MAP, BASED ON THE COLOR ID/ENTRY IN THE TTD PALETTE

//					-------------------------------------------------------------
//					THE IMPORANT STUFF!
//					-------------------------------------------------------------										
										
					introduction_date:		date(0000,1,1);	//DEFAULT RAIL IS ALWAYS AVAILABLE! THE NUMBER 0000 CAN BE REPLACED BY A "PARAMETER_INTRO_DATE" THINGY.
					speed_limit:			0 km/h;			//DEFAULT RAIL HAS NO SPEED LIMIT! ALSO LIKE THE INTRO DATE, THE 0 CAN BE REPLACED BY YOUR OWN "PARAMETER_SPEED_LIMIT"
					construction_cost:		180;			//CAN BE SET MANUALLY OR FROM THE COST DEFINITIONS FILE USING CC_YOURRAILTYPE
					maintenance_cost:		8;				//YOU CAN ALSO DO MATH HERE IF YOU WANT SOMETHING FANCY OR TO INCLUDE A PARAMETER IN THE ALGORITHM (EG: 100 * PARAM_CC / 2)

					compatible_railtype_list: 				["RAIL"];

					powered_railtype_list: 					["RAIL"];

					alternative_railtype_list:				["SAAN","SABN","SACN","SADN","SAEN"];

//					-------------------------------------------------------------
//					EXTRA STUFF (STILL REQUIRED!)
//					-------------------------------------------------------------

//					railtype_flags:			bitmask(RAILTYPE_FLAG_HIDDEN);					
					acceleration_model:		ACC_MODEL_RAIL;	//VALID VALUES INCLUDE RAIL, MONO & MGLV
	
//					=================================================================================					
//					STRINGS (FOUND IN YOUR /LANG/YOURLANGAUGE.LNG FILE)
//					*********************************************************************************
					name:					string(STRING_RAILTYPE_NAME________________DEFAULT_RAIL);	//THE NAME OF THIS RAILTYPE
					toolbar_caption:		string(STRING_RAILTYPE_CONSTRUCTION________DEFAULT_RAIL);	//THE TEXT IN THE RAILTYPES CONSTRUCTION TOOLBAR
					menu_text:				string(STRING_RAILTYPE_MENU_TEXT___________DEFAULT_RAIL);	//WHAT YOU SEE IN THE DROPDOWN MENU LIST FOR RAILS
					autoreplace_text:		string(STRING_RAILTYPE_AUTOREPLACE_________DEFAULT_RAIL);	//THE "Autoreplace XRAILTYPE Rail Vehicle" TEXT
					new_engine_text:		string(STRING_RAILTYPE_NEW_RAILTYPE_ENGINE_DEFAULT_RAIL);	//WHAT EACH NEW TRAINS INTRODUCTION IS PREFIXED BY (EG. New High Speed Rail Vehicle!)

					}
	}
	
//	#############################################################################
//	ELECTRIFIED RAIL
//	=============================================================================	
	
	item(FEAT_RAILTYPES,					ELRL,			02	)	{	//ALWAYS FEAT_RAILTYPES FIRST, THAN YOUR OWN INTERNAL RAILTYPE NAME, AND THE LAST NUMBER IS THE ID
	
		property	{

//					-------------------------------------------------------------
//					THE BASICS FIRST!
//					-------------------------------------------------------------
		
					label:					"ELRL";			//DEFAULT UNPOWERED RAIL
					sort_order:				02;				//RAILS DEFAULT SORT PUTS IT FIRST IN THE DROPDOWN LIST!
					map_colour:				00;				//THE RAILS COLOR IN THE WORLD MAP, BASED ON THE COLOR ID/ENTRY IN THE TTD PALETTE

//					-------------------------------------------------------------
//					THE IMPORANT STUFF!
//					-------------------------------------------------------------										
										
					introduction_date:		date(0000,1,1);	//DEFAULT RAIL IS ALWAYS AVAILABLE! THE NUMBER 0000 CAN BE REPLACED BY A "PARAMETER_INTRO_DATE" THINGY.
					speed_limit:			0 km/h;			//DEFAULT RAIL HAS NO SPEED LIMIT! ALSO LIKE THE INTRO DATE, THE 0 CAN BE REPLACED BY YOUR OWN "PARAMETER_SPEED_LIMIT"
					construction_cost:		270;			//CAN BE SET MANUALLY OR FROM THE COST DEFINITIONS FILE USING CC_YOURRAILTYPE
					maintenance_cost:		16;				//YOU CAN ALSO DO MATH HERE IF YOU WANT SOMETHING FANCY OR TO INCLUDE A PARAMETER IN THE ALGORITHM (EG: 100 * PARAM_CC / 2)

					compatible_railtype_list:				["RAIL","ELRL","SAEA","SBEE","SBCA"];
					powered_railtype_list:					["ELRL","SBEE"];

					alternative_railtype_list: 				["SAAD","SABD","SACD","SADD","SAED"];


//					-------------------------------------------------------------
//					EXTRA STUFF (STILL REQUIRED!)
//					-------------------------------------------------------------

					railtype_flags:			bitmask(RAILTYPE_FLAG_CATENARY);	//_CATENARY TELLS THE GAME TO DRAW THE OVERHEAD LINES, _HIDDEN TELLS IT NOT TO SHOW IT INGAME TO BUILD.				
					acceleration_model:		ACC_MODEL_RAIL;						//VALID VALUES INCLUDE RAIL, MONO & MGLV
	
//					=================================================================================					
//					STRINGS (FOUND IN YOUR /LANG/YOURLANGAUGE.LNG FILE)
//					*********************************************************************************
					name:					string(STRING_RAILTYPE_NAME________________DEFAULT_ELRL);	//THE NAME OF THIS RAILTYPE
					toolbar_caption:		string(STRING_RAILTYPE_CONSTRUCTION________DEFAULT_ELRL);	//THE TEXT IN THE RAILTYPES CONSTRUCTION TOOLBAR
					menu_text:				string(STRING_RAILTYPE_MENU_TEXT___________DEFAULT_ELRL);	//WHAT YOU SEE IN THE DROPDOWN MENU LIST FOR RAILS
					autoreplace_text:		string(STRING_RAILTYPE_AUTOREPLACE_________DEFAULT_ELRL);	//THE "Autoreplace XRAILTYPE Rail Vehicle" TEXT
					new_engine_text:		string(STRING_RAILTYPE_NEW_RAILTYPE_ENGINE_DEFAULT_ELRL);	//WHAT EACH NEW TRAINS INTRODUCTION IS PREFIXED BY (EG. New High Speed Rail Vehicle!)

					}
	}
	
//	#####################################################################################################################	
	
And than this is the code for my CLASS 1 RAIL/SAAN Railtype

Code: Select all

//	█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
//	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
//	█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
//
//					(CLASS 1) LOW SPEED RAIL
//
//	█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
//	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
//	█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████

	item(FEAT_RAILTYPES,					SAAN,			10	)	{	//ALWAYS FEAT_RAILTYPES FIRST, THAN YOUR OWN INTERNAL RAILTYPE NAME, AND THE LAST NUMBER IS THE ID
	
		property	{

//					-------------------------------------------------------------
//					THE BASICS FIRST!
//					-------------------------------------------------------------
		
					label:					"SAAN";			//DEFAULT UNPOWERED RAIL
					sort_order:				10;				//RAILS DEFAULT SORT PUTS IT FIRST IN THE DROPDOWN LIST!
					map_colour:				65;				//THE RAILS COLOR IN THE WORLD MAP, BASED ON THE COLOR ID/ENTRY IN THE TTD PALETTE

//					-------------------------------------------------------------
//					THE IMPORANT STUFF!
//					-------------------------------------------------------------										
										
					introduction_date:		date(1800,1,1);	//DEFAULT RAIL IS ALWAYS AVAILABLE! THE NUMBER 0000 CAN BE REPLACED BY A "PARAMETER_INTRO_DATE" THINGY.
					speed_limit:			24 km/h;		//DEFAULT RAIL HAS NO SPEED LIMIT! ALSO LIKE THE INTRO DATE, THE 0 CAN BE REPLACED BY YOUR OWN "PARAMETER_SPEED_LIMIT"
					construction_cost:		180 / 4;		//CAN BE SET MANUALLY OR FROM THE COST DEFINITIONS FILE USING CC_YOURRAILTYPE
					maintenance_cost:		8;				//YOU CAN ALSO DO MATH HERE IF YOU WANT SOMETHING FANCY OR TO INCLUDE A PARAMETER IN THE ALGORITHM (EG: 100 * PARAM_CC / 2)

					compatible_railtype_list:				["ELRL","SAEA","SBEE","SBCA","SADD","SAEA"];
					powered_railtype_list:					["ELRL","SAEA","SBEE","SBCA","SADD","SAEA"];
					
					alternative_railtype_list:				["SAAN","SABN","SACN","SADN","SAEN"];

//					-------------------------------------------------------------
//					EXTRA STUFF (STILL REQUIRED!)
//					-------------------------------------------------------------

//					railtype_flags:			bitmask(RAILTYPE_FLAG_HIDDEN);					
					acceleration_model:		ACC_MODEL_RAIL;	//VALID VALUES INCLUDE RAIL, MONO & MGLV
	
//					=================================================================================					
//					STRINGS (FOUND IN YOUR /LANG/YOURLANGAUGE.LNG FILE)
//					*********************************************************************************
					name:					string(STRING_RAILTYPE_NAME________________DEFAULT_RAIL);	//THE NAME OF THIS RAILTYPE
					toolbar_caption:		string(STRING_RAILTYPE_CONSTRUCTION________DEFAULT_RAIL);	//THE TEXT IN THE RAILTYPES CONSTRUCTION TOOLBAR
					menu_text:				string(STRING_RAILTYPE_MENU_TEXT___________DEFAULT_RAIL);	//WHAT YOU SEE IN THE DROPDOWN MENU LIST FOR RAILS
					autoreplace_text:		string(STRING_RAILTYPE_AUTOREPLACE_________DEFAULT_RAIL);	//THE "Autoreplace XRAILTYPE Rail Vehicle" TEXT
					new_engine_text:		string(STRING_RAILTYPE_NEW_RAILTYPE_ENGINE_DEFAULT_RAIL);	//WHAT EACH NEW TRAINS INTRODUCTION IS PREFIXED BY (EG. New High Speed Rail Vehicle!)

					}
	}
	
I realy thought I'd have something this time so I could get to work on doing sprite templates and the graphics/sprites.

EDIT : I'D LIKE TO MENTION THAT YES, my Class 1 Railtype Comes after the Default rail and elrl stuff. Infact at the moment, aside from comments, its the last proper code included with the project at the moment.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Transportman »

Try adding "SAAN" to the compatible and powered railtype_list of RAIL/ELRL, I think that should work.

Also, with your current code, RAIL vehicles can not run on ELRL, as ELRL is not in the compatible and powered railtype_list of RAIL.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

Transportman wrote: 28 Aug 2020 16:58 Try adding "SAAN" to the compatible and powered railtype_list of RAIL/ELRL, I think that should work.

Also, with your current code, RAIL vehicles can not run on ELRL, as ELRL is not in the compatible and powered railtype_list of RAIL.
Alright so I think I'm getting somewhere now. I now have stuff apeparing on my Class 1 "SAAN" rail, but its EVERYTHING, both rail and electrified stuff as well.

DEFAULT RAIL "RAILTYPES" LIST
================================================================================

Code: Select all

compatible_railtype_list: 				["RAIL", "ELRL", "SAAN"];

powered_railtype_list: 					["RAIL", "ELRL", "SAAN"];

alternative_railtype_list:				["SAAN", "SABN", "SACN", "SADN", "SAEN"];
DEFAULT ELRL
================================================================================

Code: Select all

compatible_railtype_list:				["ELRL", "RAIL", "SAAN"];
					
powered_railtype_list:					["ELRL", "RAIL", "SAAN"];

alternative_railtype_list: 				["SAAD", "SABD", "SACD", "SADD", "SAED"];
AND NOW The railtype lists for my CLass 1 "SAAN" rail (Vehicles appear for purchase, but both RAIL AND ELRL vehicles are avialable and run on SAAN)
================================================================================

Code: Select all

compatible_railtype_list:				["RAIL", "SAAN"];
															 
powered_railtype_list:					["RAIL", "SAAN"];
					
alternative_railtype_list:				["RAIL", "SAAN"];
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by NekoMaster »

**OK OK** I'm getting somewhere after messing about with the code for RAIL, ELRL, SAAN, SAAE, and SAA3.

SAAN only allows UNpowered trains but lets everything be pulled by unpowered locomotives (like a steam engine pulling electric locomotives or subway trains)

SAAE allows electrified trains, but allows RAIL and 3RD rail vehicles to cross over it (PLus like normal ELRL, you can buy Steam, Diesel, and Electric trains in SAAE depots)

SAA3/Third Rail allows RAIL and Subway trains to be purchased but not electrified trains, but like the other two track types other trains can be pulled over it.

New problem though: Well SAAN crosses SAAE, SAAE looses its electrification and the junction/crossing becomes normal unelectrified SAAN Rail. The same happens when trying to build SAAE electrified rail over SAAN, the crossing looses the electrifications.

SAA3/THird Rail wont allow either rail to cross them, so you have to build the junction manually with SAA3 to allow other railtypes to connect to it.

I'd like it if the railtypes I made did the crossings like other sets like NATS v1, DUAL SYSTEM overrides all, SAA3 overrides everything before it, ELRL electrifies RAIL and RAIL takes on what ever rail type its crossing.

EDIT
Nope, I think I've got it fixed now. WHile I'd prefer to have written everything by hand I just trimmed the railtype compatibility code fgrom NATS v1 (which it self was based on NuTracks) and doing so means that now everything works as intended (Rail can cross everything now and takes on what ever rail type it crosses, and vehicles only show up in their respective railtype depots if there are compatible vehicles)

HOPEFULLY NOW I have things working enough for me to start working on other things like making the graphics, parameters, and perhaps tidy up some stuff to make things a little easier to use and read/grasp for myself in the future and other players that might want to make their own track set.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Quast65
Tycoon
Tycoon
Posts: 2661
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Quast65 »

Good to hear!

Good luck with further development!
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
Gadg8eer
Traffic Manager
Traffic Manager
Posts: 190
Joined: 14 Dec 2019 14:22

Re: RAILTYPE Code not working (Cannot See/Purchase Trains on ANY Track I make!)

Post by Gadg8eer »

I'm encountering the same issue with roadtypes. I think something's wrong with the compiler: Changing anything results in the GRF compiling but no difference in function.

Code: Select all

/**********************************************
 * Roadtype definitions:
 **********************************************/

/* Note that roadtypes only show in OpenTTD if compatible vehicles are available.
   examples/road_vehicle provides some vehicles for these roadtypes */

item(FEAT_ROADTYPES, normal_roadway_metro) {
    property {
        label: "ROAD";
        powered_roadtype_list: ["SMRT"];
		//introduces_roadtype_list: ["ELRD", "IADN", "IBEN", "IBEE", "ICCN", "ICCE", "IDDN", "IDDE"];
	}
}

item(FEAT_ROADTYPES, smart_road, 0) {
    property {
        name: string(STR_NAME_AUTO_ROAD);
        label: "SMRT";
		introduction_date: date(2025,1,1);
        powered_roadtype_list: ["SEES"];
		alternative_roadtype_list: ["OLD_", "ROAD"];
        toolbar_caption: string(STR_TOOLBAR_CAPTION_AUTO_ROAD);
        menu_text: string(STR_MENU_TEXT_AUTO_ROAD);
        build_window_caption: string(STR_BUILD_WINDOW_CAPTION_AUTO_ROAD);
        autoreplace_text: string(STR_AUTOREPLACE_TEXT_AUTO_ROAD);
        new_engine_text: string(STR_NEW_ENGINE_TEXT_AUTO_ROAD);
        roadtype_flags: bitmask(ROADTYPE_FLAG_TOWN_BUILD, ROADTYPE_FLAG_NO_LEVEL_CROSSING);
		construction_cost: 720;
//		speed_limit: 1 km/h;
		maintenance_cost: 4;
        sort_order: 97;
    }

    /* Associate graphics with this roadtype */
    graphics {
        track_overlay: road_overlays_smart_road;
        underlay: track_underlays;
        depots: depot_road_smartroad;
        bridge_surfaces: bridge_underlay_smart_road;
        roadstops: roadstop_underlay_smart_road;
		//gui: gui_normal;
        /* Catenary is not not implemented here, use the default */
    }
}
I have Asperger's, please be easy on me about stuff. My apologies if I've been a problem for you in the past.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 15 guests