Page 1 of 2

Some questions from novice coder

Posted: 30 Aug 2006 14:44
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

Posted: 30 Aug 2006 17:19
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.

Posted: 31 Aug 2006 06:54
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

Posted: 31 Aug 2006 08:45
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.)

Posted: 31 Aug 2006 09:43
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) :)

Posted: 31 Aug 2006 11:19
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.

Posted: 31 Aug 2006 11:26
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:

Posted: 31 Aug 2006 12:26
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)

Posted: 31 Aug 2006 12:55
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.

Posted: 31 Aug 2006 13:16
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?

Posted: 31 Aug 2006 16:13
by DaleStan
The operative word there is "concept", I'm afraid.

Posted: 31 Aug 2006 20:32
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.

Posted: 01 Sep 2006 04:29
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.

Posted: 01 Sep 2006 05:31
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.

Posted: 01 Sep 2006 07:45
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.

Posted: 01 Sep 2006 07:47
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?

Posted: 01 Sep 2006 08:09
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

Posted: 01 Sep 2006 08:31
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...

Posted: 01 Sep 2006 08:40
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

Posted: 01 Sep 2006 09:27
by WWTBAM
and ukrs