Template:GetLevelRange: Difference between revisions
From HorizonXI Wiki
mNo edit summary |
(added check if input is an integer to return unkown if not) |
||
Line 1: | Line 1: | ||
<includeonly><onlyinclude>{{#ifexpr:{{{1 | <includeonly><onlyinclude>{{#if:{{{1|}}}|{{#iferror:{{#expr:{{{1}}}}}|Unknown|{{#ifexpr:{{{1}}}<=10|1-10|<!-- | ||
-->{{#expr:trunc(({{{1|}}}-1)/10)}}1-{{#expr:1+(trunc(({{{1|}}}-1)/10))}}0<!-- | -->{{#expr:trunc(({{{1|}}}-1)/10)}}1-{{#expr:1+(trunc(({{{1|}}}-1)/10))}}0<!-- | ||
-->}}</onlyinclude></includeonly> | -->}}<!-- | ||
-->}}<!-- | |||
-->|Unknown}}</onlyinclude></includeonly> | |||
==Usage== | ==Usage== | ||
Line 21: | Line 23: | ||
<pre>{{GetLevelRange|106}}</pre> | <pre>{{GetLevelRange|106}}</pre> | ||
{{GetLevelRange|106}} | {{GetLevelRange|106}} | ||
Works for any integer number | |||
<pre>{{GetLevelRange|142}}</pre> | |||
{{GetLevelRange|142}} | |||
Returns ''Unknown'' if the input is not an integer... | |||
<pre>{{GetLevelRange|foo}}</pre> | |||
{{GetLevelRange|foo}} | |||
...or the parameter is left empty... | |||
<pre>{{GetLevelRange|}}</pre> | |||
{{GetLevelRange|}} | |||
...or left out | |||
<pre>{{GetLevelRange}}</pre> | |||
{{GetLevelRange}} |
Revision as of 11:19, 6 November 2023
Usage
Takes a number as argument and returns the 10s level range it belongs to.
{{GetLevelRange|15}}
11-20
{{GetLevelRange|4}}
1-10
{{GetLevelRange|50}}
41-50
{{GetLevelRange|88}}
81-90
{{GetLevelRange|106}}
101-110
Works for any integer number
{{GetLevelRange|142}}
141-150
Returns Unknown if the input is not an integer...
{{GetLevelRange|foo}}
Unknown
...or the parameter is left empty...
{{GetLevelRange|}}
Unknown
...or left out
{{GetLevelRange}}
Unknown