Learning Path
Sacred Book has two useful modes: a guided curve for learning the engine and a task library for finding one exact pattern. New scripters should follow the first curve in order. Experienced scripters can jump to a branch, confirm the call in the API, then search real local use in the Script Explorer.
Pick Your Starting Point
| Your experience or task | Start here |
|---|---|
| New to programming or Lua. | Start with Lua Essentials, then follow the seven-step curve below. |
| Familiar with Lua; new to card scripts. | Follow the seven-step curve below. |
| Comfortable with Lua, but new to YGOPro effects. | Read Effect Objects, Effect Types, and Callbacks. |
| You know the engine and need one implementation pattern. | Jump to the Lesson Library, then use the Script Explorer. |
| A script almost works, but fails in one game state. | Trace Activation Legality, Effect Lifecycle, and Common Script Errors. |
| Building a Rush Duel card. | Follow the Rush Duel track. |
| Returning after an engine update. | Read Applying Engine and Script Changes for the new card-type API and corrected patterns. |
First Complete Card Curve
GetID, initial_effect, effect blocks, filters, and callbacks.Step 2Trace real effectsFollow small local scripts that draw, target, prompt, modify, and choose by stats.Step 3Build small effectsFollow complete draw, target, Group, trigger, Quick-Play, and Trap scripts in order.Step 4Write one cardCombine two proven patterns into a small, complete, testable custom Spell.Step 5Wire card dataMatch the card ID, type bits, prompt strings, set codes, and Lua file.Step 6Trace activation flowSeparate condition, cost, target, operation, and chk==0 legality.Step 7Debug the scriptFix nil values, invisible prompts, stale targets, count limits, reset flags, and stored Groups.Checkpoints For Your First Card
You do not need to memorize every function before moving on. Use these observable checkpoints to choose your next lesson:
| After | You should be able to |
|---|---|
| Reading a file | Point to the effect registration, the callbacks, and the filters. |
| Building small effects | Explain what chk==0 checks without selecting or moving cards. |
| Writing and wiring a card | Load your card with the correct name, type, script, and prompt text. |
| Tracing activation | Explain which values are chosen now and which must be checked again at resolution. |
| Debugging | Reproduce one legal activation, one illegal activation, and one changed-state resolution. |
If a checkpoint fails, return to that stage with one small card. For a Rush card, complete the shared Lua/callback foundations, then follow the Rush track before copying a standard-format effect.
Learn, Verify, Search
Use the site layers together instead of expecting one page to answer every question:
| Layer | Best use |
|---|---|
| Learning pages | Understand why a pattern is shaped a certain way and see a complete example. |
| Function reference | Confirm the exact signature, parameters, return value, and local source. |
| Script Explorer | Find every local card that uses a function or a similar text pattern. |
| Featured examples | Read larger real cards with their detected calls and source. |
For a new effect, read one relevant lesson, find two local scripts with the same shape, and verify unfamiliar calls in the API. That workflow scales from a first card to veteran-level edge cases.
Common Effect Pattern Route
Once you can follow target and operation callbacks, these three pages answer a lot of real custom-card questions:
Read them when the card text says "send", "banish", "equip", "recover LP", or "inflict damage" and you need to choose the right local API shape.
Lesson Library
Use this library after the first route, or jump to the branch that matches the card you are scripting.
Foundations
Lua essentialsScript structureEffect objectsEffect typesCategories and propertiesFirst scriptsBeginner script ladderFirst custom cardCard data and script wiringActivation Flow
CallbacksActivated effectsActivation legalityEffect lifecycleChain timingClient UI and promptsCards And Groups
Filters and GroupsTargeting flowSelection and Group handlingMin/Max stat selectionMoving cardsOperation results and follow-up effectsTokens and summon choicesReset flags and durationSpell And Trap Patterns
Spell CardsQuick-Play SpellsEquip SpellsField SpellsTrap CardsNormal and Continuous TrapsCounter TrapsSummon Procedures
Ritual procedureRitual choices and backtrackingFusion procedureFusion monster and material choicesSynchro procedureXyz procedureLink procedurePendulum procedureSpecial Summon-only monstersTribute Summon materialsMonster Families
Gemini MonstersToon MonstersUnion MonstersSpirit MonstersArchetypes and set codesCard Outcomes
Methods for affecting cardsContinuous effectsContinuous stat modifiersCountersNegation and immunityControl changeBattle position effectsBattle participants and timingField zones and sequencesRush Duel
Choose your Rush starting pointRequirements and resolutionSelection, actions, and temporary statsMaximum, Fusion, and RitualFusion and Ritual choicesSpecial Summons and result checksReal Rush scriptsRush helper referenceMaintenance And Debugging
Apply engine and script changesCommon script errorsVerify card data and scriptsPlayer Data And Memory
LP recovery and effect damagePlayer-targeted effectsPlayer restrictionsDraw, hand, and Deck effectsFlag effectsCount limitsHow To Read A Real Script
When a local card script looks confusing, read it in this order:
- Find
initial_effect(c). - Read each
Effect.CreateEffect(c)block. - Note
SetType,SetCode,SetRange,SetProperty, and callbacks. - Read
SetCondition,SetCost,SetTarget, andSetOperationcallbacks. - Read helper filters last, because they usually only answer "which cards count?"
Useful reference while learning: