Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control "Lo, the Prayers of the Voiceless Voice" and a LIGHT Ritual Monster, your opponent's monsters can only target Ritual Monsters for attacks, also your opponent cannot target LIGHT monsters you control with card effects. During your Main Phase: You can add 1 "Voiceless Voice" card or 1 "Skull Guardian" Ritual Monster from your Deck to your hand, except "Barrier of the Voiceless Voice". You can only use this effect of "Barrier of the Voiceless Voice" once per turn.
--粛声なる結界
--Barrier of the Voiceless Voice
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	c:RegisterEffect(e1)
	--Your opponent's monsters can only target Ritual Monsters for attacks
	local e2=Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
	e2:SetRange(LOCATION_SZONE)
	e2:SetTargetRange(0,LOCATION_MZONE)
	e2:SetCondition(s.effcon)
	e2:SetValue(function(e,_c) return not _c:IsRitualMonster() end)
	c:RegisterEffect(e2)
	--Your opponent cannot target LIGHT monsters you control with card effects
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
	e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
	e3:SetRange(LOCATION_SZONE)
	e3:SetTargetRange(LOCATION_MZONE,0)
	e3:SetCondition(s.effcon)
	e3:SetTarget(function(e,_c) return _c:IsAttribute(ATTRIBUTE_LIGHT) end)
	e3:SetValue(aux.tgoval)
	c:RegisterEffect(e3)
	--Search 1 "Voiceless Voice" card or 1 "Skull Guardian" Ritual Monster
	local e4=Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id,0))
	e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
	e4:SetType(EFFECT_TYPE_IGNITION)
	e4:SetRange(LOCATION_SZONE)
	e4:SetCountLimit(1,id)
	e4:SetTarget(s.thtg)
	e4:SetOperation(s.thop)
	c:RegisterEffect(e4)
end
s.listed_names={25801745,id} --"Lo, the Prayers of the Voiceless Voice"
s.listed_series={SET_VOICELESS_VOICE,SET_SKULL_GUARDIAN}
function s.ritfilter(c)
	return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRitualMonster() and c:IsFaceup()
end
function s.effcon(e)
	local tp=e:GetHandlerPlayer()
	return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,25801745),tp,LOCATION_ONFIELD,0,1,nil)
		and Duel.IsExistingMatchingCard(s.ritfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.thfilter(c)
	return (c:IsSetCard(SET_VOICELESS_VOICE) or (c:IsSetCard(SET_SKULL_GUARDIAN) and c:IsRitualMonster())) and not c:IsCode(id) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
	Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
	local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
	if #g>0 then
		Duel.SendtoHand(g,nil,REASON_EFFECT)
		Duel.ConfirmCards(1-tp,g)
	end
end