Skip to content

RushDuel.CanSelectAndDoAction ​

Alias: RD.CanSelectAndDoAction. Requires the matching Rush Duel Lua bootstrap.

Signature ​

lua
RushDuel.CanSelectAndDoAction(int desc, int hint, function filter, int tp, int s_range, int o_range, int min, int max, Card|Group|nil expect, function action) -> any

Description ​

Optional resolution action: finds candidates, asks a yes/no question, then selects a Group and calls action(selected_group). Despite its name, this helper performs selection and the action; do not use it as a legality predicate or inside chk==0. Declining the yes/no question, having too few candidates, or selecting an empty Group returns numeric 0 without running action. Canceling card selection returns to the yes/no question through RD.CanSelect. Once the player completes a nonempty selection, every callback return value is forwarded unchanged, including no values. Like RD.SelectAndDoAction, it creates no activation target relation, passes no extra arguments to the filter/action, and emits a selection hint for public-location searches.

Parameters ​

  • desc int: Yes/no question description identifier.
  • hint int: Card-selection prompt identifier.
  • filter function: Card predicate including required action-legality checks.
  • tp int: Selecting player; 0 or 1.
  • s_range int: Locations on tp's side.
  • o_range int: Locations on the opponent's side.
  • min int: Minimum selected count.
  • max int: Maximum selected count.
  • expect Card|Group|nil: Card(s) excluded from matching; pass nil for none.
  • action function: Called as action(selected_group) after the player accepts and completes selection.

Returns ​

  • any: Exactly the callback's return values when invoked; otherwise numeric 0. A callback may return no values.

Source ​

Rush/Utilities/RDAction.lua:107

lua
function RushDuel.CanSelectAndDoAction(desc, hint, filter, tp, s_range, o_range, min, max, expect, action)
    local hint_selection = RushDuel._private_is_include_public(s_range, o_range)
    return RushDuel._private_action_can_select_match(desc, hint, filter, tp, s_range, o_range, min, max, expect, hint_selection, false, action)
end

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Rush/Scripts/ folder and rush_cards.cdb.

  • Detected in 509 indexed script(s).
  • Search this function in the Script Explorer with RushDuel.CanSelectAndDoAction.
CardIDScriptDetected Calls
Lufer the Symbol of the Devils120309059Rush/Scripts/c120309059.lua1
Moonforce Ziggy120300014Rush/Scripts/c120300014.lua1
Freshberry Collaboration120301071Rush/Scripts/c120301071.lua1
Brassdes of the Wicked Wheels120304033Rush/Scripts/c120304033.lua1
Star Protector's Protection120253065Rush/Scripts/c120253065.lua1
Sparkhearts Makma120298023Rush/Scripts/c120298023.lua1
Imaginary Arc Turbulence120196013Rush/Scripts/c120196013.lua1
Fairy of the Stars120305016Rush/Scripts/c120305016.lua1
Spice Cross Secret Recipe120261060Rush/Scripts/c120261060.lua1
Rising Protect120304055Rush/Scripts/c120304055.lua1
Curse of the Magiclad Dragon120304061Rush/Scripts/c120304061.lua1
Heavenly Bliss120203033Rush/Scripts/c120203033.lua1
Evolution Result Flash120290063Rush/Scripts/c120290063.lua1
Dimension Oper120309025Rush/Scripts/c120309025.lua1
Lovely Wolf120260046Rush/Scripts/c120260046.lua1
False Sun120264033Rush/Scripts/c120264033.lua1
Void Veil120227029Rush/Scripts/c120227029.lua1
Preferlyre120283046Rush/Scripts/c120283046.lua1
Fist the Contractor of the Imprisoned Dragon120306037Rush/Scripts/c120306037.lua1
Lovely Rabbit120300018Rush/Scripts/c120300018.lua1
Botonaginata the Music Princess120290009Rush/Scripts/c120290009.lua1
Sevens Road Ultima Witch120261045Rush/Scripts/c120261045.lua1
Daigyakutenno Megami120203019Rush/Scripts/c120203019.lua1
Fusionic Defense120257064Rush/Scripts/c120257064.lua1
...and 485 more

Script Examples ​

Lufer the Symbol of the Devils (120309059) ​

Source: Rush/Scripts/c120309059.lua

lua
		end)
		if Duel.IsExistingMatchingCard(cm.exfilter,tp,LOCATION_GRAVE,0,1,nil) then
			RD.CanSelectAndDoAction(aux.Stringid(m,5),HINTMSG_RTOHAND,cm.thfilter,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
				RD.SendToHandAndExists(sg,e,tp,REASON_EFFECT)
			end)

Moonforce Ziggy (120300014) ​

Source: Rush/Scripts/c120300014.lua

lua
		if not tc:IsImmuneToEffect(e) then
			tc:RegisterFlagEffect(FLAG_CANNOT_ATTACK_NEXT_TURN,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,1)
			RD.CanSelectAndDoAction(aux.Stringid(m,3),HINTMSG_TODECK,aux.NecroValleyFilter(cm.tdfilter),tp,LOCATION_GRAVE,0,1,1,nil,function(g)
				local c=e:GetHandler()
				if RD.SendToDeckBottom(g,e,tp,REASON_EFFECT)~=0

Freshberry Collaboration (120301071) ​

Source: Rush/Scripts/c120301071.lua

lua
	RD.SelectAndDoAction(HINTMSG_POSCHANGE,filter,tp,LOCATION_MZONE,0,1,1,nil,function(g)
		if RD.ChangePosition(g,e,tp,REASON_EFFECT,POS_FACEUP_DEFENSE)~=0 and e:GetLabel()==1 then
			RD.CanSelectAndDoAction(aux.Stringid(m,1),HINTMSG_DESTROY,cm.desfilter,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
				Duel.Destroy(sg,REASON_EFFECT)
			end)