Difference between revisions of "User:Sub4rctic/Any"

From TerraFirmaCraft Plus Wiki
Jump to: navigation, search
Line 25: Line 25:
  
 
{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX,{{#explode:{{{1}}}|,|1}}}}|<|PREFIX}}
 
{{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|SUFFIX,{{#explode:{{{1}}}|,|1}}}}|<|PREFIX}}
after the suffix add a comma and add param 1 string after comma
+
after the suffix add a comma and add param 1 string after comma. Problem: leaves a comma even when there is no ",#" after item name.
 +
 
 +
{{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }}
 +
if syntax
 +
 
 +
{{#if: {{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}
 +
if param 1 string after comma delimiter is not empty, return ", string", and if it is, return nothing
 +
 
 +
{{#replace:
 +
{{#replace:
 +
  {{User:Sub4rctic/Woods}}
 +
  |>
 +
  |SUFFIX
 +
  {{#if:
 +
    {{#explode:{{{1}}}|,|1}}
 +
    |,{{#explode:{{{1}}}|,|1}}
 +
    |
 +
  }}
 +
}}
 +
|<
 +
|PREFIX
 +
}}
 +
 
 +
so if param 1 has a comma then number, a comma and the number will be placed after SUFFIX. If not, then nothing will be placed after SUFFIX
  
 
{{#switch: comparison string
 
{{#switch: comparison string
Line 40: Line 63:
 
{{#switch: {{#explode:{{{1}}}|,|0}}
 
{{#switch: {{#explode:{{{1}}}|,|0}}
 
  | #default = Item not found
 
  | #default = Item not found
  | Barrel = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|),{{#explode:{{{1}}}|,|1}}}}|<|{{#explode:{{{1}}}|,|0}}<nowiki/> <nowiki/>(}}
+
  | Barrel = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|){{#if:{{#explode:{{{1}}}|,|1}}|,{{#explode:{{{1}}}|,|1}}|}}}}|<|{{#explode:{{{1}}}|,|0}}<nowiki/> <nowiki/>(}}
 
  | Chest = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|)}}|<|{{{1}}}<nowiki/> <nowiki/>(}}
 
  | Chest = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|)}}|<|{{{1}}}<nowiki/> <nowiki/>(}}
 
  | Chopped Log = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|)}}|<|{{{1}}}<nowiki/> <nowiki/>(}}
 
  | Chopped Log = {{#replace:{{#replace:{{User:Sub4rctic/Woods}}|>|)}}|<|{{{1}}}<nowiki/> <nowiki/>(}}

Revision as of 05:22, 7 October 2019


Item not found