Skip to content

Duel.GetMatchingGroup ​

Signature ​

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

Description ​

Returns a Group containing cards from the specified locations that satisfy filter f and are not excluded by ex. s is player's own location mask and o is the opponent's location mask from that player's viewpoint. Extra arguments after ex are passed to f.

How To Use It ​

Use this when you need to keep or further process all matching cards rather than only checking if they exist.

s and o are location masks from player's point of view. For example, LOCATION_MZONE,0 means that player's Monster Zone, while 0,LOCATION_MZONE means the opponent's Monster Zone.

lua
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if #g>0 then
    Duel.HintSelection(g)
end

Parameters ​

  • f function|nil optional - Filter callback; nil accepts cards that pass location and exclusion checks.
  • player int - Reference player for the s and o location masks.
  • s int - Location mask on player's side.
  • o int - Location mask on the opponent's side from player's viewpoint.
  • ex Card|Group|nil optional - Card or Group excluded from the result; nil excludes nothing.
  • ... any - Extra values forwarded to f after the candidate Card.

Returns ​

  • Group - New Group containing every matching card.

Source ​

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

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 3272 indexed script(s).
  • Search this function in the Script Explorer with Duel.GetMatchingGroup.
CardIDScriptDetected Calls
Salamandra with Chain62091148Scripts/c62091148.lua4
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua3
Artmage Non-Finito74631897Scripts/c74631897.lua3
Pendulum Evolution55795155Scripts/c55795155.lua1
Levia-Dragoon - Daedalus78579058Scripts/c78579058.lua2
Lady's Dragonmaid48658295Scripts/c48658295.lua6
Azure Ocean Dragon Lord - Neo-Daedalus Rage41570943Scripts/c41570943.lua5
Eternal Favorite87532344Scripts/c87532344.lua4
Surprise Fusion35167375Scripts/c35167375.lua2
Astrograph Sorcerer76794549Scripts/c76794549.lua2
Spellbook of the Grand Circle11911336Scripts/c11911336.lua4
Ultra Polymerization76647978Scripts/c76647978.lua2
Accel Synchro Stardust Dragon30983281Scripts/c30983281.lua3
Melffy Playtime Surprise58036097Scripts/c58036097.lua2
Ashtraja Susanoo17020474Scripts/c17020474.lua1
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua2
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua5
Yomagna the Fire Phantom17350692Scripts/c17350692.lua6
Fiendsmith's Sequence49867899Scripts/c49867899.lua4
D/D/D Alfred the Divine Sage King11852093Scripts/c11852093.lua4
El Shaddoll Apkallone50907446Scripts/c50907446.lua2
Mementotlan Fusion66518509Scripts/c66518509.lua5
Favorite HERO Flame Wingman13243124Scripts/c13243124.lua3
Mixousia the Confounder80843006Scripts/c80843006.lua4
...and 3248 more

Script Examples ​

Salamandra with Chain (62091148) ​

Source: Scripts/c62091148.lua

lua
		local chkf=tp
		local mg1=Duel.GetFusionMaterial(tp)
		local mg2=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_GRAVE,0,nil)
		mg1:Merge(mg2)
		local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
	local chkf=tp
	local mg1=Duel.GetFusionMaterial(tp):Filter(s.filter0,nil,e)
	local mg2=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_EXTRA,0,nil,e)
	mg1:Merge(mg2)
	local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
	local g=s.getrg(tp,c)
	local g2=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
	local tc=g2:SelectUnselect(nil,tp,false,true,1,1)