# LazyScript Tutorial - From Beginner to Expert
Overview
====
LazyScript is a scripting language for World of Warcraft that can cast certain skills or abilities under specified conditions. This is achieved by writing a "script" that consists of a series of skills and judgment conditions. When the LazyScript macro runs, the LazyScript plugin reads the skill and judgment condition list from top to bottom until it finds a skill that meets the judgment conditions, then uses that skill.
Any line can be commented out by adding "--", "//" or "#" at the beginning, skipping execution.
Tutorial 1: Getting Started
========
For example, let's have LazyScript execute casting Sinister Strike. First, please check the abbreviation for "Sinister Strike" in the "Actions" tab. It can be found as "ss". Now click the LazyScript icon on the minimap to open the menu, select "Create Script" from it. Give your script a name like "Combat Rogue One-Key", then type:
ss
Click the "Test" button. If everything is normal and there are no typos, the chat box will prompt "Test completed.". If there is an error, the chat box will prompt the error reason. If everything is normal, please click the "OK" button. Now, you should be able to see the script "Combat Rogue One-Key" in the LazyScript minimap menu, left-click "Combat Rogue One-Key" to set it as default, and a checkmark should appear next to "Combat Rogue One-Key" on the minimap menu. Now create a macro in the game, name it "One-Key Output", content:
/lazyscript
Then drag the macro to the action bar. At the same time, drag the highest level "Sinister Strike" to any action bar, and the setup is complete. Spam the "One-Key Output" macro, and LazyScript will automatically cast Sinister Strike.
Tutorial 2: Advanced
========
"This is no different from ordinary macros." Don't worry, the powerful features are coming. Now add "Riposte", a skill that is not always available, into the mix. Riposte has much higher priority than Sinister Strike, but Riposte is not always available. Edit "Combat Rogue One-Key" and add Riposte before Sinister Strike, like this:
riposte ss
Drag Riposte to your action bar. Now, when you spam the "One-Key Output" macro, LazyScript will cast Sinister Strike normally, and will cast Riposte after you parry. Most importantly, it won't prompt "This skill cannot be used" like ordinary custom macros.
Tutorial 3: Conditions
===========
One of LazyScript's most useful features is the ability to judge conditions for casting skills. For example, you only want to use Kick when the target is casting. In the "Conditions" tab, we notice a condition "-if[Not]TargetIsCasting" and some other seemingly complex things. Ignore them, just use "-ifTargetIsCasting". Interrupting casting is more important than using Riposte, so edit "Combat Rogue One-Key" and change it to:
kick-ifTargetIsCasting riposte ss
Now LazyScript will only use Kick when the target is casting. "But what if I only want to interrupt fire magic?" Okay, continue editing "Combat Rogue One-Key" and change it to:
kick-ifTargetIsCasting=FIRE riposte ss
"What if I want to interrupt both fire and frost magic?" Change "Combat Rogue One-Key" to:
kick-ifTargetIsCasting=FIRE,FROST riposte ss
"I'm very powerful, MC geared, most annoyed by healers, kill the druid, kill the druid" can interrupt certain spells, just use the correct skill full name (English version is fine, Chinese version to be verified).
kick-ifTargetIsCasting=Heal,Greater Heal riposte ss
Tutorial 4: Complex One-Key
================
The most complex judgment conditions you might encounter are buff/debuff issues. They are very complex and need to be judged according to specific situations. For example, you only want to reapply Slice and Dice when there is no Slice and Dice buff. First check the "Buff/Debuff" tab to find the abbreviation for Slice and Dice. It's "snd", so add a line to the script:
snd-ifNotPlayerHasBuff=snd
If you only want to use Rupture when the target has no Rupture:
rupture-ifNotTargetHasDebuff=rupture
"Why can't I find a certain skill in the buff/debuff list?" Although we try to improve职业技能 as much as possible, listing all buffs in the game would consume too much memory. If the buff/debuff is not in the list, you can use the buff full name to judge:
echo=w00t-ifPlayerHasBuffTitle=Rallying Cry of the Dragonslayer
"My tank is a big noob, need 3 sunders to start DPS to not OT. Can LazyScript help me?" LazyScript can check buff/debuff stacks, you can add something like this at the beginning of the script:
stopAll-ifTargetHasDebuff<3=sunder
Tutorial 5: Combos
=========
Now you may have noticed that some skills in the "Actions" tab are green. Hopefully you've read the help and know these skills have no GCD. You can combine any number of no-GCD skills with at most one GCD skill into one line, and LazyScript will cast them in order. For example, Cold Blood Eviscerate, and announce death:
coldBlood-evisc-sayInSay=DIE!-ifCbKillShot
Here are a few more examples
huntersMark-petAttack judge-sealCommand innerFocus-greaterHeal
Tutorial 6: Script Reuse
===========
Now, you've written some scripts, and they're getting bigger. If they contain the same parts, you can separate that part into another script and use includeForm to include it in other scripts. For example:
Script "Interrupt":
kick-ifTargetIsCasting-ifNotTargetIs=Stunned gouge-ifTargetIsCasting-ifNotInFrontAttackJustFailed-ifNotTargetIs=Stunned ks-ifTargetIsCasting=Greater Heal,Prayer of Healing,Healing Touch,Holy Light,Healing Wave,Chain Heal-ifNotTargetIs=Stunned blind-ifTargetIsCasting=Greater Heal,Prayer of Healing,Healing Touch,Holy Light,Healing Wave,Chain Heal-ifNotTargetIs=Stunned
Script "Combat Sword":
includeForm=Interrupt riposte evisc-5cp ss
Script "Combat Dagger":
includeForm=Interrupt evisc-5cp bs
This way, the content of script "Interrupt" can be added to the beginning of scripts "Combat Sword" and "Combat Dagger", equivalent to copying and pasting the entire script. When you modify the content of script "Interrupt", it will automatically update "Combat Sword" and "Combat Dagger".
Note: Please be careful not to self-reuse scripts (A includes A), or cyclically reuse scripts (A includes B includes A). These will produce infinite recursion loops, causing stack overflow errors.
Now, you may have some actions that you only want to execute under certain conditions, but don't want to check the entire script every time you press the LazyScript shortcut. Looking at the previous example, we can see that "ifTargetIsCasting" is the judgment condition for all actions in the "Interrupt" script, we can rewrite the previous example using callForm:
Script "Interrupt":
kick gouge-ifNotInFrontAttackJustFailed ks-ifTargetIsCasting=Greater Heal,Prayer of Healing,Healing Touch,Holy Light,Healing Wave,Chain Heal blind-ifTargetIsCasting=Greater Heal,Prayer of Healing,Healing Touch,Holy Light,Healing Wave,Chain Heal
Script "Combat Sword":
callForm=Interrupt-ifTargetIsCasting-ifNotTargetIs=Stunned riposte evisc-5cp ss
Script "Combat Dagger":
callForm=Interrupt-ifTargetIsCasting-ifNotTargetIs=Stunned evisc-5cp bs
With these changes, when you execute "Combat Sword" or "Combat Dagger", the "Interrupt" script will only be called when the target is casting and not stunned. When the target is not casting, no "Interrupt" script content will be called, improving script execution efficiency.