Some questions from novice coder

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

U-rainian
Engineer
Engineer
Posts: 8
Joined: 30 Aug 2006 09:58
Location: Depot

Some questions from novice coder

Post by U-rainian »

Hi everyone.
I'm start coding recently and encounter some difficulties.
And will be glad if anyone help me :)

Well. How can I...
- Define non transportable cargo, i.e. cargo, that can be produced but can not be transported. Like an electricity.
- Get information about nearest industry by ID. Like a var 64 in Variational Action 2 for Industries, but not a distance but other infos - produced cargo, owner etc.
- Define variational graphics for sprites, which not currently included in Action 2 feature field. I mean chain Action1 - Action2- Action3 for trees, for example.


Yeah, its not all but most interesting
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

1) You can't. And don't. Cargo can only be measured in litres or tons, and neither makes sense for electricity.

2) You can't. What information, exactly (meaning no "etc."), do you need, and why? (A good answer to the latter question is not required, but will improve the chance of getting the answer to the former implemented)

3) You can't. Maybe it will be possible someday, but don't hold your breath; you're not the first to request it.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
U-rainian
Engineer
Engineer
Posts: 8
Joined: 30 Aug 2006 09:58
Location: Depot

Post by U-rainian »

Ok. Thank u for attention.

1) Hmm... Let see - Action 0 - Properties 14 for industries- Minimal amount of cargo distributed, allow to specify amount of cargo that must be exceeded to distribute to the station. If I might specify this amount as infinity - I can make production of this industry untransportable :) No?
But now I can't :(. May be I should ask this in suggestion topic?

2) Most intresting - amount of processed feedstock. For example - production of Power Station depend on production of nearest Power Stations

3) It is a pity
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

1) The limit for industry prop 14 is 255, which is not particularly close to infinity. And even if you could specify a larger number, doing things like that is likely to make players upset when they build a train to move the produced cargos, but the cargo is never released from the industry.

2) Ignoring for the moment the fact that Power Stations don't produce anything, which variables? (eg "variables 40..42", "variable 9E", &c.)
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
U-rainian
Engineer
Engineer
Posts: 8
Joined: 30 Aug 2006 09:58
Location: Depot

Post by U-rainian »

1) Ok. Let it be unimplementable :)
2) var 40..42 of nearest industry.
BTW, 9E - its 80+1E - "Amounts of cargo produced last month"?

And another question

4) Let I had 2 grf files.
In first i had string:

Code: Select all

 00 0A 04 01 01 08 01 09 01 17 03 18 03
How can I override this implementation of Power Station in second grf? Code like

Code: Select all

00 0A 02 01 01 08 01 09 01
or
00 0A 02 01 01 08 FF 09 01
make 2 different kinds of Power stations (from both grfs) :)
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

DaleStan wrote:Cargo can only be measured in litres or tons
Could've fooled me. I'm sure I've used other units before.
User avatar
m3henry
Tycoon
Tycoon
Posts: 1985
Joined: 15 Feb 2006 12:00
Location: Hampshire

Post by m3henry »

PikkaBird wrote:
DaleStan wrote:Cargo can only be measured in litres or tons
Could've fooled me. I'm sure I've used other units before.
yeah like crates of Stuff :lol:
The occasional look back at your past can teach you a great many things...
User avatar
uzurpator
Tycoon
Tycoon
Posts: 2230
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

DaleStan wrote:1) You can't. And don't. Cargo can only be measured in litres or tons, and neither makes sense for electricity.
This actually reminds me of the concept of <null> cargo.

Such cargo would occupy the last ID (thus reserving it) and would have such properties:

1. Not visible in the industry window in "% transported" string
2. Not visible in the vehicle window in "capacity: x" string
3. Always 0% ratings (therefore not transportable)
4. Visible in the refit list only as a custom string

Such cargo would be useful for at least two things:

- Controlling acceptance/processing of industries that do not produce anything (like Powerstations)
- Manual refitting of vehicles that have no capacity - to for example achieve recoloring/livering of the vehicle (as Rai suggested in the other forum)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

DaleStan wrote:Cargo can only be measured in litres or tons
And, believe it or not, I have actually played TTD in the past week.

I'm not quite sure where the brane was on that one.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
U-rainian
Engineer
Engineer
Posts: 8
Joined: 30 Aug 2006 09:58
Location: Depot

Post by U-rainian »

uzurpator wrote:
DaleStan wrote:1) You can't. And don't. Cargo can only be measured in litres or tons, and neither makes sense for electricity.
This actually reminds me of the concept of <null> cargo.

Such cargo would occupy the last ID (thus reserving it) and would have such properties:

1. Not visible in the industry window in "% transported" string
2. Not visible in the vehicle window in "capacity: x" string
3. Always 0% ratings (therefore not transportable)
4. Visible in the refit list only as a custom string

Such cargo would be useful for at least two things:

- Controlling acceptance/processing of industries that do not produce anything (like Powerstations)
- Manual refitting of vehicles that have no capacity - to for example achieve recoloring/livering of the vehicle (as Rai suggested in the other forum)
Bingo! :)
But how can I do this?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

The operative word there is "concept", I'm afraid.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Dave
Moderator
Moderator
Posts: 17249
Joined: 26 Dec 2005 20:19
Location: North London

Post by Dave »

Well... Toyland? 90 bubbles?

As for normality :wink:

Bags of valuables...

Crates of goods...

Items of livestock...

Litres of *liquid*

Tons of *solid*

And of course... Crates of stuff -

worley.grf !!!

Sorry DaleStan... The need of the general public to rub it in when a respected and well-known member of a community gets it wrong is in full force here :D.

I'll stop now.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

1: I think 32 slots is still too few; it wouldn't make sense to start wasting even one slot for untransportable cargoes, null cargoes and such.

2: From Patch code, it isn't hard to access variables of other industries, but the current var. action 2 syntax doesn't really allow the same for GRFs.

4: You can't override industries defined in other GRFs. Maybe it will be added later, but I'm not sure.

BTW, could you tell us why you'd need these things? For example, I can't see why it would be useful for a power plant to say it produced XXX MWh of electricity last month. You can't transport it anyway, so it's really irrevelant.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
User avatar
uzurpator
Tycoon
Tycoon
Posts: 2230
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

Csaboka wrote:1: I think 32 slots is still too few; it wouldn't make sense to start wasting even one slot for untransportable cargoes, null cargoes and such.
We still fail to see a set that uses all of them...

Besides - <null> cargo would be useful. Unless it is possible to control the amount of coal accepted by a power plant per month without the power plant having an inventory of coal waiting for processing*

Frankly - If I was designing a set that replaces all industries (and as a matter of fact I do just that atm, hint hint TRS :P) I would praise the concept of the <null> cargo.

Altho a custom string for an industry showing how much of <null> was produced (the aforementioned xxx MWh produced last month or xxx Toys sold last month etc) would be a nice touch.

*altho - I haven't yet played with UKRS with new industries (lack of time :( ), but my impression is that once the industry has its inventory full it will not accept any further cargo.
U-rainian
Engineer
Engineer
Posts: 8
Joined: 30 Aug 2006 09:58
Location: Depot

Post by U-rainian »

Csaboka wrote: BTW, could you tell us why you'd need these things?
Of course
I write set, that correct some things in TTD industry (for my own point of view, 0f course :) ). It a little bit like UKRSi, little bit like Alpine :)


1) Untransportable cargo. It need for a control of processing of Power stations, but I already solve this problem (today :) )

2) I just want, than production of... hmm.. "hard" industry (like a Factory) depends on nearest power station productivity. No electricity - no production.

4) Want to make my set compatible with Michael Blunck Alpine Climate.
Last edited by U-rainian on 01 Sep 2006 07:54, edited 1 time in total.
User avatar
Csaboka
Tycoon
Tycoon
Posts: 1202
Joined: 25 Nov 2002 16:30
Location: Tiszavasvári, Hungary
Contact:

Post by Csaboka »

uzurpator wrote:We still fail to see a set that uses all of them...
You mean you haven't heard about ECS?
uzurpator wrote:Besides - <null> cargo would be useful. Unless it is possible to control the amount of coal accepted by a power plant per month without the power plant having an inventory of coal waiting for processing*
I don't understand. You either process cargo instantly, and you can't control how much it processes, or you limit the processing speed, and have some of the input waiting to be processed. How would your system work if the <null> cargo was available?
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

["newcargoes"]
>> I think 32 slots is still too few [...]
> We still fail to see a set that uses all of them...
You mean you haven't heard about ECS?
Adam, there is a first implementation of ECS (Extended Cargo System) by George.

The ECS discussing thread can be found here: http://www.tt-forums.net/viewtopic.php?t=20277

There are a couple of graphical representations of the "vectors" to be found somewhere in that thread or on Georges´ site.

regards
Michael
Image
User avatar
uzurpator
Tycoon
Tycoon
Posts: 2230
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

Csaboka wrote:You mean you haven't heard about ECS?
I heard. Which vehicle set implemets it?
I don't understand. You either process cargo instantly, and you can't control how much it processes, or you limit the processing speed, and have some of the input waiting to be processed. How would your system work if the <null> cargo was available?
If I want an industry that has certain processing capacity (say 1000 units of cargo / month) without any output what do I do?

With output I simply set the processing speed and inventory size for the industry - once the inventory is full there is afair a callback to stop accepting new freight.

Without output there is no inventory and thus no possibility to invoke the callback.

Michael - Yea, I know of ECS, but still there needs to be a support for it in, say, DBXL set...
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

[ECS]

> I heard. Which vehicle set implemets it?

Well, AFAIR George set up a "ECSvehicle .grf" which should (in theory) make train vehicle sets compatible to ECS, o/c without adding any new graphical representations.

> [...] still there needs to be a support for it in, say, DBXL set...

Yes, as has been said many times before, DBXL v0.9 will be fully compatible with ECS and have graphical representations / additional waggons for all of its new cargoes.

Nevertheless, LV4 is already supporting it in full.

regards
Michael
Image
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Post by WWTBAM »

and ukrs
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/
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 17 guests