Skip to content

Group.SelectUnselect ​

Signature ​

lua
Group.SelectUnselect(Group cg, [Group|nil sg], int player, [bool finishable], [bool cancelable], [int min], [int max]) -> Card|nil

Description ​

Lets player choose one card from cg to add to the current selection or one card from sg to remove from it, then returns the card that was chosen. sg may be nil. finishable controls whether the selection can finish at its current size, cancelable allows cancellation, and cancellation returns nil. min and max default to 1. This is a building block for step-by-step material or procedure selections. For ordinary one-shot choices, Group.Select, Group.FilterSelect, or Duel.SelectMatchingCard is usually clearer.

How To Use It ​

Use this for custom selection loops that need to add and remove candidates while tracking whether the current choice can finish.

It is lower-level than Group.Select and is mostly useful inside helper procedures. For ordinary card choices, prefer Group.Select, Group.FilterSelect, or Duel.SelectMatchingCard.

Parameters ​

  • cg Group
  • sg Group|nil optional
  • player int
  • finishable bool optional - default: false
  • cancelable bool optional - default: false
  • min int optional - default: 1
  • max int optional - default: 1

Returns ​

  • Card|nil - Chosen card, or nil if the selection is canceled.

Source ​

  • D:\Programs\GitHub\ygopro-core\libgroup.cpp:916

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 175 indexed script(s).
  • Search this function in the Script Explorer with Group.SelectUnselect.
CardIDScriptDetected Calls
Artmage Non-Finito74631897Scripts/c74631897.lua2
Ashtraja Susanoo17020474Scripts/c17020474.lua1
Odd-Eyes Arcray Dragon6218704Scripts/c6218704.lua1
Flower Cardian Peony with Butterfly57261568Scripts/c57261568.lua1
Ultimate Crystal Rainbow Dragon Overdrive84544192Scripts/c84544192.lua1
Flower Cardian Willow with Calligrapher89818984Scripts/c89818984.lua1
Cyber Pharos29719112Scripts/c29719112.lua1
Vaylantz Genesis Grand Duke76075139Scripts/c76075139.lua1
Gishki Nekromirror36982581Scripts/c36982581.lua1
Malefic Paradigm Dragon16958382Scripts/c16958382.lua1
Todoroki the Earthbolt Star30118701Scripts/c30118701.lua1
Thunder Dragonlord5206415Scripts/c5206415.lua1
Dragunity Arma Leyvaten63487632Scripts/c63487632.lua1
Cyberdark End Dragon37542782Scripts/c37542782.lua1
Red-Eyes Black Dragon Exceed17242022Scripts/c17242022.lua1
Rainbow Overdragon37440988Scripts/c37440988.lua1
Egyptian God Slime42166000Scripts/c42166000.lua1
Destiny HERO - Dreadnought Master54641720Scripts/c54641720.lua1
Hieratic Dragon of Nebthet31516413Scripts/c31516413.lua1
Grapha, Dragon Lord of Dark World34230233Scripts/c34230233.lua1
Blue-Eyes Tyrant Dragon11443677Scripts/c11443677.lua1
Hieratic Dragon of Su3300267Scripts/c3300267.lua1
Dark Magician of Destruction59400890Scripts/c59400890.lua1
Infernoid Pirmais60551528Scripts/c60551528.lua1
...and 151 more

Script Examples ​

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
	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)
	if tc then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)

Ashtraja Susanoo (17020474) ​

Source: Scripts/c17020474.lua

lua
				local tmg=tg:Clone()
				tmg:Sub(selg)
				local tc=tmg:SelectUnselect(selg,tp,finish,false,1,tg:GetCount())
				if not tc then
					setg:Merge(selg)

Odd-Eyes Arcray Dragon (6218704) ​

Source: Scripts/c6218704.lua

lua
	local g=Duel.GetReleaseGroup(tp,false,REASON_SPSUMMON):Filter(c6218704.hspfilter,nil,tp,c)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
	local tc=g:SelectUnselect(nil,tp,false,true,1,1)
	if tc then
		e:SetLabelObject(tc)