FANDOM


local p = {}
 
-- text to insert before anything else
local pre = ''
 
-- text to insert after everything else
local post = ''
 
function p.arbitrarySequence(frame)
    -- investigation id
    local id = getId(frame)
    -- sequence of frame IDs, separated by any non-alphanumeric character
    local sequence = getSequence(frame)
 
	return pre .. parseSequenceString(id, sequence) .. post
end
 
function p.collectibleFrames(frame)
    local id = getId(frame)
    local length = getLength(frame)
 
    local frameSequence = ''
    for i=1, length, 1 do
        frameSequence = frameSequence .. imageLink(id, i)
    end
 
    return pre .. frameSequence .. post
end
 
function p.startFrames(frame)
    local id = getId(frame)
    local length = getLength(frame)
 
    local frameSequence = imageLink(id, 'begin')
    for i=1, length, 1 do
        frameSequence = frameSequence .. imageLink(id, 0, frame)
    end
    frameSequence = frameSequence .. imageLink(id, 'end')
 
    return pre .. frameSequence .. post
end
 
function getId(frame)
    if frame.args['id']~=nil then
        return frame.args['id']
    end
    return frame.args[1]
end
 
function getLength(frame)
    if frame.args['length']~=nil then
        return tonumber(frame.args['length'])
    end
    return tonumber(frame.args[2])
end
 
function getSequence(frame)
    if frame.args['sequence']~=nil then
        return frame.args['sequence']
    end
    return frame.args[2]
end
 
function parseSequenceString(id, inSequence)
    local imageSequence = ''
	-- for every ID found in the sequence string, create an image link
	for it in string.gmatch(inSequence, "%w+") do
		imageSequence = imageSequence .. imageLink(id, it)
	end
	return imageSequence
end
 
function imageLink(id,index, frame)
    if tonumber(index) ~= nil and tonumber(index)<10 then
        index = '0' .. index
    end
 
    if index =='00' or index=='empty' then
        return frame:expandTemplate{title = 'Empty investigation frame'} .. ' '
    end
 
    return '[[File:' .. id .. '-' .. index .. '.png|100x100px]] '
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.