User:XGlitchy30/sandbox

Simulators based on OCGCore, such as EdoPRO and KoishiPRO, make use of LUA files in order to code the behaviour of the cards during a Duel: with the exception of Normal Monsters, which do not possess any effect, material requirements, or Summoning procedures, every card in the game needs its own "script" in order to function properly: if a card does not have any script associated with it, you will be met with the following error message once you start a Duel using a Deck containing said card.  "CallCardFunction" (cXXX.initial_effect): attempt to call an error function Where XXX is a number that represents the original ID of the card whose script is missing.

Below, you can find a set of guidelines that are meant to show you the usual structure each card script needs to follow.

Name conventions
The name assigned to the file containing the script automatically links it to the corresponding card. When naming a card script, you need to follow a set of rules, as showed by the example provided below. c12345678.lua The name always starts with the lower-case letter c, followed by the original ID of the card you want to link the script to (in this case, the script will be linked to the card with 12345678 as ID), and by the extension of the file (.lua).

Contents of the file
The chunk of code provided below is designed for a generic card with multiple effects. The ellipsis (…) serve as a substitute for the text that would have been included in an actual script. Since we are only concerned with the script's structure, we will ignore these omitted portions for now. Every line that starts with a pair of hyphens (--) is a comment. Comments are portions of the scripts that are ignored by the program and are only meant to help the scripter noting any kind of useful information they might need. In this case, we use comments to write the name of the card and the author of the script, or to help identify an effect of the card for example.

In the third line we define two variables with the GetID function