Template talk:Body data

From Kerbal Space Program Wiki
Revision as of 20:06, 31 August 2014 by XZise (talk | contribs) (*moved template;)
Jump to: navigation, search

explosions

hi! i'm new to this wiki but i am not new to wikis. i think the system used for this template — which involves tons of subpages and #switches — is a bit unnecessarily overcomplicated. it also has to be updated every time a new datum is entered (rather than just editing the [Body]/Data infobox). i've made a replacement using the #explode string function, which can be viewed in my sandbox. here's the content:

{{#explode:{{#explode:{{msgnw::{{{1|}}}/Data}}|{{{2|}}}=|1}}|||0}}

transclusion works like this:

{{:User:Apollo/sandbox|Moho|orbinc}}
{{:User:Apollo/sandbox|Eve|soi}}

yields:

7
Error: String exceeds 1,000 character limit.

etc. feel free to test it out with any other celestial body/parameter. i just wanted to ask whether this would be preferable before going ahead and implementing it in place of this template. especially since i'm new around here! thanks ~ Apollo [talk] 00:11, 21 August 2013 (CDT)

This looks interesting! Absolutely worth considering. Of course changing this system takes a bit of work, as first the /Data pages should be updated, then this template and then the {{Infobox/Body}} (but that is optional). Although what would be your plan about the math type templates? — xZise [talk] 04:20, 21 August 2013 (CDT)
And also the test values (name == Planetbox) need to handled. I wouldn't use Planetbox/Data as a page, but maybe add an if and switch?
{{#ifeq: {{{1}}}|Planetbox|{{#switch: {{{2}}}
|radius=10000
|…
}}|
{{#explode:{{#explode:{{msgnw::{{{1|}}}/Data}}|{{{2|}}}=|1}}|||0}}
}}
xZise [talk] 04:25, 21 August 2013 (CDT)
I changed the parameters so that they don't get parsed here to see how your code works. I was wondering why the inner explode only had 3 parameters and the outer four, until I noticed that one of the pipes is in fact a HTML entity. — xZise [talk] 10:52, 21 August 2013 (CDT)
oh, yeah i did not realise that the pre tag messed up the html entities. my bad! anyway, implementing this new template in already-existing pages/other templates would probably be a task best handled by a bot. it could probably be done through an elaborate search and replace function. as far as math templates go, my template could easily be integrated in. #expr will simply perform the desired operation with the numbers yielded. on the other hand, it seems that some of the body data, such as name and scale height, are not actually included in the infobox. there are two potential solutions for this:
  • keep BodyData/ScaleHeight et al. and use them as a separate functions from this template
  • include scale height/name/parent/etc. in the infobox — they wouldn't actually have to be displayed in the infobox, nor would the template need to be edited. adding |Parent=[whatever] to each infobox would have no effect on how the box displayed, even though "parent" is not a valid parameter. but, it could still be parsed by the template. this might be a bit over-complicated, and the first solution is probably superior.
of course, this whole thing might be getting a bit over-complicated. maybe for now a better solution is to have my system as a different template? or just not use it at all! ~ Apollo [talk] 11:23, 21 August 2013 (CDT)
Yeah doing this by bot would be the best solution, but I have no idea about bots. Afaik the only bot on this wiki yet is User:RoboJeb and it looks like this particular Jeb has fallen asleep.
Actually scale height is used, but only if the body has an atmosphere, like Eve/Data. I added also all constants except Template:Body data/Name to it, because it is used different. It is used on the Russian and Korean pages with transscribed names for the bodies (see Eve/ru). I would keep Body data/Name, as this uses {{lang}} itself, what isn't supported by your outer explode. Parent is an important parameter too, as it defines if the orbital information is visible or not and it is mentioned below the image as “foo of bar” with bar being the parent. So all subtemplates (at least the non mathematical) are used the infobox.
What I don't understand is your explaination what to do with the math templates, as they already simply calculate (with #expr:) the desired result with the given celestial body and using the other subtemplates. So they should mostly work with the new system: Only the “value retrieval” needs to be updated to your system, as you don't use subtemplates. — xZise [talk] 12:35, 21 August 2013 (CDT