Another varpull question

Jump to: navigation, search

Is it possible to create a structure using #varpull that will check and see whether a certain variable exists for a template?

Here is the background: I would like to add pvp power numbers to the wiki. However, pvp power is a late addition to the LotS universe. That means over a thousand instances of the item template have no entry for pvp power.

Here is my conundrum: On list pages, such as Main Hand, all of the data gets yoinked from the item template by #varpull. Unfortunately, if the variable that #varpull wants is missing, #varpull prints a gnarly error message letting you know that the variable is undefined. On pages that list hundreds of items, it means hundreds of error messages. The most simple way to fix this would be to manually add the pvp power variable to a thousand pages. Ugh. I'd prefer to add a pvp power variable only to items that actually have pvp power.

What I'm hoping for: A way to have #varpull act conditionally, either through a modification to #varpull, or through a combination of parser functions. I'd like a solution, any solution, that permits #varpull to act if, and only if, the requested variable exists in the target template. This will avoid a ugly-looking error messages and will allow me to add pvp power without the pain of a thousand edits.

Klaxxin (talk)14:20, 14 December 2012

i will add a silent flag and reply with usage once i do.

Zoycite (talk)08:14, 15 December 2012

ok I have defaulted varpull to be silent on errors, however if you want them to appear add a 4th parameter as "true".

It should be completely silently fail now with no text at all output on errors.


  • Code: {{#varpull: LoH/cards/Moxie|LoH/Card|name}}
  • Result: Moxie
  • Code: {{#varpull: LoH/cards/Moxie|LoH/Card|name|true}}
  • Result: Moxie
  • Code: {{#varpull: LoH/cards/Moxie|LoH/Card|zoycite}}
  • Result:
  • Code: {{#varpull: LoH/cards/Moxie|LoH/Card|zoycite|true}}
  • Result: Unable to locate variable:zoycite in template: LoH/Card
Zoycite (talk)10:41, 15 December 2012

Also for mass article editing if you want me to do something crazy let me know I might be able to get the bot to do it.

Zoycite (talk)10:43, 15 December 2012