Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sat Mar 23, 2019 2:06 pm

All times are UTC




Post new topic  Reply to topic  [ 1261 posts ]  Go to page Previous 135 36 37 38 3964 Next
Author Message
PostPosted: Wed Oct 02, 2013 6:14 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7301
TadeuszD wrote:
and next merging it using another tools...

it's not that difficult... :p

anyway, you could try this: (untested)
[Edit: possibly cleaner version]


Attachments:
nml_wagonspeedlimits2.diff [462 Bytes]
Downloaded 42 times

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)
Top
   
PostPosted: Fri Oct 04, 2013 2:35 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
I have next questions:
When the callback bitmask_vehicle_info is called? Is it called every time when property bitmask_consist_info is used?
Can I use bitmask_consist_info to determine wagon's parameter? Or this property can be called only from leading engine? Is there any protection against recursive calls?

What I want to do... I have defined the wagon with three cargo subtypes available. I want to decrease wagon's max speed if combination of wagons in the train and their cargo subtype settings fulfills special conditions. It should be independent of other wagon speed limits.

_________________
Image


Top
   
PostPosted: Fri Oct 04, 2013 9:03 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
I found partial answer myself. ;)

TadeuszD wrote:
Can I use bitmask_consist_info to determine wagon's parameter?

Yes, you can. But if you want to calculate bitmask_consist_info for whole train you should use PARENT scope in switch definition. See the example:

Code:
switch(FEAT_TRAINS, PARENT, switch_wagon_speed, hasbit(bitmask_consist_info, VINFO_EXT_PASSENGER_WAGON) ) {
    1: return 160;
    return 125;
}

_________________
Image


Top
   
PostPosted: Fri Oct 04, 2013 9:33 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Wed Dec 20, 2006 1:31 pm
Posts: 978
Location: Aschaffenburg
bitmask_vehicle_info is not called everytime the variable is accessed.

All vehicle callbacks which affect vehicle properties are called when the consist changes and serveral other triggers. The results are then cached, and not updated when the vehicle moves normally.

bitmask_vehicle_info is the first callback which is called. So after a consist is created/changed, the bitmask is computed for all vehicles in the consist. Any properties afterwards can thus refer to bitmask_consist_info. bitmask_vehicle_info otoh cannot refer to any properties that change via callbacks.

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


Top
   
PostPosted: Thu Oct 17, 2013 7:38 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
NMLC r2095 and 5029. Unexpected chars at the begin and end of warning message:
Code:
←[33m nmlc warning: "src\\constr-stages.pnml", line 101: Block 'switch_constr_anim_speed' is not referenced, ignoring.←[0m

_________________
Image


Top
   
PostPosted: Thu Oct 17, 2013 7:44 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7301
looks like escape sequences (colour changes?) to me. use a terminal that understands those :)

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


Top
   
PostPosted: Thu Oct 17, 2013 7:53 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9213
Location: Sol d
Yes, looks like the way we added colour to the warnings is not fool-proof. On terminals which don't understand it, they show up as these weired characters.
http://dev.openttdcoop.org/issues/5411

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Thu Oct 17, 2013 8:40 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
I'm using Windows command line shell... :lol:


And I have next problem. I'm not sure is this the real bug, but the result doesn't match to NML documentation... :roll:
In my house I defined:
Code:
building_flags:             bitmask(HOUSE_FLAG_ANIMATE, HOUSE_FLAG_RANDOM_ANIMATION);

According to NML documentation the extra_callback_info1 argument in anim_next_frame callback should contains 32 random bits. In my opinion it doesn't work. I've checked many combination and extra_callback_info1 is always 0.
For example, this piece of code always returns 4:
Code:
switch(FEAT_HOUSES, SELF, switch_anim_next_frame, STORE_TEMP(4, 1)) {
    return LOAD_TEMP(1);
}

and this piece of code always return 0...:
Code:
switch(FEAT_HOUSES, SELF, switch_anim_next_frame, STORE_TEMP(extra_callback_info1, 1)) {
    return LOAD_TEMP(1);
}

Does this problem corresponds to http://dev.openttdcoop.org/issues/5294 ?

_________________
Image


Top
   
PostPosted: Thu Oct 17, 2013 9:35 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Feb 01, 2011 12:41 pm
Posts: 226
Yes, Windows command prompt doesn't like ANSI escape characters like the colours. You can use a library like Colorama to get coloured console output on Windows. And I think the only code you need to add at the start of your Python program is:

Code:
from colorama import init
init()

and coloured output should work fine.

_________________
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department


Top
   
PostPosted: Fri Oct 18, 2013 1:33 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7301
be aware that due to an oddity in nfo, switches with only a "return" without any other decision targets are a special case, which returns the last accessed variable instead of whatever comes after "return". maybe that spoils your output.

so
Code:
switch(1) {
  return 2;
}
actually returns "1", not "2"

use
Code:
switch(1) {
  0: return 2;
  return 2;
}
instead

TadeuszD wrote:
Does this problem corresponds to http://dev.openttdcoop.org/issues/5294 ?

unlikely

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


Top
   
PostPosted: Fri Oct 18, 2013 7:49 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
Eddi wrote:
be aware that due to an oddity in nfo, switches with only a "return" without any other decision targets are a special case, which returns the last accessed variable instead of whatever comes after "return".

Thanks. Good to know...
But I tested many combination. For example, I expect that code below returns frame #0 with probability 75% (two random bits are tested, random bits should be refreshed every ~7.5 seconds (256 ticks)) but it always returns frame #1:
Code:
property {
building_flags:         bitmask(HOUSE_FLAG_ANIMATE, HOUSE_FLAG_RANDOM_ANIMATION);
refresh_multiplier:     0;
...
}

switch(FEAT_HOUSES, SELF, switch_anim_next_frame, extra_callback_info1 & 0x03 != 0) {
    1: return 0;
    return 1;
}

_________________
Image


Top
   
PostPosted: Sat Nov 02, 2013 11:05 am 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 02, 2005 7:01 am
Posts: 3680
Location: Sydney NSW Antipodea
So I was going to look into resurrecting the NSW Bus Set. I tried using the attached files as a start using NML 2.3.x so as to have TTDP compatibility. The vehicle gets introduced in OpenTTD but not in TTDP. I was told NML 2.x was kept for TTDPatch compatibility. Ignore the errors regarding the sprites not showing up in game as that is not my primary concern unless they are causing TTDP to bork.


Attachments:
NSWGBS.zip [6.02 KiB]
Downloaded 35 times

_________________
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
Top
   
PostPosted: Sat Nov 02, 2013 12:32 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 02, 2005 7:01 am
Posts: 3680
Location: Sydney NSW Antipodea
Here is the NFO equivalent of the NML in the zip in my last post except using a byte-size ID instead of word-size. It also has issues in both OpenTTD and TTDPatch - no vehicle appears in either game with no grfcodec errors or errors from the game.


Attachments:
main.nfo [1012 Bytes]
Downloaded 30 times

_________________
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
Top
   
PostPosted: Sun Nov 24, 2013 5:16 pm 
Offline
Engineer
Engineer

Joined: Fri Dec 28, 2012 7:56 pm
Posts: 27
Location: CZ
Hello, while finishing my second set, strange problem has appeared. In my first set, adding sounds was easy by this part of code:

Code:
switch(FEAT_TRAINS, SELF, sound_169 , extra_callback_info1) {
    SOUND_EVENT_START: return sound("snds/start.wav");
   SOUND_EVENT_TUNNEL: return sound("snds/houkacka.wav");
    return CB_RESULT_NO_SOUND;
}
.
.
.
graphics {
.....
      sound_effect:         sound_169;
    }

Now I have copied the same to my second set and it doesn't make any sound. I have used the same sounds. Can anyone help me? Thank you.


Top
   
PostPosted: Sun Nov 24, 2013 5:34 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Jan 25, 2008 7:32 am
Posts: 973
Location: Gamle Ørnenuten
Is it in a new folder? If it is, did you remember to copy the soundfiles to the new folder?

_________________
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish


Top
   
PostPosted: Sun Nov 24, 2013 5:47 pm 
Offline
Engineer
Engineer

Joined: Fri Dec 28, 2012 7:56 pm
Posts: 27
Location: CZ
Yes, I have copied files to folder of new set. The GRF file is much bigger than before. But it doesn't do any sound in game.


Top
   
PostPosted: Sun Nov 24, 2013 9:36 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7301
two things:

are you sure you modified the vehicle id in the "item" statement after copying)

and if you reuse the same sounds, just put the same switch id there, no need to duplicate the sounds.

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


Top
   
PostPosted: Tue Dec 03, 2013 12:52 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Jan 25, 2008 7:32 am
Posts: 973
Location: Gamle Ørnenuten
So, there is no support for norwegian letters with NML? I get an error when trying to encode with a languagefile containing the norwegian letter 'å'... When I remove the 'å', it encodes fine...

_________________
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish


Top
   
PostPosted: Tue Dec 03, 2013 1:02 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9213
Location: Sol d
Trond wrote:
So, there is no support for norwegian letters with NML? I get an error when trying to encode with a languagefile containing the norwegian letter 'å'... When I remove the 'å', it encodes fine...

There is support for virtually every letter. Required encoding for all text files is UTF-8, you likely use something else; check with your editor settings.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
PostPosted: Tue Dec 03, 2013 1:10 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Fri Jan 25, 2008 7:32 am
Posts: 973
Location: Gamle Ørnenuten
Seems the file I downloaded was "UTF-8 without BOM" or something like that. When I changed it in Notepad++ to UTF-8 it worked fine...

_________________
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1261 posts ]  Go to page Previous 135 36 37 38 3964 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-2019 phpBB Limited

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