Many NML questions
Moderator: Graphics Moderators
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Many NML questions
Hello, everybody.
I living at TT-Forums ~ 9 months and established himself as a good artist. Also I want to learn NML train coding, and (If You know) I'm russian, so it's harder to study it. If anyone can make some parody of a guide please write here, I'll be grateful.
I living at TT-Forums ~ 9 months and established himself as a good artist. Also I want to learn NML train coding, and (If You know) I'm russian, so it's harder to study it. If anyone can make some parody of a guide please write here, I'll be grateful.
Last edited by Tony Pixel on 21 May 2018 16:39, edited 1 time in total.
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Another guy which learns NML
https://www.tt-wiki.net/wiki/NMLTutorial
I recommend doing everything from the start, all the way up to and including "Four part refit" under "Railtypetable block". Also don't cut corners, that'll get you into trouble. This tutorial is about as well written as it'll get.
I used this when I started learning NML. It doesn't take too long at all if you just follow the steps in the tutorial.
Good luck!
I recommend doing everything from the start, all the way up to and including "Four part refit" under "Railtypetable block". Also don't cut corners, that'll get you into trouble. This tutorial is about as well written as it'll get.
I used this when I started learning NML. It doesn't take too long at all if you just follow the steps in the tutorial.
Good luck!
Re: Another guy which learns NML
I was going to post the same thing.
Remember that NML can only be used to code vehicles (IIRC it can also code ships and aircraft), objects and industries.
Remember that NML can only be used to code vehicles (IIRC it can also code ships and aircraft), objects and industries.
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
Thanks, I reading it now. But I have one trouble: when I want to compile NML file error goes:
I tried to change to UTF-8 all english.lang in both dir's (OYYD and NML), but anything goes.Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
What about language files? Can I simply copy it from OpenTTD, or every time when I create STR_... I should write this STR with unique code in my lang file?
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
Oh god, thanks/ I was stupid idiot when threreat started reading Tutorial in middle of it. Now I started understand everything what I read.
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
New question: how to make what GRF used with (russian) language in game will show (russian) strings? Can I simply create new lang file with the same strings and russian language ID?
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Another guy which learns NML
Actually i think you can insert both latin letters and cyrilic letters. If this wasn't possible, then there couldn't be any russian translations on openttdcoop translatorTony Pixel wrote:New question: how to make what GRF used with (russian) language in game will show (russian) strings? Can I simply create new lang file with the same strings and russian language ID?
Re: Another guy which learns NML
yes, just make a new .lng file next to english.lng with the appropriate IDs in it, then nmlc should pick it up when compiling the GRF. file should be in UTF8 format
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
Ok, next question: how to use "getbits" function for the different sprites in GUI and game?
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Another guy which learns NML
To tease this out a bit further, Tony is talking about using extra_callback_info1 to draw different sprites in the GUI, but I'm not sure what his difficulty is; it's just like any other switch.Tony Pixel wrote:Ok, next question: how to use "getbits" function for the different sprites in GUI and game?
Perhaps he could post his code that doesn't work, and someone can point out what he's doing wrong?
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
Thanks.
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
So, I know not NML wery well becouse didn't worked with python and learned it by the tutorial. Here is the code:PikkaBird wrote:To tease this out a bit further, Tony is talking about using extra_callback_info1 to draw different sprites in the GUI, but I'm not sure what his difficulty is; it's just like any other switch.Tony Pixel wrote:Ok, next question: how to use "getbits" function for the different sprites in GUI and game?
Perhaps he could post his code that doesn't work, and someone can point out what he's doing wrong?
Code: Select all
//--------------------------------------------------------------------------------------------------SPV-2000
spriteset (spriteset_purchase_SPV2000, "gfx/USA_SPV-2000.png") { [4, 35, 87, 13, 5, -6] }
template tmpl_SPV2000(x,y) {
[x, y, 8, 24, -3, -10]
[x+9, y, 22, 20, -14, -11]
[x+32, y, 32, 16, -16, -10]
[x+65, y, 22, 20, -8, -12]
}
spriteset (spriteset_SPV2000, "gfx/USA_SPV-2000.png") { tmpl_SPV2000(4,4) tmpl_SPV2000(92,4) }
item (FEAT_TRAINS, item_SPV2000) {
property {
name: string(STR_SPV2000_Name);
climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL);
introduction_date: date(1978, 1, 6);
model_life: VEHICLE_NEVER_EXPIRES;
vehicle_life: 30;
reliability_decay: 14;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
non_refittable_cargo_classes: bitmask();
loading_speed: 10;
cost_factor: 35;
running_cost_factor: 20;
sprite_id: SPRITE_ID_NEW_TRAIN;
speed: 140 km/h;
misc_flags: bitmask(TRAIN_FLAG_MU);
refit_cost: 0;
track_type: RAIL;
ai_special_flag: AI_FLAG_PASSENGER;
power: 270 kW;
running_cost_base: RUNNING_COST_ELECTRIC;
dual_headed: 0;
cargo_capacity: 109;
weight: 58 ton;
ai_engine_rank: 0;
engine_class: ENGINE_CLASS_DIESEL;
extra_power_per_wagon: 15 kW;
tractive_effort_coefficient: 0.3;
air_drag_coefficient: 0.06;
visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DIESEL, 0, DISABLE_WAGON_POWER);
extra_weight_per_wagon: 40 ton;
bitmask_vehicle_info: 0;
}
graphics {
purchase: spriteset_purchase_SPV2000; //Purchase menu sprite
additional_text: return string(STR_SPV2000_Desc); //Additional text shown in purchase list
purchase_cargo_capacity: spriteset_purchase_SPV2000;
length: 8;
default: getbits(extra_callback_info1, 0, 8);
}
}
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Another guy which learns NML
ok, i didn't quite understand what you meant to do, but try something like this:
Code: Select all
switch(FEAT_TRAINS, SELF, guiswitch, getbits(extra_callback_info1, 0, 8)) {
0x00: defaultsprite;
0x10: guisprite1;
0x11: guisprite2;
...
}
...
item{
...
graphics {
...
default: guiswitch;
}
}
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
Oh, thanksEddi wrote:ok, i didn't quite understand what you meant to do, but try something like this:
Code: Select all
switch(FEAT_TRAINS, SELF, guiswitch, getbits(extra_callback_info1, 0, 8)) { 0x00: defaultsprite; 0x10: guisprite1; 0x11: guisprite2; ... } ... item{ ... graphics { ... default: guiswitch; } }
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Another guy which learns NML
So, I created code, but nmlc says what 1 sprite is orphaned, which and why?
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Another guy which learns NML
Does your sprite file has 9 sprites (8 out of depot and 1 as purchase icon) ?Tony Pixel wrote:So, I created code, but nmlc says what 1 sprite is orphaned, which and why?
-
- Route Supervisor
- Posts: 459
- Joined: 14 Oct 2017 11:06
- Location: Ukraine
Re: Many NML questions
Yes
Sprite artist and NewGRF developer, coding in NML. My projects:
NewGRFs: Not Enough Subways Set | North American Passenger Railroads | Elevated Subway Bridge | Tony Pixel's Subway Equipment Set (frozen)
Screenshots: New York City Subway Episodes
Re: Many NML questions
Did you place the sprites correctly in the file (8px between each view) ?
Re: Many NML questions
A sprite being orphaned is not something to worry about: it's normal to get these.
Who is online
Users browsing this forum: No registered users and 8 guests