v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Template talk:RawToTable

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Food Source

I'm not sure how to generate whether or not a creature is a food source..
Going through the creature tokens, these are some clues I found:
Definitely a food source: [FISHITEM] / [MILKABLE] (in some sense a food source)
Disqualifiers: [ITEMCORPSE] / [FANCIFUL] / [NOMEAT] / [NOT_BUTCHERABLE] / [SMALL_REMAINS] --dUMBELLS 18:57, 10 April 2011 (UTC)

Some more disqualifiers for Dwarves would be [INTELLIGENT] and [CAN_LEARN] (and [SLOW_LEARNER]), and likely also [CAN_SPEAK]. --Quietust 19:01, 10 April 2011 (UTC)
This is what I've come up with, but it is in need of iterating,
 {{#switch:Y
 |{{#if:{{#df_tagentry:{{{1}}}|ITEMCORPSE||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|FANCIFUL||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|NOMEAT||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|NOT_BUTCHERABLE||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|SMALL_REMAINS||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|INTELLIGENT||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|CAN_LEARN||1}}|N|Y}}={{Cgr|N}}
 |{{#if:{{#df_tagentry:{{{1}}}|CAN_SPEAK||1}}|N|Y}}={{Cgr|N}}
 |#default={{#if:{{#if:{{#df_tagentry:{{{1}}}|FISHITEM||1}}||NONEMPTY}}{{#if:{{#df_tagentry:{{{1}}}|MILKABLE||1}}||NONEMPTY}}|{{Cgr|Y}}|N/A}}
 }} 
--dUMBELLS 20:09, 10 April 2011 (UTC)
That seems to be working, actually. Good stuff. --dUMBELLS 20:28, 10 April 2011 (UTC)
I'm not sure that FANCIFUL should prevent a creature from providing food - dragons, yetis, sasquatches, hydras, and rocs are all fanciful, and I'm pretty sure they're all butcherable. --Quietust 02:10, 11 April 2011 (UTC)
Also, if you want to check for the presence of a tag, use {{#df_tag:raw data|tag name}} - if it matches it'll return 1, otherwise it'll return a blank string. If you haven't already read the documentation on my user page, you are highly encouraged to do so. --Quietust 02:13, 11 April 2011 (UTC)