Page 1 of 2

Name based commodities plist

Posted: Sat Feb 28, 2009 10:05 am
by Ark
Is possible to have a name based commodities plist instead of a role based. In other words to have deferent commodities plists for stations with a deferent name that have the same role. The wiki is down from yesterday and I cannot search there for an answer :cry:

Posted: Sat Feb 28, 2009 12:10 pm
by Thargoid
I don't believe it is. Or else it would have made Planetfall a whole lot easier (and better).

Posted: Sat Feb 28, 2009 2:17 pm
by Ark
Too bad :cry:
I had i very nice idea for the constores. Well... "that's life"
Thank you Thargoid

Posted: Sat Feb 28, 2009 2:20 pm
by Kaks
Wait, you can! It might not be exactly what you're after, but each station type can have its own commodities definition, and that includes the name for each of the standard items. Copy the standard commodities.plist to a suitable oxp, and you can use that as a starting point: look for where it says 'food' inside the rock hermit definition, and change it to 'daily rations' and it will say that whenever you're docked to a rock hermit, etc...

This way is of course the brute force approach - it can also be used to override standard prices etc, etc, as well as the name for a particular type of commodity.

I'm sure it was handled slightly differently inside the localised language OXPs. If you've got any of them handy, do dive in! ;)

I've got the horrible feeling the most difficult part would be to come up with synonyms! :)
The first example I had in mind involved gem stones, but I suddenly realised it would just be silly if they suddenly became 'rubies' or 'sapphires' based on which station you were at!

Cheers,

Kaks

edit: stupid typos!

Posted: Sat Feb 28, 2009 2:34 pm
by another_commander
The descriptions.plist can contain keys like this:
"commodity-name food" = "Lays Crisps";
"commodity-name textiles" = "Armani Clothing";
"commodity-name radioactives" = "Gammatron Industrial R/A Sources"; (OK, this one might overflow the available space, but you get my drift)
...
etc.

The downside is that this applies globally, so I doubt you can use it for particular stations.

Posted: Sat Feb 28, 2009 2:37 pm
by Ark
Kaks wrote:
Wait, you can! It might not be exactly what you're after, but cach station type can have its own commodities definition, and that includes the name for each of the standard items. Copy the standard commodities.plist to a suitable oxp, and you can use that as a starting point: look for where it says 'food' inside the rock hermit definition, and change it to 'daily rations' and it will say that whenever you're docked to a rock hermit, etc...

This way is of course the brute force approach (it could be used to override standard prices etc, etc) as well as the name for a particular type of commodity.

I'm sure it was handled slightly differently inside the localised language OXPs. If you've got any of them handy, do dive in! ;)

I've got the horrible feeling the most difficult part would be to come up with synonyms! :)
The first example I had in mind involved gem stones, but I suddenly realised it would just be silly if they suddenly became 'rubies' or 'sapphires' based on which station you were at!

Cheers,

Kaks
I am not sure that I have understood what you are saying kaks :? . My idea was every deferent constore type to have deferent prices for commodities. For example Pi-42s to have cheap computers and machinery but expensive food, Tesccos to have cheap narcotics and slaves bot expensive hi-tech commodities like computers ect. Now there is one commodities plist for all constores since all constores have the same role but deferent name. In what you describe above isn’t truth that the last commodities.plist will overwrite all the previous. If yes i do not belive that it will work.

Posted: Sat Feb 28, 2009 2:45 pm
by Kaks
All is good: each different station can have different names for those items as well as different prices!

You can change names both globally (following a_c's example) and on a station-by-station basis.

Look inside the commodities.plist, and you'll probably see what I mean, honest. If not, do PM me! :)

edit: more muddled explanation:

any commodities.plist can be overridden by other ones, but as long you also have a specific role for each of the constores, that specific role should not be overridden by any other OXPs. And you'll have to have specific roles for each of the constore variants to actually have them specialise in different products!

Posted: Sat Feb 28, 2009 3:07 pm
by Ark
Kaks wrote:
any commodities.plist can be overridden by other ones, but as long you also have a specific role for each of the constores, that specific role should not be overridden by any other OXPs. And you'll have to have specific roles for each of the constore variants to actually have them specialise in different products!
That is the problem
All constores have the same role and this cannot be changed easily since it would affect many things in the functionality of youradhere as well as of oohaul oxp. That is the reason why i wanted to have a per name comodities plist instead of per role

Posted: Sat Feb 28, 2009 3:30 pm
by Kaks
Ark wrote:
That why i wanted to have a per name comodities plist instead of per role
I see. In order to do what you had in mind you will have to change the oohaul and youradhere code.

The changes might not have to be too extensive though (at least in javascript). As long as the generic constore role is still listed in the roles, oohaul can still check if hasRole(generic constore) & work happily with both generic and specific constores (haven't got oohaul though, so I don't really know how many code changes would be needed).

Posted: Sat Feb 28, 2009 3:57 pm
by Ark
Kaks wrote:
As long as the generic constore role is still listed in the roles
Yes :!:
Thank you kaks

Posted: Sat Feb 28, 2009 4:16 pm
by Disembodied
In my one and only (and sadly half-arsed) OXP to date – Free Trade Zones – I managed (I think) to get FTZ commodities lists to vary according to the economy of the planet. The FTZs are supposed to be effectively fencing stolen goods, Agricultural commodities are cheaper in an FTZ in an Industrial world, and vice-versa (because the pirates who supply FTZs are robbing incoming traders). The OXP is pretty limited but I think the commodity pricing variation works reasonably well. To be honest I've forgotten how I did this – well, I've forgotten how a more numerate friend showed me how to do this, with extensive help from various forum members and the wiki – but you're more than welcome to take a look. With the wiki down you can get a copy from here:
http://www.box.net/shared/e43ftmvqmr

Posted: Sat Feb 28, 2009 5:13 pm
by Thargoid
Kaks wrote:
Ark wrote:
That why i wanted to have a per name comodities plist instead of per role
I see. In order to do what you had in mind you will have to change the oohaul and youradhere code.

The changes might not have to be too extensive though (at least in javascript). As long as the generic constore role is still listed in the roles, oohaul can still check if hasRole(generic constore) & work happily with both generic and specific constores (haven't got oohaul though, so I don't really know how many code changes would be needed).
Commodities.plist seems to trigger on the primary role (the one the entity is spawned with). So if the OXP can spawn the station with that unique role then it will work. But if they're spawned with a generic role ("constore" for example) then they will only have one plist between them.

This is the issue I hit with Planetfall, and ended up having to re-think how I spawned the locations to get around it (the way you mention in fact).

Posted: Sat Feb 28, 2009 5:21 pm
by Ark
Thargoid wrote:
Commodities.plist seems to trigger on the primary role (the one the entity is spawned with). So if the OXP can spawn the station with that unique role then it will work. But if they're spawned with a generic role ("constore" for example) then they will only have one plist between them.

This is the issue I hit with Planetfall, and ended up having to re-think how I spawned the locations to get around it (the way you mention in fact).
Confirmed :cry:
Commodities plist does not work with the secondary role I gave to the constores (pi42store, tescoostore ect)It works only with the primary role that is the generic one (constore). :x

Posted: Sat Feb 28, 2009 6:47 pm
by Cmd. Cheyd
Could you reverse the logic? Make Pi42store the primary role, and add the Generic-constore as a secondary and still have the Oo-Haul / YAH scripts trigger?

Posted: Sat Feb 28, 2009 6:51 pm
by Thargoid
The primary role in this case is the one you spawn it with (not necessarily the first one in the shipdata.plist roles entry). So the script will have to be modified to use "pi42store, tescoostore ect" as the spawning role rather than "constore".

That's what I had to do with Planetfall to be able to use commodities.plist within it. That also involved coding the "randomness" of the choice into the script itself rather than just using weighted role settings and letting the system populator worry about it.

But as you say you can then have "constore" as a secondary role for purposes like locating the thing or performing script actions on it (again as PF does).