Template talk:EnemySpecial: Difference between revisions
(Created page with "thinking about if there's an easy way to make a change to this template such that values below 0 (e.g. -7% or whatever) return 0% and values above 100% (e.g. 126% or whatever) return 100% so values just look cleaner in general on enemy pages but I think it's a loooooot of work on replacing/modifying already-long #expression statements and shit soooooooo idkkkkkk ~~~~") |
No edit summary |
||
| Line 1: | Line 1: | ||
==not showing >100 and <0 percents== | |||
thinking about if there's an easy way to make a change to this template such that values below 0 (e.g. -7% or whatever) return 0% and values above 100% (e.g. 126% or whatever) return 100% so values just look cleaner in general on enemy pages but I think it's a loooooot of work on replacing/modifying already-long #expression statements and shit soooooooo idkkkkkk - [[User:Sundark|Sundark]] ([[User talk:Sundark|talk]]) 22:03, 20 June 2026 (UTC) | thinking about if there's an easy way to make a change to this template such that values below 0 (e.g. -7% or whatever) return 0% and values above 100% (e.g. 126% or whatever) return 100% so values just look cleaner in general on enemy pages but I think it's a loooooot of work on replacing/modifying already-long #expression statements and shit soooooooo idkkkkkk - [[User:Sundark|Sundark]] ([[User talk:Sundark|talk]]) 22:03, 20 June 2026 (UTC) | ||
===Proof of concept for above=== | |||
figured it out I think but it's a loooooooot of work to fully implement, here is example code | |||
<pre> | |||
|[[Arrest]] | |||
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}% | |||
|colspan="2"| {{#switch: {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}} | |||
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 | {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 | {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}} | |||
</pre> | |||
kinda hard to explain but here's my best attempt (lines broken, my comments after "//"): | |||
<pre> | |||
|[[Arrest]] | |||
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}% // this is for non-V50X values, should probably have the same thing but I doubt it'll be as relevant | |||
|colspan="2"| {{#switch: {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}} // setting up a switch on the actual function value | |||
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 // switch finds the function value and then evaluates if that same function resolves to >100, if so, print 100 | |||
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 // if not, switch finds function value and then evaluates if resolves to <0, if so, print 0 | |||
| {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}} // if not, switch evaluates and prints function value | |||
</pre> | |||
===BUT WAIT=== | |||
i might be stupid i think i don't actually need a switch and can just use nesting/recursive "#ifexpr" conditionals so I'll try that here | |||
<pre> | |||
|[[Arrest]] | |||
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}% // still the same shit as above | |||
|colspan="2"| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 | {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 | {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}} | |||
</pre> | |||
YEP OK this looks like it works and probably better for it, i worry about switches sometimes going too hard and crashing (not like enemy pages aren't fucked up rn anyway hehe hoo hoo whateverrr) | |||
this form, instead of being switch-based, is just "evaluate expression -> greater than 100? print 100 -> not greater than 100? -> evaluate expression -> less than 0? print 0 -> not less than 0? -> evaluate expression -> print evaluation" which is what I wanted, nice | |||
soooo still a pissload of work to carry this through all five-hundred and seventy-fuckin-six individual expression lines this godforsaken template USES, but I think I can make a streamlined process to do it | |||
HAHA JUST A LITTLE GLIMPSE INTO MY DARK TWISTED PSYCHE - [[User:Sundark|Sundark]] ([[User talk:Sundark|talk]]) 02:01, 3 July 2026 (UTC) | |||
Revision as of 02:01, 3 July 2026
not showing >100 and <0 percents
thinking about if there's an easy way to make a change to this template such that values below 0 (e.g. -7% or whatever) return 0% and values above 100% (e.g. 126% or whatever) return 100% so values just look cleaner in general on enemy pages but I think it's a loooooot of work on replacing/modifying already-long #expression statements and shit soooooooo idkkkkkk - Sundark (talk) 22:03, 20 June 2026 (UTC)
Proof of concept for above
figured it out I think but it's a loooooooot of work to fully implement, here is example code
|[[Arrest]]
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}%
|colspan="2"| {{#switch: {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 | {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 | {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}}
kinda hard to explain but here's my best attempt (lines broken, my comments after "//"):
|[[Arrest]]
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}% // this is for non-V50X values, should probably have the same thing but I doubt it'll be as relevant
|colspan="2"| {{#switch: {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}} // setting up a switch on the actual function value
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 // switch finds the function value and then evaluates if that same function resolves to >100, if so, print 100
| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 // if not, switch finds function value and then evaluates if resolves to <0, if so, print 0
| {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}} // if not, switch evaluates and prints function value
BUT WAIT
i might be stupid i think i don't actually need a switch and can just use nesting/recursive "#ifexpr" conditionals so I'll try that here
|[[Arrest]]
| {{#expr: 80 - {{nespon|{{{1|}}}}}}}% // still the same shit as above
|colspan="2"| {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) > 100 | 100 | {{#ifexpr: ((80 - {{nespon|{{{1|}}}}}) * 1.5) < 0 | 0 | {{#expr: (80 - {{nespon|{{{1|}}}}}) * 1.5}}}}}}%}}
YEP OK this looks like it works and probably better for it, i worry about switches sometimes going too hard and crashing (not like enemy pages aren't fucked up rn anyway hehe hoo hoo whateverrr)
this form, instead of being switch-based, is just "evaluate expression -> greater than 100? print 100 -> not greater than 100? -> evaluate expression -> less than 0? print 0 -> not less than 0? -> evaluate expression -> print evaluation" which is what I wanted, nice
soooo still a pissload of work to carry this through all five-hundred and seventy-fuckin-six individual expression lines this godforsaken template USES, but I think I can make a streamlined process to do it
HAHA JUST A LITTLE GLIMPSE INTO MY DARK TWISTED PSYCHE - Sundark (talk) 02:01, 3 July 2026 (UTC)