Various NML related questions
Moderator: Graphics Moderators
-
- Route Supervisor
- Posts: 433
- Joined: 27 Mar 2013 08:58
- Location: Strumien
- Contact:
Re: Various NML related questions
Hi, is it possible to change color of the background of GUI elements by NML or in some different way? I mean the defatult gray color. I cant find any information on this in the wiki.
Re: Various NML related questions
i think that's done by overriding one of the default recolour maps. but don't ask me which one. (may have side effects)lukasz1985 wrote:Hi, is it possible to change color of the background of GUI elements by NML or in some different way? I mean the defatult gray color. I cant find any information on this in the wiki.
there are two types of capacity callbacks, one which follows the multipliers, and one which ignores them. you have to use the right kind. i think nml defaults to the non-multiplier callback, so just using callback instead of property might work (not sure)3iff wrote:2. The specified cargo size is halved for goods (40 cargo = 20 goods) but quartered for other cargos. It's implied that this can be overridden but I can't see anything obvious.
Re: Various NML related questions
I'm trying to use "current_month" in a switch but it seems to be returning zero all the time.
switch (FEAT_INDUSTRIES, SELF, check_month, STORE_PERM(current_month,10)) {
other code
}
I'm temporarily storing it in register 10 so I can see it change...but it stays at zero.
So, either I'm doing something wrong or it isn't working. Any ideas?
=====================
Forget it. I was 100% sure I was actually calling that switch but I had only altered one area that called it and missed the other block completely. It now works as I expected.
(I thought it might be my fault...
switch (FEAT_INDUSTRIES, SELF, check_month, STORE_PERM(current_month,10)) {
other code
}
I'm temporarily storing it in register 10 so I can see it change...but it stays at zero.
So, either I'm doing something wrong or it isn't working. Any ideas?
=====================
Forget it. I was 100% sure I was actually calling that switch but I had only altered one area that called it and missed the other block completely. It now works as I expected.
(I thought it might be my fault...
Re: Various NML related questions
A strange effect.
I get the population of a town (it's 700) and I get the following results.
It seems to be the "/ 2000" part that screws it up.
Is this a feature or a bug? Now I know what's happening it's no problem to work around it.
I get the population of a town (it's 700) and I get the following results.
Code: Select all
STORE_TEMP((population - 2000) / 2000 , 2), = 2147428 !!!
STORE_TEMP(population, 3), = 700
STORE_TEMP(population - 2000 , 4), = -1300
Is this a feature or a bug? Now I know what's happening it's no problem to work around it.
Re: Various NML related questions
I think that is a bug in OpenTTD.
Can you please retest using todays nightly (>= r27600). It becomes available in about an hour.
Can you please retest using todays nightly (>= r27600). It becomes available in about an hour.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Various NML related questions
Sure. I'll report back when I've tested it.
That looks better. Using v27601.
sum calculated is (1012 - 2000) / 2000 = -0.494 which rounds to 0. Much better than 2million+.
Thanks for the very quick fix.
That looks better. Using v27601.
sum calculated is (1012 - 2000) / 2000 = -0.494 which rounds to 0. Much better than 2million+.
Thanks for the very quick fix.
- colossal404
- Chief Executive
- Posts: 652
- Joined: 07 Mar 2009 12:48
- Location: Szeged, Hungary
Re: Various NML related questions
Hi!
I'd like to ask a question about company colours: Is it possible to disable the recolouring? If yes, is it possible to disable it for just certain refits?
I'd like to use the CC2 green for a non-company coloured refit, but in the same vehicle, I'd like to use the second company colour on another refit.
I'm coding in NML.
I'd like to ask a question about company colours: Is it possible to disable the recolouring? If yes, is it possible to disable it for just certain refits?
I'd like to use the CC2 green for a non-company coloured refit, but in the same vehicle, I'd like to use the second company colour on another refit.
I'm coding in NML.
-
- Tycoon
- Posts: 2781
- Joined: 22 Feb 2011 18:34
Re: Various NML related questions
Doesn't the palette have a non-CC green you can use? Otherwise I think you cannot get it working, as the misc_flags that toggles the behavior is not available as callback.colossal404 wrote:Hi!
I'd like to ask a question about company colours: Is it possible to disable the recolouring? If yes, is it possible to disable it for just certain refits?
I'd like to use the CC2 green for a non-company coloured refit, but in the same vehicle, I'd like to use the second company colour on another refit.
I'm coding in NML.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Various NML related questions
I have an industry I don't want the player to be able to build during the game. How do I block this?
I still want the industry to be available for random placement. Players would be free to build all other industries should they wish.
I can't seem to find a command to block player funding for a specific industry...
-----
Ah, partially there. I can now stop it being built but it still appears in the "fund industry" menu.
I still want the industry to be available for random placement. Players would be free to build all other industries should they wish.
I can't seem to find a command to block player funding for a specific industry...
-----
Ah, partially there. I can now stop it being built but it still appears in the "fund industry" menu.
Re: Various NML related questions
You can do that via the "colour_mapping" callback:colossal404 wrote:Hi!
I'd like to ask a question about company colours: Is it possible to disable the recolouring? If yes, is it possible to disable it for just certain refits?
I'd like to use the CC2 green for a non-company coloured refit, but in the same vehicle, I'd like to use the second company colour on another refit.
I'm coding in NML.
- Use both CC as normal: "colour_mapping: return CB_FAILED;"
- Disable both CC: "colour_mapping: return PALETTE_CC_FIRST;"
- Only use first CC: "colour_mapping: return base_sprite_2cc + company_colour1;"
- Only use second CC: "colour_mapping: return base_sprite_2cc + 16*company_colour2;"
- Use the palette colours of the first CC, but using the player's second CC selection: "colour_mapping: return base_sprite_2cc + company_colour2;"
- Swap CC: "colour_mapping: return base_sprite_2cc + company_colour2 + 16*company_colour1;"
- Use random colours: "colour_mapping: return base_sprite_2cc + getbits(random_bits , 0, 8 );"
- Use first CC and random second CC: "colour_mapping: return base_sprite_2cc + company_colour1 + 16*getbits(random_bits , 0, 4);"
- Use colour depending on build year: "colour_mapping: return base_sprite_2cc + getbits(build_year, 0, 4)"
- ...
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Various NML related questions
IIRC the callback "construction_probabiilty" is also checked in the fund list, so something like:3iff wrote:I have an industry I don't want the player to be able to build during the game. How do I block this?
I still want the industry to be available for random placement. Players would be free to build all other industries should they wish.
I can't seem to find a command to block player funding for a specific industry...
-----
Ah, partially there. I can now stop it being built but it still appears in the "fund industry" menu.
- construction_probabiilty
- switch of "getbits(extra_callback_info2, 0, 8 )"
- in case of "IND_CREATION_FUND" return 0
- otherwise return 255
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Various NML related questions
Thanks. I think I might almost understand that...perhaps.
I'll give it a try.
----------
I'm not having any success. I can block the industry being funded but it still appears in the menu. Not to worry, I can live with that for now.
I did have a switch block that essentially did what you suggested but I must have something slightly wrong.
I'll give it a try.
----------
I'm not having any success. I can block the industry being funded but it still appears in the menu. Not to worry, I can live with that for now.
I did have a switch block that essentially did what you suggested but I must have something slightly wrong.
Re: Various NML related questions
Ah, I see: OpenTTD only disables the buttons, but it always shows all industries in the list.
You cannot change that via NewGRF.
You cannot change that via NewGRF.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Various NML related questions
I guessed as much. Well, I can block player funding of that industry so that's as much as can be done.
Thanks.
Thanks.
Re: Various NML related questions
Hi,
how to set several refits for the same cargo type? I would like to add a few livery options and am pretty new to coding on my own.
Is there any example out there?
Thanks!
how to set several refits for the same cargo type? I would like to add a few livery options and am pretty new to coding on my own.
Is there any example out there?
Thanks!
My project: CS Bus Set viewtopic.php?f=26&t=87962
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
Re: Various NML related questions
This is done by subcargoes. They are done in 2 steps: define subcargo names, then what the subcargo changes via switches
Re: Various NML related questions
I am lost in the cargo sub-type. The only reference I found is in the 3/4 parts DMU creation and there the subtype is defined based on the placement of the vehicle. I can't quite get the trick, how to attach the graphics - based on what?
I mean I already attach graphic based on cargotype - Cargotype is PASS and MAIL. Mail is only one refit, buses (for passengers) should have several for livery purposes.
I got this - and I know there are several mistakes, I just simply dont know how to correct them. The basic set when refitting from mail to passengers is easy, but I have idea, how to make the C734.1340.3 available...
if this is supposed to be the livery refit of C734.00-C734.1340, should this be in a Spritesetgroup? If so, based on the
cargo-subtype parameter?
double setting - not allowed, but how do I set that the sub-cargo will be transporting pass?[/color]
I mean I already attach graphic based on cargotype - Cargotype is PASS and MAIL. Mail is only one refit, buses (for passengers) should have several for livery purposes.
I got this - and I know there are several mistakes, I just simply dont know how to correct them. The basic set when refitting from mail to passengers is easy, but I have idea, how to make the C734.1340.3 available...
Code: Select all
cargotable {
/* Used in refit mask */
PASS, // C734 & C734.1340.3
MAIL // C734 Mail
}
/* C734.00-C734.1340 */
spriteset(KAROSA_C734_1, "gfx/KarosaC734.png") { TMP_KAROSA_C734(0) }
/* C734.1340.3 */
spriteset(KAROSA_C734_3, "gfx/KarosaC734.png") { TMP_KAROSA_C734(29) }
/* C734 mail */
spriteset(KAROSA_C734_M, "gfx/KarosaC734.png") { TMP_KAROSA_C734(58) }
switch(FEAT_ROADVEHS, SELF, sw_C734_cargo_subtype_text, cargo_subtype) {
0: return string(STR_KAROSA_C734_1);
1: return string(STR_KAROSA_C734_3);
return CB_RESULT_NO_TEXT;
switch(FEAT_ROADVEHS, SELF, sw_C734_graphics, cargo_subtype) {
0: KAROSA_C734_1;
1: KAROSA_C734_3;
}
item (FEAT_ROADVEHS, ITEM_KAROSA_C734) {
.
. no issue here with property setting
.
.
}
graphics {
cargo_capacity: KAROSA_C734_capacity_switch;
PASS: KAROSA_C734_1;
PASS: KAROSA_C734_3;
MAIL: KAROSA_C734_M;
default: KAROSA_C734_1; // Default to Pass.
cargo_subtype_text: sw_C734_cargo_subtype_text;
}
}
Code: Select all
spriteset(KAROSA_C734_3, "gfx/KarosaC734.png") { TMP_KAROSA_C734(29) }
cargo-subtype parameter?
Code: Select all
PASS: KAROSA_C734_3;
double setting - not allowed, but how do I set that the sub-cargo will be transporting pass?[/color]
My project: CS Bus Set viewtopic.php?f=26&t=87962
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
-
- Tycoon
- Posts: 2781
- Joined: 22 Feb 2011 18:34
Re: Various NML related questions
For PASS you should refer to a switch that makes it's decision based on the cargo_subtype variable to determine which livery to show.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Various NML related questions
In this case, the default graphics switch should be sw_C734_graphics, because it will always default to subcargo 0.
Re: Various NML related questions
I was able to complete one vehicle to a state that it works like it should. However I seem to have an issue with this one:
I do believe it is because of the PASS thing I would like to remove since this is a bus and will not have acargo refit. Should I simply use this:
instead of PASS: PRAGA_N_LIVERY_SWITCH;?
Thank you!
I get "nmlc ERROR: "CS_BusSetw2.nml", line 111: Syntax error, unexpected token "switch"grf {
grfid: "GFJ\00";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESCRIPTION);
version: 0;
min_compatible_version: 0;
}
/* *****************************************************Start of the graphic part***************************************************** */
template TMP_CS_BUSSET(y) {
[ 4 , 4 + y, 10, 28, -5, -14]
[ 24 , 4 + y, 26, 28, -13, -14]
[ 54 , 4 + y, 36, 28, -18, -14]
[ 94 , 4 + y, 26, 28, -13, -14]
[ 124, 4 + y, 10, 28, -5, -14]
[ 144, 4 + y, 26, 28, -13, -14]
[ 174, 4 + y, 36, 28, -18, -14]
[ 214, 4 + y, 26, 28, -13, -14]
/* Praga N, CS Posta */
spriteset(PRAGA_N_0, "gfx/CS_BusSetw.png") { TMP_CS_BUSSET(37) }
/* Praga N, DP Praha */
spriteset(PRAGA_N_1, "gfx/CS_BusSetw.png") { TMP_CS_BUSSET(70) }
/* Praga N, CC */
spriteset(PRAGA_N_2, "gfx/CS_BusSetw.png") { TMP_CS_BUSSET(103) }
/* Praga N, 2CC */
spriteset(PRAGA_N_3, "gfx/CS_BusSetw.png") { TMP_CS_BUSSET(136) }
/* ************************************Start of the switching part****************************************** */
cargotable {
/* Used in refit mask */
PASS // To set in the graffic override switch
/* =============================== Praga N switches =================================== */
switch(FEAT_ROADVEHS, SELF, PRAGA_N_LIVERY_SWITCH, cargo_subtype) {
0: PRAGA_N_0;
1: PRAGA_N_1;
2: PRAGA_N_2;
3: PRAGA_N_3;
}
switch(FEAT_ROADVEHS, SELF, sw_PRAGA_N_CARGO_SUBTYPE_TEXT, cargo_subtype) {
0: return string(STR_NAME_PRAGA_N_0);
1: return string(STR_NAME_PRAGA_N_1);
2: return string(STR_NAME_PRAGA_N_2);
3: return string(STR_NAME_PRAGA_N_3);
return CB_RESULT_NO_TEXT;
}
switch(FEAT_ROADVEHS, SELF, PRAGA_N_CAPACITY_SWITCH, cargo_subtype) {
0: 35;
1: 40;
2: 35;
3: 40;
}
/* *****************************************************Start of the properties part***************************************************** */
/* ===========================================Praga N======================================================= */
item (FEAT_ROADVEHS, ITEM_PRAGA_N) {
property {
/* Properties common to all vehicle types */
name: string(STR_NAME_PRAGA_N);
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
introduction_date: date(1915,01,01);
model_life: 11;
vehicle_life: 11;
reliability_decay: 20;
loading_speed: 5; // SWITCH ***********
cost_factor: 108; // **********Balance*********
running_cost_factor: 90; // **********Balance*********
/* cargo_age_period is left at default */
/* RV-specific properties */
sprite_id: SPRITE_ID_NEW_ROADVEH;
speed: 40 km/h;
// misc_flags: bitmask(ROADVEH_FLAG_2CC); // **********check*********
running_cost_base: RUNNING_COST_ROADVEH;
power: 45 hp;
weight: 4.5 ton;
/* TE and air drag coefficient is left at default */
refittable_cargo_classes: bitmask(CC_PASSENGERS);
cargo_capacity: 25;
sound_effect: SOUND_BUS_START_PULL_AWAY;
}
graphics {
default: PRAGA_N_0;
PASS: PRAGA_N_LIVERY_SWITCH;
cargo_subtype_text: sw_PRAGA_N_CARGO_SUBTYPE_TEXT;
cargo_capacity: PRAGA_N_CAPACITY_SWITCH;
}
}
I do believe it is because of the PASS thing I would like to remove since this is a bus and will not have acargo refit. Should I simply use this:
Code: Select all
cargo_subtype: PRAGA_N_LIVERY_SWITCH;
Thank you!
My project: CS Bus Set viewtopic.php?f=26&t=87962
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
Škoda - Praga - Tatra - Karosa - Oasa - Prima TL - Zliner - TAM BUS - SOR - Novoplan - Granus - Slovbus - Tedom - Irisbus - Iveco
Woof !
Who is online
Users browsing this forum: No registered users and 2 guests