Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Sep 21, 2018 5:01 am

All times are UTC




Post new topic  Reply to topic  [ 153 posts ]  Go to page Previous 14 5 6 7 8 Next
Author Message
PostPosted: Thu May 05, 2016 7:00 pm 
Offline
Route Supervisor
Route Supervisor

Joined: Wed Mar 27, 2013 8:58 am
Posts: 402
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.


Top
   
PostPosted: Thu May 05, 2016 7:06 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7121
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.
i think that's done by overriding one of the default recolour maps. but don't ask me which one. (may have side effects)

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.
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)

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Fri Jun 10, 2016 2:23 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
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... :oops:


Top
   
PostPosted: Mon Jun 13, 2016 8:49 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
A strange effect.
I get the population of a town (it's 700) and I get the following results.

Code:
STORE_TEMP((population - 2000) / 2000 , 2),  = 2147428  !!!
STORE_TEMP(population, 3),                   = 700
STORE_TEMP(population - 2000 , 4),           = -1300

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.


Top
   
PostPosted: Mon Jun 13, 2016 5:35 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 978
Location: Aschaffenburg
I think that is a bug in OpenTTD.
Can you please retest using todays nightly (>= r27600). It becomes available in about an hour.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Tue Jun 14, 2016 7:20 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
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.


Top
   
PostPosted: Wed Jun 15, 2016 6:17 pm 
Offline
Chief Executive
Chief Executive
User avatar

Joined: Sat Mar 07, 2009 12:48 pm
Posts: 644
Location: Szeged, Hungary
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.

_________________
Image


Top
   
PostPosted: Wed Jun 15, 2016 8:07 pm 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2648
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.

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.

_________________
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML


Top
   
PostPosted: Thu Jun 16, 2016 8:38 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
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.


Top
   
PostPosted: Thu Jun 16, 2016 4:39 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 978
Location: Aschaffenburg
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.
You can do that via the "colour_mapping" callback:
  • 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)"
  • ...
Of course you can also put various conditional switches inbetween.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Thu Jun 16, 2016 4:44 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 978
Location: Aschaffenburg
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.

IIRC the callback "construction_probabiilty" is also checked in the fund list, so something like:
  • construction_probabiilty
  • switch of "getbits(extra_callback_info2, 0, 8 )"
  • in case of "IND_CREATION_FUND" return 0
  • otherwise return 255

Other checks like "location_check" depend on the industry location, thus do not affect the fund list.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Fri Jun 17, 2016 7:38 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
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.


Top
   
PostPosted: Fri Jun 17, 2016 6:51 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 978
Location: Aschaffenburg
Ah, I see: OpenTTD only disables the buttons, but it always shows all industries in the list.
You cannot change that via NewGRF.

_________________
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁


Top
   
PostPosted: Mon Jun 20, 2016 9:00 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Oct 21, 2005 9:26 am
Posts: 966
Location: Birmingham, England
I guessed as much. Well, I can block player funding of that industry so that's as much as can be done.

Thanks.


Top
   
PostPosted: Fri Sep 08, 2017 12:12 pm 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 35
Location: Slovakia - Bratislava
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!

_________________
Woof !


Top
   
PostPosted: Fri Sep 08, 2017 2:38 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 608
Location: Western Ile-de-France Region
This is done by subcargoes. They are done in 2 steps: define subcargo names, then what the subcargo changes via switches


Top
   
PostPosted: Sat Sep 09, 2017 10:25 am 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 35
Location: Slovakia - Bratislava
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...

Code:
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:
spriteset(KAROSA_C734_3, "gfx/KarosaC734.png") { TMP_KAROSA_C734(29) } 

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?

Code:
        PASS: KAROSA_C734_3;

double setting - not allowed, but how do I set that the sub-cargo will be transporting pass?[/color]

_________________
Woof !


Top
   
PostPosted: Sat Sep 09, 2017 11:10 am 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2648
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


Top
   
PostPosted: Sun Sep 10, 2017 6:54 am 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 608
Location: Western Ile-de-France Region
In this case, the default graphics switch should be sw_C734_graphics, because it will always default to subcargo 0.


Top
   
PostPosted: Tue Sep 12, 2017 10:58 am 
Offline
Engineer
Engineer
User avatar

Joined: Sun Oct 31, 2004 12:43 pm
Posts: 35
Location: Slovakia - Bratislava
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:

Quote:
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 get "nmlc ERROR: "CS_BusSetw2.nml", line 111: Syntax error, unexpected token "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:
cargo_subtype: PRAGA_N_LIVERY_SWITCH;


instead of PASS: PRAGA_N_LIVERY_SWITCH;?

Thank you!

_________________
Woof !


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 153 posts ]  Go to page Previous 14 5 6 7 8 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.