Duel.GetChainInfo
Signature
Duel.GetChainInfo(int chainc, ... any) -> ...Description
Returns information fields from chainc in the same order as the requested CHAININFO_* constants. Use chainc=0 for the currently resolving Chain. Unknown requested fields return nil, and no values are returned if the Chain does not exist. For stored LP/player data, read CHAININFO_TARGET_PLAYER and CHAININFO_TARGET_PARAM. For official targets you are about to affect, prefer relation-aware target helpers.
How To Use It
Use chainc=0 inside an operation to read data from the currently resolving Chain Link.
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)For official card targets, prefer relation-aware helpers such as Duel.GetFirstTarget() or Duel.GetTargetsRelateToChain() when you are about to act on them.
Related Functions
Parameters
chaincint- Chain index/count to inspect; scripts commonly use 0 for the current Chain Link....any- One or more CHAININFO_* constants. Each requested field produces one return value.
Returns
...- Values corresponding to the requested CHAININFO_* constants. CHAININFO_TARGET_CARDS returns the Chain's target Group.
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4947
Guided Examples
Learn how to use this function in context:
- Categories, Properties, And Hint Timing
- Chain Timing And Activation Windows
- Client UI And Prompt Behavior
- Common Script Errors And Debugging
- Cost, Target, And Operation Lifecycle
- Write Your First Custom Card
More guided lessons (5)
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 2180 indexed script(s).
- Search this function in the Script Explorer with
Duel.GetChainInfo.
Script Examples
Salamandra with Chain (62091148)
Source: Scripts/c62091148.lua
if chk==0 then return true end
local c=e:GetHandler()
local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)Goyo Emperor (59255742)
Source: Scripts/c59255742.lua
end
function c59255742.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<g:GetCount() then return end
Duel.GetControl(g,tp)Meteoroa Drytron (24166324)
Source: Scripts/c24166324.lua
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local rg=tg:Filter(Card.IsRelateToEffect,nil,e)
if rg:GetCount() then