Skip to content

Duel.GetFirstMatchingCard ​

Signature ​

lua
Duel.GetFirstMatchingCard([function|nil f], int player, int s, int o, [Card|Group|nil ex], [... any]) -> Card|nil

Description ​

Returns the first card in the specified locations that satisfies f and is not excluded by ex. f may be nil. ex may be a Card, a Group, or nil, and extra arguments after ex are passed to f. Returns nil when no matching card is found.

Parameters ​

  • f function|nil optional
  • player int
  • s int
  • o int
  • ex Card|Group|nil optional
  • ... any optional

Returns ​

  • Card|nil

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4971

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 85 indexed script(s).
  • Search this function in the Script Explorer with Duel.GetFirstMatchingCard.
CardIDScriptDetected Calls
D/D/D Deviser King Deus Machinex46593546Scripts/c46593546.lua2
Scrap-Iron Sacred Statue85520170Scripts/c85520170.lua1
Majesty Pegasus, the Dracoslayer92332424Scripts/c92332424.lua2
Charming Resort Staff64753157Scripts/c64753157.lua1
Yosenju Oroshi Channeling61884774Scripts/c61884774.lua2
Synchro Overtop653675Scripts/c653675.lua1
Synchro World36742774Scripts/c36742774.lua1
Super Quantal Alphan Spike72332074Scripts/c72332074.lua1
Imsety, Glory of Horus84941194Scripts/c84941194.lua1
Number 53: Heart-eartH23998625Scripts/c23998625.lua1
Advanced Crystal Beast Cobalt Eagle45236142Scripts/c45236142.lua1
Abyss Actor - Wild Hope51391183Scripts/c51391183.lua1
Performage Shadow Maker69655484Scripts/c69655484.lua1
Performapal Odd-Eyes Light Phoenix59762399Scripts/c59762399.lua2
Ahrima, the Wicked Warden86377375Scripts/c86377375.lua1
The Earth - Hex-Sealed Fusion88696724Scripts/c88696724.lua1
The Light - Hex-Sealed Fusion15717011Scripts/c15717011.lua1
The Dark - Hex-Sealed Fusion52101615Scripts/c52101615.lua1
Aleister the Invoker86120751Scripts/c86120751.lua1
Tindangle Trinity11375683Scripts/c11375683.lua1
Euler's Circuit9547962Scripts/c9547962.lua1
Vampire Takeover22900598Scripts/c22900598.lua1
Dragunity Remus26577155Scripts/c26577155.lua1
Wightprincess90243945Scripts/c90243945.lua1
...and 61 more

Script Examples ​

D/D/D Deviser King Deus Machinex (46593546) ​

Source: Scripts/c46593546.lua

lua
	if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE+LOCATION_GRAVE) and c46593546.sptgfilter(chkc) end
	local c=e:GetHandler()
	local tc=Duel.GetFirstMatchingCard(nil,tp,LOCATION_PZONE,0,c)
	if chk==0 then return tc and Duel.GetMZoneCount(tp)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)
		and Duel.IsExistingTarget(c46593546.sptgfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,nil) end

Scrap-Iron Sacred Statue (85520170) ​

Source: Scripts/c85520170.lua

lua
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
	local tg=Duel.GetFirstMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp)
	if tg then
		Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEUP)

Majesty Pegasus, the Dracoslayer (92332424) ​

Source: Scripts/c92332424.lua

lua
function c92332424.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then
		local oc=Duel.GetFirstMatchingCard(nil,tp,LOCATION_PZONE,0,e:GetHandler())
		return Duel.IsExistingMatchingCard(c92332424.srfilter,tp,LOCATION_DECK,0,1,nil,oc)
	end