messageId = GetStringParam("mess","")
function init()
	if messageId == "" then
		return
	end
	local messageQue = GetString("savegame.mod.messageque")
	if isMessageReceived(messageId) then 
		local messageIds = splitString(messageQue,",")
		local index = indexOf(messageIds,messageId)
		if index == nil then
			return
		end
		table.remove(messageIds,index)
		local clearedque = table.concat(messageIds,",")
		messageQue = clearedque
		SetString("savegame.mod.messageque",messageQue)
	end
end
function isMessageReceived(msgId)
	return GetInt("savegame.mod.message."..msgId) > 0
end
function splitString(str, delimiter)
	local result = {}
	for word in string.gmatch(str, '([^'..delimiter..']+)') do
		result[#result+1] = trim(word)
	end
	return result
end

function indexOf(array, value)
    for i, v in ipairs(array) do
        if v == value then
            return i
        end
    end
    return nil
end
function trim(s)
	return (s:gsub("^%s*(.-)%s*$", "%1"))
 end