Modular Script Examples
BASICS
(Introductry pieces of modular scripts that are (usually) redunant in actual use, due to vanilla scripts being better, this exists to teach the basics of each piece)
"Modular/TIMING:WhenUse/mpdmg(Self,10)" - this heals 10 Sp on Use [Components: WhenUse timing is On Use, mpdmg adds or removes Sp on the target self]
"Modular/TIMING:StartBattle/buf(EveryAlly,Agility,2,1,1)"- This will buff every ally with Haste [Components: StartBattle is the Timing, buf can give buffs to the target specified in the script, 2 is the potency applied, 1 is the count of the buff, 1 is the active round that the buff initiates, EveryAlly is the target for the script.]
"Modular/TIMING:StartBattle/shield(Self,30)" - This script applies shield to self with a value of 30 [Components: StartBattle is the Timing of the script, shield applies shield to the target, Self is the target used in this example, 30 is the value for the hp of the shield. There is an additional 3rd arguement known as "perm" that makes the shield not decay after the round ends.]
"Modular/TIMING:StartBattle/healhp(Self,50)" - This script heals the target with a value of 50 hp healed [Components: StartBattle is the Timing of the script, healhp heals the target's hp with a set value, Self is the target for this script, 50 is the value of the healing for the target.]
"Modular/TIMING:StartBattle/VALUE_1:mpcheck(Self)" - This script checks its own sp and assigns it to VALUE_1. [Components: StartBattle is the Timing of the script, VALUE_1 is the value that the output will be assigned to, Self is the target set for the script.]
"Modular/TIMING:StartBattle/VALUE_0:hpcheck(Self,max)/VALUE_0:math(VALUE_0*50%100)/healhp(Self,VALUE_0)" - This script heals a % of max hp on Self. [Components: Timing is StartBattle, VALUE_0 is the Max HP of the sinner that this script is being applied on, VALUE_0:math(VALUE_0*\50%100) is the calculation for the hp healed (in this case, 50%), and healhp(Self,VALUE_0) is simply using the value to heal the hp % to the unit.]
"Modular/TIMING:StartBattle/VALUE_1:getshield(Self)" - This script checks the current shield value on the target and assigns it to VALUE_1. [Components: StartBattle is the Timing of the script, VALUE_1 is the value that the output will be assigned to, (returned as an integer), Self is the target for the script.]
"Modular/TIMING:StartBattle/VALUE_1:areallied(target,Self)" - This script checks if the units are allied with the unit this script is applied on. [Components: StartBattle is the Timing of the script, VALUE_1 is the value that the output will be assigned to (returned as 1 if the units are allied, 0 if they are not), target and Self are the units that are being checked as allies.]
"Modular/TIMING:StartBattle/VALUE_1:getcoincount(Self,og)" - This script checks the original coin count of the skill currently being used [Components: StartBattle is the Timing of the script, VALUE_1 is the value that the output will be assigned to, Self is the target for the script, og is the original amount of coins that the skill had, unaffected by any coins lost in a clash.]
"Modular/TIMING:StartBattle/bonusdmg(Target,30,1,-1)" - This script inflicts pierce bonus damage on the target. [Components: StartBattle is the timing of the skill, Target is the target for the script, 30 is the damage to be inflicted, 1 is the damage type, being pierce, and -1 is the sin damage type, being true in this case due to it being -1.]
INTERMEDIATE
(Unique modular pieces of which typically used and found, things here are quite useful and cant be done using regular vanilla scripts and teach true beginner stuff to start making genuine and more complex modular scripts)
"Modular/TIMING:OnSucceedAttack(None,None,None)/VALUE_1:mpcheck(Self)/IF(VALUE_1<5):buf(Target,Vibration,2,2,0)" - This script applies 2 Tremor and Tremor Count to the enemy on a successful attack if the sp of the unit is below 5. [Components: OnSucceedAttack is a more specific TIMING, because it has a few extra conditions that need to be specified, such as if it is on crit, heads/tails, or only on won clashes for unbreakable coins. Here its set to none, so it's just if the coin hits. We use VALUE_1 to check the SP of the unit, then compare it with a value using the IF statement. In this script, it is setup so if their sp is lower than 5, it inflicts the tremor on the target. If not, it does nothing.]
"Modular/TIMING:StartBattle/LOOP:EveryAlly/VALUE_9:haskey(Target,OR,MARIACHI)/IF(VALUE_9=1):buf(Target,Protection,2,0,0)" - This script checks through every ally to see if they are apart of the MARIACHI syndicate. If they are, it grants them protection on Turn Start. [Components: LOOP:EveryAlly makes it so that the next block of code, being the faction check, loops through every ally deployed. Haskey checks a target for a specific faction, being whatever faction you specify (in this case, mariachi's) IF statements are used in this case to check if the unit is in the mariachi faction, since haskey returns 1 when the unit is in the faction specified. You may have noticed that the buf is on the target, and that is because this scripts targets are your units.]
"Modular/TIMING:BeforeAttack/VALUE_0:resonance(CRIMSON)/VALUE_1:resonance(perfectCRIMSON)/IF(VALUE_1>0):VALUE_0:math(VALUE_0*2)/final(VALUE_0):scale(VALUE_0)" - This skill increases final power and coin power by a wrath resonance. If the wrath resonance is an Absolute Resonance, it doubles the power gained. [Components: VALUE_0 is the value used for a non absolute resonance calculation, VALUE_1 is the value used for an Absolute Resonance calculation, IF(VALUE_1>0) is used to check if it is an Absolute Resonance or not, VALUE_0:math(VALUE_0*2)/final(VALUE_0):scale(VALUE_0) is the calculations for the provided buff.]
"Modular/TIMING:WhenUse/VALUE_0:mpcheck(Self)/IF(VALUE_0>0):shield(Self,VALUE_0)" this script gets the SP value, and checks if its above 0, and if it is, applies shield on self equal to the SP value [Components: WhenUse timing is on use, VALUE_0 is tied with mpcheck(Self) which makes it the holder of this units SP value, uses shield to apply shield using VALUE_0 as the parameter makes it apply shield equal to that value, which is the current sp]
Modular/TIMING:WhenUse/VALUE_0:mpcheck(Self)/VALUE_1:math(0-30-VALUE_0)/VALUE_2:math(0-10)/VALUE_3:math(VALUE_1¡VALUE_2!10)/mpdmg(Self,VALUE_3) On Use, tries to either lose or gain SP to reach -30  [components: When use timing is On use, value 0 is tied with sp on self, value 1 is 0-30-sp on self, value 2 is -10, gets the maximum value between value 1 and 2, and the minimum between value_2 and 10, and does mp dmg or heal based on value 3]
ADVANCED HELL
(Impractical, extremely long, and unnecessarily complicated modulars, made for the utterly deranged)
"Modular/TIMING:RoundStart/VALUE_0:bufcheck(Self,MDHMdh,+)/VALUE_0:math(VALUE_0%5)/VALUE_1:bufcheck(Self,MDHMdg,stack)/VALUE_2:math(VALUE_1-VALUE_0)/VALUE_3:math(0-VALUE_2)/IF(VALUE_2<0):IF(VALUE_1<5):buf(Self,MDHMdg,VALUE_3,0,0)/IF(VALUE_2>0):IF(VALUE_1<5):buf(Self,MDHMdg,VALUE_2,0,0)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,11025011)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>0)/VALUE_0:random(1,3)/IF(VALUE_0=1):setdata(Self,110250111,1)/IF(VALUE_0=2):setdata(Self,110250112,1)/IF(VALUE_0=3):setdata(Self,110250113,1)/setdata(Self,11025011,1)",
                "Modular/TIMING:WinDuel/VALUE_0:getdata(Self,110250111)/CONTINUEIF(VALUE_0=1)/healhp(RandomAlly1,3%)/VALUE_0:random(5,10)/VALUE_0:math(0-VALUE_0)/breakdmg(RandomAlly1,VALUE_0)",
                "Modular/TIMING:WhenHit/VALUE_0:getdata(id11025,110250112)/CONTINUEIF(VALUE_0=1)/VALUE_0:getdata(id11025,1102501122)/setdata(instVALUE_0,1102501121,0)/setdata(Self,1102501121,1)/VALUE_0:instid(Self)/setdata(id11025,1102501122,VALUE_0)",
                "Modular/TIMING:OnSucceedAttack(None)/VALUE_0:getdata(Target,1102501121)/CONTINUEIF(VALUE_0=1)/dmgmult(15)",
                "Modular/TIMING:LoseDuel/VALUE_0:getdata(Self,110250113)/CONTINUEIF(VALUE_0=1)/VALUE_0:random(5,10)/VALUE_1:getdata(Self,1102501131)/VALUE_7:getdata(Self,110250153)/IF(VALUE_1<3):IF(VALUE_7=0):breakdmg(Self,VALUE_0)/IF(VALUE_1<3):buf(Self,ResultEnhancement,1,0,1)/IF(VALUE_1<2):buf(Self,MDEMcc,3,0,1)/VALUE_1:math(VALUE_1+1)/setdata(Self,1102501131,VALUE_1)/setdata(Self,999,1)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,11025012)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>1)/VALUE_0:random(1,3)/IF(VALUE_0=1):setdata(Self,110250121,1)/IF(VALUE_0=2):setdata(Self,110250122,1)/IF(VALUE_0=3):setdata(Self,110250123,1)/setdata(Self,11025012,1)",
                "Modular/TIMING:WhenHit/VALUE_8:getdata(id11025,110250121)/CONTINUEIF(VALUE_8=1)/VALUE_9:getdata(id11025,1102501211)/CONTINUEIF(VALUE_0<3)/VALUE_0:skillatk(Self)/IF(VALUE_0=0):buf(Target,SlashResistUp,1,0,1)/IF(VALUE_0=1):buf(Target,PenetrateResistUp,1,0,1)/IF(VALUE_0=2):buf(Target,HitResistUp,1,0,1)/VALUE_0:skillattribute(Self)/IF(VALUE_0=0):buf(Target,CrimsonResistUp,1,0,1)/IF(VALUE_0=1):buf(Target,ScarletResistUp,1,0,1)/IF(VALUE_0=2):buf(Target,AmberResistUp,1,0,1)/IF(VALUE_0=3):buf(Target,ShamrockResistUp,1,0,1)/IF(VALUE_0=4):buf(Target,AzureResistUp,1,0,1)/IF(VALUE_0=5):buf(Target,IndigoResistUp,1,0,1)/IF(VALUE_0=6):buf(Target,VioletResistUp,1,0,1)/VALUE_9:math(VALUE_9+1)/setdata(id11025,1102501211,VALUE_9)",
                "Modular/TIMING:OnSucceedAttack(Head)/VALUE_0:getdata(Self,110250122)/CONTINUEIF(VALUE_0=1)/VALUE_0:hpcheck(Target,max)/VALUE_0:math(VALUE_0%10)/VALUE_0:math(VALUE_0!30)/bonusdmg(Target,VALUE_0,-1,-1)",
                "Modular/TIMING:OnOtherDie/VALUE_0:getdata(Self,110250123)/CONTINUEIF(VALUE_0=1)/VALUE_0:areallied(Self,Target)/CONTINUEIF(VALUE_0=1)/VALUE_0:random(1,3)/buf(RandomAlly20,Agility,VALUE_0,0,1)/buf(RandomAlly20,ResultEnhancement,VALUE_0,0,1)/buf(RandomEnemy20,Vulnerable,2,0,1)/setdata(Self,9999,1)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,11025013)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>2)/VALUE_0:random(1,3)/IF(VALUE_0=1):setdata(Self,110250131,1)/IF(VALUE_0=2):setdata(Self,110250132,1)/IF(VALUE_0=3):setdata(Self,110250133,1)/setdata(Self,11025013,1)",
                "Modular/TIMING:WinDuel/VALUE_0:getdata(Self,110250131)/CONTINUEIF(VALUE_0=1)/buf(Target,PlusCoinValueDown,2,0,1)",
                "Modular/TIMING:WinDuel/VALUE_0:getdata(Self,110250132)/CONTINUEIF(VALUE_0=1)/VALUE_0:getdata(Self,1102501321)/CONTINUEIF(VALUE_0<4)/buf(Target,Protection,1,0,1)/VALUE_0:math(VALUE_0+1)/setdata(Self,1102501321,VALUE_0)",
                "Modular/TIMING:WinDuel/VALUE_0:getdata(Self,110250133)/CONTINUEIF(VALUE_0=1)/bonusdmg(Target,15,-1,-1)/healhp(Self,15)/setdata(Self,99999,1)",
                "Modular/TIMING:LoseDuel/VALUE_0:getdata(Self,110250133)/CONTINUEIF(VALUE_0=1)/VALUE_0:getdata(Self,110250153)/CONTINUEIF(VALUE_0=0)/bonusdmg(Self,15,-1,-1)/healhp(Target,15)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,11025014)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>3)/VALUE_0:random(1,3)/IF(VALUE_0=1):setdata(Self,110250141,1)/IF(VALUE_0=2):setdata(Self,110250142,1)/IF(VALUE_0=3):setdata(Self,110250143,1)/setdata(Self,11025014,1)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,110250141)/CONTINUEIF(VALUE_0=1)/buf(Self,MDEMcc,2,0,0)/buf(Self,ResultEnhancement,2,0,0)/setdata(Self,9999999,1)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,110250142)/CONTINUEIF(VALUE_0=1)/healhp(LowestHPAlly1,15%)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,110250143)/CONTINUEIF(VALUE_0=1)/VALUE_0:getdata(Self,1102501431)/CONTINUEIF(VALUE_0=0)/buf(RandomEnemy99,MDHcFaBb,10,0,0)/setdata(Self,1102501431,1)",
                "Modular/TIMING:RoundStart/LOOP:RandomEnemy99/VALUE_0:getdata(Self,110250143)/CONTINUEIF(VALUE_0=1)/VALUE_0:bufcheck(Target,MDHcFaBb,stack)/buf(Target,Binding,VALUE_0,0,0)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,11025015)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>4)/VALUE_0:getdata(Self,110250113)/VALUE_1:getdata(Self,110250123)/VALUE_2:getdata(Self,110250133)/VALUE_3:getdata(Self,110250141)/IF(VALUE_0=1):IF(VALUE_1=1):IF(VALUE_2=1):IF(VALUE_3=1):setdata(Self,110250153,1)/VALUE_9:getdata(Self,110250153)/CONTINUEIF(VALUE_9=0)/VALUE_0:random(1,2)/IF(VALUE_0=1):setdata(Self,110250151,1)/IF(VALUE_0=2):setdata(Self,110250152,1)/setdata(Self,11025015,1)",
                "Modular/TIMING:LoseDuel/VALUE_0:getdata(Self,110250151)/CONTINUEIF(VALUE_0=1)/VALUE_0:getdata(Self,1102501511)/VALUE_0:math(VALUE_0+1)/setdata(Self,1102501511,VALUE_0)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,1102501511)/CONTINUEIF(VALUE_0>9)/buf(Self,Protection,5,0,0)/buf(Self,Combustion,-99,-99,0)/buf(Self,Sinking,-99,-99,0)/buf(Self,Burst,-99,-99,0)/buf(Self,Vibration,-99,-99,0)/buf(Self,Laceration,-99,-99,0)",
                "Modular/TIMING:WhenHit/VALUE_0:getdata(id11025,1102501511)/CONTINUEIF(VALUE_0>9)/VALUE_0:getdata(id11025,1102501512)/CONTINUEIF(VALUE_0<3)/buf(Self,Vulnerable,1,0,0)/buf(Self,MDHcFaBb,1,0,0)/VALUE_0:math(VALUE_0+1)/setdata(id11025,1102501512,VALUE_0)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,999)/VALUE_1:getdata(Self,9999)/VALUE_2:getdata(Self,99999)/VALUE_3:getdata(Self,9999999)/IF(VALUE_0=1):IF(VALUE_1=1):IF(VALUE_2=1):IF(VALUE_3=1):buf(RandomExceptSelf99,ResultReduction,5,0,0):buf(RandomExceptSelf99,Binding,5,0,0)",
                "Modular/TIMING:EndBattle/setdata(Self,1102501131,0)/setdata(Self,1102501211,0)/setdata(Self,1102501321,0)/setdata(Self,1102501512,0)",
                "Modular/TIMING:RoundStart/VALUE_0:getdata(Self,891148)/CONTINUEIF(VALUE_0=0)/VALUE_1:bufcheck(Self,MDHMdg,stack)/CONTINUEIF(VALUE_1>3)/skillslotgive(Self)/setdata(Self,891148,1)" 
this passive is tiphereth's passive from Patrons who forgot their pages to function.
this is an atrocity and a disgrace to modular society