Template talk:SchematicSprite

Max loops?
I think I'm running into a loop maximum of 50 per page, because of my use of #while. Am I correct that if I switch to using #forargs or #fornumargs, I won't hit any page maximums? I think I see how to make that work, using some secondary templates: #replace +s with pipes; when that's plugged into a secondary template call, the template will only see pipes separating parameters and can cycle through them with #fornumargs…. If that works, it might actually make the code easier to follow.

&mdash;Munin295 &middot;  &middot; 06:06, 8 February 2013 (UTC)


 * Yes #forargs or #fornumargs are not counted in the loop PP. –ultradude25 ᐸ Talk Contribs 03:23, 9 February 2013 (UTC)


 * Okay. I couldn't find a way to #replace +s with pipes ( doesn't get expanded until later, I think) so I just called a predefined number of parameters with #exploded pieces of the string. A little extra work for the server handling blank parameters, but it seems to have solved the issue. Thanks!
 * &mdash;Munin295 &middot; Grid_Book_and_Quill.png Grid_Stone_Pickaxe.png &middot; 06:33, 9 February 2013 (UTC)


 * Can you not use &amp;#124;? –ultradude25 ᐸ Talk Contribs 06:49, 9 February 2013 (UTC)


 * I couldn't get either of them to work. The replacement occurs, but it doesn't seem to get the template call to interpret the string as multiple parameters, so maybe they get converted to pipes later? You can see some tests I did at SchematicSprite/sandbox.
 * &mdash;Munin295 &middot; Grid_Book_and_Quill.png Grid_Stone_Pickaxe.png &middot; 08:04, 9 February 2013 (UTC)

Memory limits
I'm starting to hit some memory limits (post-expand include size, a very reasonable limit of 2MB &mdash; who wants a 2MB article? not me).

Currently, with (1 + 3*layers) per sprite, each with extensive CSS properties (especially transforms), a single sprite produces about 1-2KB in markup text. A typical redstone circuits article has hundreds of schematic cells, so it would take 100s of KBs worth of markup to convert the images to tables. That seems excessive for a wiki article.

Getting some classes defined in the main style sheet would only cut the markup about in half, and I don't think that's enough. I think I need to back up and punt.

I decided to use image pieces and transforms because it allowed me to use a much smaller sprite sheet than I originally thought I was going to need. But a sprite sheet ideally only gets downloaded once per session, while the markup needed to use such a sprite sheet needs to be downloaded with every page.

If I go back to my original idea of one large sprite sheet (or multiple smaller ones checked for a valid identifier sequentially), with all the block variations explicitly laid out (e.g., 96 repeater variations, 240! stair variations, etc.) using standard /pos notation, I think I can get it down to about 250 bytes of markup per sprite (and half of that is just the img tag produced by File), which means the tables would add only 10s of KBs of markup to an article (which the current images already do, though probably not quite as much).

Is there any way to get the actual uri of an image, so I can use a background-image property directly on a td tag? That would get me down to about 100 bytes of markup per sprite, I think. But testing it produces an "insecure input" warning:



Thoughts? Reality check?

&mdash;Munin295 &middot;  &middot; 18:57, 10 February 2013 (UTC)


 * Background image url is disabled in wikitext. The only way to use it is in a stylesheet.
 * You should see about removing .schematic-sprite-layer's styling, since .schematic-sprite-box's styling seems to work fine on its own.


 * Creating a test article that uses the template in the sort of way as it would actually be used would be advised. If this is going to be replacing those schematic images, then I think it is highly likely you'll hit PHP's max execution time long before you replace all the images and the page will just not work at all.
 * If you still want to change your styling to a stylesheet, then do it in your user css and when you're finished I'll add it to the site css. –ultradude25 ᐸ Talk Contribs 20:30, 10 February 2013 (UTC)