FHX Wiki:Sandbox: Difference between revisions
No edit summary |
No edit summary |
||
Line 32: | Line 32: | ||
== == | == == | ||
Objective: Write a string function that can compare the number from a category title with the level range in a template. eg. Level 5 monsters category added to Level 1-5 monsters and Level 5-10 monsters category. Should also work for crafting sheets and equipment. Should also account for level range like "51+" so all pages with a level 51 or higher are added to that group category. Template should include something like an if/then list that looks for keywords in the category title (eg. "Level 5 monsters" returns "monsters", iterate range check using the monster level group categories). | Objective: Write a string function that can compare the number from a category title with the level range in a template. eg. Level 5 monsters category added to Level 1-5 monsters and Level 5-10 monsters category. Should also work for crafting sheets and equipment. Should also account for level range like "51+" so all pages with a level 51 or higher are added to that group category. Template should include something like an if/then list that looks for keywords in the category title (eg. "Level 5 monsters" returns "monsters", iterate range check using the monster level group categories). | ||
Use this to build a template to add to category pages: | Use this to build a template to add to category pages: | ||
<pre>{{#ifexpr:{{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|1}} <= {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} and {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} <= {{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|-1}}|Add category|Do nothing}} | <pre>{{#ifexpr:{{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|1}} <= {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} and {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} <= {{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|-1}}|Add category|Do nothing}} | ||
</pre> | </pre> | ||
Check: {{#ifexpr:{{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|Level 1-5 monsters|" "|2}}|+| }}}}|-|1}} <= {{String split|Level 5 monsters|" "|2}} and {{String split|Level 5 monsters|" "|2}} <= {{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|Level 1-5 monsters|" "|2}}|+| }}}}|-|-1}}|Add category|Do nothing}} | |||
Category group check: | |||
<pre>{{#switch:{{string split|{{#titleparts:{{PAGENAME}}}}|" "|3}} | |||
|monsters={{#switch:{{{1}}} | |||
|1=Level 26-30 monsters | |||
|2=Level 31-40 monsters | |||
|3=Level 41-50 monsters | |||
}} | |||
|crafting={{#switch:{{{1}}} | |||
|1=Level 1-5 crafting sheets | |||
|2=Level 6-10 crafting sheets | |||
|3=Level 26-30 crafting sheets | |||
|4=Level 31-35 crafting sheets | |||
|5=Level 36-40 crafting sheets | |||
|6=Level 36-45 crafting sheets | |||
}} | |||
}} | |||
</pre> | |||
{{#switch:{{string split|Level 1 monsters|" "|3}} | |||
|monsters={{#switch:1 | |||
|1=Level 26-30 monsters | |||
|2=Level 31-40 monsters | |||
|3=Level 41-50 monsters | |||
}} | |||
|crafting={{#switch:1 | |||
|1=Level 1-5 crafting sheets | |||
|2=Level 6-10 crafting sheets | |||
|3=Level 26-30 crafting sheets | |||
|4=Level 31-35 crafting sheets | |||
|5=Level 36-40 crafting sheets | |||
|6=Level 36-45 crafting sheets | |||
}} | |||
}} | |||
{{# | {{#switch:{{string split|Level 1 crafting sheets|" "|3}} | ||
|monsters={{#switch:1 | |||
|1=Level 26-30 monsters | |||
|2=Level 31-40 monsters | |||
|3=Level 41-50 monsters | |||
}} | |||
|crafting={{#switch:1 | |||
|1=Level 1-5 crafting sheets | |||
|2=Level 6-10 crafting sheets | |||
|3=Level 26-30 crafting sheets | |||
|4=Level 31-35 crafting sheets | |||
|5=Level 36-40 crafting sheets | |||
|6=Level 36-45 crafting sheets | |||
}} | |||
}} | |||
{{String split |This is a piece of text to be split |" "| 4}} | {{String split |This is a piece of text to be split |" "| 4}} | ||
<!--{{#mapsdoc:leaflet|parameters=all}}--> | <!--{{#mapsdoc:leaflet|parameters=all}}--> |
Revision as of 14:19, 19 September 2024
FHX Wiki public sandbox |
---|
This is the FHX Wiki sandbox. You can test out the wiki code etc. here. Please be aware that your changes can be overwritten and the sandbox will be blanked from time to time, so don't put anything too important here! When using this sandbox please follow these simple rules:
Happy testing! |
Name | Level | Race | Boss | Drops | Location {{#for_external_table: | |
---|---|---|---|---|---|---|
{{{Name}}} | {{{Level}}} | {{{Race}}} | {{{Unique mob (boss)}}} | {{{Manufacture lvl, (Drops sheets)}}}, {{{Drops mats}}}, {{{Drops item lvl}}} | {{{V1 location}}}, {{{V3 location}}} | format=json
}} |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Objective: Write a string function that can compare the number from a category title with the level range in a template. eg. Level 5 monsters category added to Level 1-5 monsters and Level 5-10 monsters category. Should also work for crafting sheets and equipment. Should also account for level range like "51+" so all pages with a level 51 or higher are added to that group category. Template should include something like an if/then list that looks for keywords in the category title (eg. "Level 5 monsters" returns "monsters", iterate range check using the monster level group categories).
Use this to build a template to add to category pages:
{{#ifexpr:{{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|1}} <= {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} and {{String split|{{#titleparts:{{PAGENAME}}}}|" "|2}} <= {{String split|{{#invoke:String2 |trim |{{#invoke:String |replace |{{String split|CATEGORYGROUPHERE|" "|2}}|+| }}}}|-|-1}}|Add category|Do nothing}}
Check: Add category
Category group check:
{{#switch:{{string split|{{#titleparts:{{PAGENAME}}}}|" "|3}} |monsters={{#switch:{{{1}}} |1=Level 26-30 monsters |2=Level 31-40 monsters |3=Level 41-50 monsters }} |crafting={{#switch:{{{1}}} |1=Level 1-5 crafting sheets |2=Level 6-10 crafting sheets |3=Level 26-30 crafting sheets |4=Level 31-35 crafting sheets |5=Level 36-40 crafting sheets |6=Level 36-45 crafting sheets }} }}
Level 26-30 monsters
Level 1-5 crafting sheets
piece