Action0, need help, coding price

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

Post Reply
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Action0, need help, coding price

Post by Bernhard »

hello,
need help. Want to code the price of my train-engine.
I thougt this must work, anyway...

13 * 31 00 00 09 01 16 00 42 0E 09 3C 00 0B 90 00 14 28 15 00 16 14 19 08 12 FD 0D 01 0E 3C 4C 00 00

price is now $ 281.250.- but i need a price of $ 10.000.
How do i do that??
Last edited by Bernhard on 11 Jan 2005 07:11, edited 1 time in total.
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

You don't code the price in absolute dollars. I believe the price is expressed in British pounds, date 1921. Thereafter it is adjusted by the inflation set in the individual game settings.
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
User avatar
Oracle
Tycoon
Tycoon
Posts: 2138
Joined: 22 May 2003 09:59

Post by Oracle »

No, price is actually set by "Cost factor", which is therefore a factor rather than an absolute value. I did do some research some time ago into prices and put the running costs on the Wiki but for some reason I never put build costs on there. This is what I found, with cost factor on the left and price on the right (all prices 1920, pre-inflation, US dollars, vary with difficulty level):

Code: Select all

Easy:
01 $  2342
10 $ 37500
20 $ 75000
80 $300000
A0 $375000
FF $597656

Medium:
01 $  3124
10 $ 50000
20 $100000
80 $400000
A0 $500000
FF $796874

Hard:
01 $  3514
10 $ 56250
20 $112500
80 $450000
A0 $562500
FF $896484
The cost factor is a linear scaling of the price so, to approximate, do price divided by $3124 and convert to hex to get a reasonable value of cost in Medium difficulty.
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Note that the dbset xl modifies the base costs (using a new action 0 type), so if you load your train with the db set xl active, the prices will probably be much higher than you want/expect.

(For testing, it's always best to deactivate all other graphics anyway to eliminate this kind of interference.)
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Post by Bernhard »

@ Oracle... thanx. i had read your explanations in the wiki, they are good. But i didn' understood why it doesn't work as i thought. Perhaps is the dbset the reason, as Patchman said.

@ Patchman... thanx too. Do you have a idea how i could change that back? I need a price of max. 20.000 DEM in 1930 for my VT133 ( http://ttdgraphics.cjb.net/graphid.php?id=98 ). It was a very cheap railbus.

@ krtaylor, thanks to you too. What currency is the base is not so importent. If i have the way to code, i can figure out. (is that right for try until it is right?)
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

Bernhard wrote:@ Patchman... thanx too. Do you have a idea how i could change that back? I need a price of max. 20.000 DEM in 1930 for my VT133 ( http://ttdgraphics.cjb.net/graphid.php?id=98 ). It was a very cheap railbus.
Well, empty out your newgrfw.cfg file and only leave your test grf in there. Then try again.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Post by Bernhard »

Oracle wrote:The cost factor is a linear scaling of the price so, to approximate, do price divided by $3124 and convert to hex to get a reasonable value of cost in Medium difficulty.
sorry, had not seen your last sentence. Will try that this evening!
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Re: Action0, need help, coding price

Post by Bernhard »

if i had understood the wiki right, this is the part where the costs are defined: 0D 01 0E 3C 4C 00 00

but it doesn't work.

With DB-Set active the price is 580.000DEM, without the price is 250.000DEM.

and it is regardless of which values i add. 0D FF 0E 3C 4C 00 00 will have the same resulat as 0D 00 0E 3C 4C 00 00

is it possible that the price comes from the train-id?

i've coded the train to replace id 16................

ok i will try............
User avatar
cornelius
Director
Director
Posts: 519
Joined: 04 Jan 2004 22:11

Re: Action0, need help, coding price

Post by cornelius »

Bernhard wrote:if i had understood the wiki right, this is the part where the costs are defined: 0D 01 0E 3C 4C 00 00

but it doesn't work.

With DB-Set active the price is 580.000DEM, without the price is 250.000DEM.

and it is regardless of which values i add. 0D FF 0E 3C 4C 00 00 will have the same resulat as 0D 00 0E 3C 4C 00 00

is it possible that the price comes from the train-id?

i've coded the train to replace id 16................

ok i will try............
Properties 0d and 0e are for running cost (how much the thing costs to maintain). To set the purchase price you need to use property 17 - this is the 'cost factor' that Oracle mentioned.
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Post by Bernhard »

ok, my fault, will try ...........

thx cornelius !
User avatar
Siema
Traffic Manager
Traffic Manager
Posts: 176
Joined: 24 Oct 2004 23:36
Location: Warsaw, Poland
Contact:

Post by Siema »

I don't want to make new topic to don't make mess and write my problem here. I'm begginer in coding and need some help. I spent half night studing wiki graphics specs and other sets but i don't know where is the problem:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4  0E 00 00 00
    1 * 24 08 06 4D 53 01 01 50 4B 50 20 73 65 74 00 28 63 29 20 53 69 65 6D 61 00
    2 * 4  01 00 01 08
    3 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 16 16 16 21 7 -3 -14
    4 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 26 16 16 15 20 -9 -7
    5 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 49 16 16 11 29 -13 -6
    6 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 81 16 16 15 20 -9 -7
    7 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 104 16 01 21 07 -3 -6
    8 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 114 16 09 15 20 -10 -8
    9 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 137 16 01 11 29 -15 -6
   10 C:\Documents and Settings\Maciej\Pulpit\pkp set\gotowe grafiki PCX\sp32w.pcx 169 16 09 15 20 -10 -8
   11 * 9  02 00 00 01 01 00 00 00 00
   12 * 7  03 00 01 02 00 00 00
   13 * 10 04 00 1F 01 02 53 50 33 32 00
   14 * 28 00 00 0A 01 02 00 56 47 02 00 03 25 04 50 06 07 09 64 00 0B FA 04 19 08 22 20 12 FD
Everything is ok. exept that that I see only 4 from 8 sprites of my loco in game.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

The NFO looks fine. Can you post the GRF?
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
Siema
Traffic Manager
Traffic Manager
Posts: 176
Joined: 24 Oct 2004 23:36
Location: Warsaw, Poland
Contact:

Post by Siema »

Here is my grf. And also newgrf.cfg. when i test this loco i have all grfs turned off, exept all that apears with blue flag in gamea, and of course this loco.
Attachments
newgrfw.cfg
(1.07 KiB) Downloaded 81 times
sp32w.grf
(1.86 KiB) Downloaded 67 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

OK, I found it, and it is in the NFO. A compression (the third number after the file name) of 16 is apparently not valid. (The wiki is <sarcasm>oh, so helpful</sarcasm> here.) I always use 01.
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
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

DaleStan wrote:OK, I found it, and it is in the NFO. A compression (the third number after the file name) of 16 is apparently not valid. (The wiki is <sarcasm>oh, so helpful</sarcasm> here.) I always use 01.
I don't know much about that number either, but i tried reading the grfcodec source to see what it might do; first of all it is actualy a bitmask. but afaict only two bits are relevant, bit 1 (0x02) and bit 3 (0x08), but looking at the ttd grf files bit 0 also is always set. So the only relevant values for this field are 01, 03, 09 (and 0B?). (And yes, this field must be written in hex...)
According to the grfcodec source, bit 1 has something to do with compression, and bit 3 something with transparency...
User avatar
Siema
Traffic Manager
Traffic Manager
Posts: 176
Joined: 24 Oct 2004 23:36
Location: Warsaw, Poland
Contact:

Post by Siema »

thanks a lot for this. it was 16 because I have used nfoeditor to calibrate vehicle position and it changed the values.

BTW as a begginer I want to know some things too:

1.When I want to code next vehicle in the same nfo file I just must repeat this construction (exept entry 0) with adequate values?

2.Does first entry (entry 0) have any other meaning or it just counts number of entrys?

Thanx in advance.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

1) Repeat sprites 2-14 as necessary. Do not duplicate the action 8.
2) Sprite 0 has no meaning beyond being a count of the sprites in the file.

It is possible to interlace the data to some extent, so you have only a few action 0s, two action 1s (one for 4-sprite vehicles and one for 8-sprite vehicles), and one action 4, but this makes modifications and debugging incredibly hard.
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
Siema
Traffic Manager
Traffic Manager
Posts: 176
Joined: 24 Oct 2004 23:36
Location: Warsaw, Poland
Contact:

Post by Siema »

thanx again. it was very instructive lesson .... for beginner :)
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot] and 24 guests