order = "x[name]-x[otherName]" Meaning?

Place to get help with not working mods / modding interface.
Post Reply
Swadius
Inserter
Inserter
Posts: 31
Joined: Sun Feb 23, 2014 10:54 am
Contact:

order = "x[name]-x[otherName]" Meaning?

Post by Swadius »

What does the order thing do for things like fluids? On the docs it mentions it's like the order of the string, but the string for what? I'm not even sure where to begin testing this to see what does what.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: order = "x[name]-x[otherName]" Meaning?

Post by DRY411S »

Not just fluids either. I'd also like to know how this ordering works.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: order = "x[name]-x[otherName]" Meaning?

Post by DedlySpyder »

There's a great post by Rseding out there on the forums, bug I can't find it atm.

I forgot the names of some of these, but the idea is there. Basically, items are ordered by item-category first, then a sub item-category, then finally by the order string. The order string could just be a single letter and handle it properly, but the full string in the items are just there for more detail

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: order = "x[name]-x[otherName]" Meaning?

Post by daniel34 »

viewtopic.php?f=34&t=24649&p=158419#p158419
Rseding91 wrote:Recipe sort order:
  • if the recipe group IDs are not identical sort by the recipe group IDs
  • if the recipe sub group IDs are not identical: sort by the recipe sub group IDs
  • if the recipe order strings are not identical sort by the recipe order strings
  • else sort by the recipe names
Recipe Group ID sort order:
  • if the recipe group ID order strings are not identical sort by the order strings
  • else sort by the recipe group ID names
Recipe Sub Group ID sort order:
  • if the recipe sub group order strings are not identical sort by the order strings
  • else sort by the recipe sub group ID names
Recipe group IDs are either the group of the recipe sub group or the recipe products sub group group.

Recipe sub group IDs are either manually defined in the prototype or the main recipe products sub group ID.

When I say "sort by" I mean the "<" operator which always ends up being "left string" < "right string" which uses the C++ string comparison: http://en.cppreference.com/w/cpp/algori ... al_compare

Item inventory sort order is applied the same way. When 2 items are identical additional logic is applied to sort them (such as durability, health, blueprint contents) but that's not adjustable through the prototype so that's not really useful in this context.
viewtopic.php?f=25&t=24163&p=152955#p152955
Rseding91 wrote:
DaveMcW wrote:The [tags] are optional, not used by the game, and only meant to help modders get the order right. That plan seems to have backfired. :P
The [tags] thing was extremely confusing of Kovarex to say. They are literal strings - they're compared as such. There's no parsing of the string it's simply C++ std::string < comparison.

So for:

Code: Select all

data.raw["item1"].order = "a-[b]-b[car]"
data.raw["item2"].order = "a-[a]-b[car]"
That will be used in the game via:

Code: Select all

std::string item1.order = "a-[b]-b[car]";
std::string item2.order = "a-[a]-b[car]";

return item1.order < item2.order;
And so the C++ std::string comparison operator says that item1.order is not < item2.order because "a" < "b".


In simple terms: It's pure string alphabetical order comparison. Ignore all the "[...] is ignored" stuff - it's not - it's this: https://en.wikipedia.org/wiki/Lexicographical_order
quick links: log file | graphical issues | wiki

Swadius
Inserter
Inserter
Posts: 31
Joined: Sun Feb 23, 2014 10:54 am
Contact:

Re: order = "x[name]-x[otherName]" Meaning?

Post by Swadius »

Ah thanks, seems like it won't break the game whatever I put in there 8-) .

Post Reply

Return to “Modding help”