First, I have a small autoexec. Most of the inspiration comes from Ineptvagrants previous spellcast for thief. I am had a few problems getting his idea of vars for SA, TA, and Afteraction to work, so for now I am relying on when the client notices lost buffs. So far, I have not had any problems with things not firing off.
<autoexec>
<register event="(regex)losebuff_(Sneak|Trick)_Attack(/regex)">ae trigger SATAFinished</register>
<register event='SATAFinished'>sc var set SAHands Rogue's Armlets; sc var set DEHands Rogue's Armlets; sc var set SBHands Rogue's Armlets; sc var set SAEar1 Coral Earring; sc var set SBEar1 Coral Earring; input /ma "Tonko: Ichi"</register>
<register event="status_engaged">input /ma "Hyoton: Ichi"</register>
<register event="losebuff_Feint">input /echo ----- Feint Active -----; sc var set TPBody Rapparee Harness; input /ma "Tonko: Ichi"</register>
</autoexec>
Here is my spellcast xml. It is mostly complete for /Nin. There is some redundancy in the variables because I am hoping to come into gear soon that can make use of the variables. So far, I have not come across any problems.
<?xml version="1.0" ?>
<spellcast>
<config AutoLoadXML="true" />
<variables>
<var name="Ranged">0</var>
<var name="Ut">Ichi</var>
<var name="RestoreSet">THFTP</var>
<var name="CurrentBody"></var>
<var name="CurrentFeet"></var>
<!-- Ammo Vars -->
<var name="MeleeAmmo">Fire Bomblet</var>
<!-- Melee Vars -->
<var name="TPBody">Mirke Wardecours</var>
<!-- SA Vars -->
<var name="SAEar1">Coral Earring</var>
<var name="SAHands">Rogue's Armlets +1</var>
<!-- DE Vars -->
<var name="DEBody">Hecatomb Harness</var>
<var name="DEHands">Hecatomb Mittens</var>
<!-- SB Vars -->
<var name="SBEar1">Coral Earring</var>
<var name="SBHands">Hecatomb Mittens</var>
</variables>
<sets>
<group default="yes" name="THF">
<set name="Idle">
<ammo>$MeleeAmmo</ammo>
<head>Walahra Turban</head>
<neck>Chivalrous Chain</neck>
<lear>Suppanomimi</lear>
<rear>Brutal Earring</rear>
<body>Rapparee Harness</body>
<hands>Rogue's Armlets</hands>
<lring>Rajas Ring</lring>
<rring>Woodsman Ring</rring>
<back>Amemet Mantle +1</back>
<waist>Swift Belt</waist>
<legs>Feral Trousers</legs>
<feet>Homam Gambieras</feet>
</set>
<set name="THFTP">
<ammo>$MeleeAmmo</ammo>
<head>Walahra Turban</head>
<neck>Chivalrous Chain</neck>
<lear>Suppanomimi</lear>
<rear>Brutal Earring</rear>
<body>$TPBody</body>
<hands>Dusk Gloves</hands>
<lring>Rajas Ring</lring>
<rring>Woodsman Ring</rring>
<back>Amemet Mantle +1</back>
<waist>Swift Belt</waist>
<legs>Feral Trousers</legs>
<feet>Homam Gambieras</feet>
</set>
<set name="THF-SA">
<ammo>$MeleeAmmo</ammo>
<head>Empress Hairpin</head>
<neck>Spike Necklace</neck>
<lear>$SAEar1</lear>
<rear>Brutal Earring</rear>
<body>Dragon Harness</body>
<hands>$SAHands</hands>
<lring>Rajas Ring</lring>
<rring>Spinel Ring</rring>
<back>Amemet Mantle +1</back>
<waist>Warwolf Belt</waist>
<legs>Dragon Subligar</legs>
<feet>Dragon Leggings</feet>
</set>
<set name="THF-TA">
<ammo>$MeleeAmmo</ammo>
<head>Empress Hairpin</head>
<neck>Chivalrous Chain</neck>
<lear>Suppanomimi</lear>
<rear>Brutal Earring</rear>
<body>Dragon Harness</body>
<hands>Rogue's Armlets +1</hands>
<rring>Rajas Ring</rring>
<lring>Woodsman Ring</lring>
<back>Amemet Mantle +1</back>
<waist>Swordbelt +1</waist>
<legs>Rogue's Culottes</legs>
<feet>Dragon Leggings</feet>
</set>
<set name="THF-DE">
<ammo>$MeleeAmmo</ammo>
<head>Optical Hat</head>
<neck>Soil Gorget</neck>
<lear>Coral Earring</lear>
<rear>Brutal Earring</rear>
<body>$DEBody</body>
<hands>$DEHands</hands>
<lring>Rajas Ring</lring>
<rring>Spinel Ring</rring>
<back>Amemet Mantle +1</back>
<waist>Warwolf Belt</waist>
<legs>Dragon Subligar</legs>
<feet>Hecatomb Leggings</feet>
</set>
<set name="THF-SB">
<ammo>$MeleeAmmo</ammo>
<head>Empress Hairpin</head>
<neck>Spike Necklace</neck>
<lear>$SBEar1</lear>
<rear>Brutal Earring</rear>
<body>Dragon Harness</body>
<hands>$SBHands</hands>
<lring>Rajas Ring</lring>
<rring>Spinel Ring</rring>
<back>Amemet Mantle +1</back>
<waist>Warwolf Belt</waist>
<legs>Dragon Subligar</legs>
<feet>Hecatomb Leggings</feet>
</set>
<set name="THF-Range">
<head>Optical Hat</head>
<neck></neck>
<lear>Suppanomimi</lear>
<rear></rear>
<body>Pahluwan Khazagand</body>
<hands></hands>
<lring></lring>
<rring>Woodsman Ring</rring>
<back>Amemet Mantle +1</back>
<waist></waist>
<legs>Rogue's Culotte</legs>
<feet>Homam Gambieras</feet>
</set>
</group>
</sets>
<rules>
<action type="equip" when="resting" set="THF-DE" />
<action type="equip" when="idle" set="Idle" />
<if status="engaged">
<if buffactive="Sneak Attack">
<action type="equip" when="precast" set="THF-SA" />
</if>
<elseif buffactive="Trick Attack">
<action type="equip" when="precast" set="THF-TA" />
</elseif>
</if>
<!-- This is my restore spell, casting Tonko: Ichi will get me into my default gear and then cancel the spell. -->
<!-- I can take out the extra rule to get into the idle set if I ever get Homam Manopolas -->
<if spell="Tonko: Ichi">
<if status="engaged">
<action type="equip" when="precast" set="$RestoreSet" />
<action type="Command">input /echo -----TP GEAR Equipped!!!-----</action>
</if>
<else>
<action type="equip" when="precast" set="Idle" />
<action type="Command">input /echo -----Idle GEAR Equipped!!!-----</action>
</else>
<action type="cancelspell" />
<action type="return" />
</if>
<!-- This is only processed in autoexec when I engage the mob. -->
<!-- This keeps my SA or TA gear equipped when I have precharged one before engaging the mob -->
<!-- If neither is precharged, it gets me into my TP gear -->
<if spell="Hyoton: Ichi">
<if notbuffactive="Sneak Attack">
<if notbuffactive="Trick Attack">
<action type="Command">input /ma "Tonko: Ichi"</action>
</if>
</if>
<action type="cancelspell" />
<action type="return" />
</if>
<!-- This is a manual gear change. I use this to equip ranged weapon, and set the Ranged var so I can stop ammo changes later. -->
<if spell="Suiton: Ichi">
<action type="var" cmd="set Ranged 1" />
<action type="var" cmd="set MeleeAmmo Acid Bolt" />
<action type="equip" when="precast">
<range>Staurobow</range>
<ammo>$MeleeAmmo</ammo>
</action>
<action type="Command">sc disable ranged</action>
<action type="Command">sc disable ammo</action>
<action type="cancelspell" />
<action type="return" />
</if>
<!-- This is a manual gear change. This does the opposite of Suiton: Ichi, it resets ammo changes and allows ammo swapping. -->
<if spell="Raiton: Ichi">
<action type="var" cmd="set Ranged 0" />
<action type="var" cmd="set MeleeAmmo Fire Bomblet" />
<action type="Command">sc enable ranged</action>
<action type="Command">sc enable ammo</action>
<action type="cancelspell" />
<action type="return" />
</if>
<if type="JobAbility">
<if spell="Sneak Attack">
<action type="equip" when="precast" set="THF-SA" />
<action type="Command">input /echo -----SA GEAR Equipped!!!-----</action>
</if>
<elseif spell="Trick Attack">
<action type="var" cmd="set SAEar1 Suppanomimi" />
<action type="var" cmd="set SAHands Rogue's Armlets +1" />
<action type="var" cmd="set DEHands Rogue's Armlets +1" />
<action type="var" cmd="set SBEar1 Suppanomimi" />
<action type="var" cmd="set SBHands Rogue's Armlets +1" />
<if notbuffActive="Sneak Attack">
<action type="equip" when="precast" set="THF-TA" />
<action type="Command">input /echo -----TA GEAR Equipped!!!-----</action>
</if>
<else>
<action type="equip" when="precast" set="THF-SA" />
<action type="Command">input /echo -----SA GEAR Equipped!!!-----</action>
</else>
</elseif>
<!-- Switches in Rogue's Vest on Hide, then switches back to whatever body was equipped before Hide -->
<elseif spell="Hide">
<action type="var" cmd="set CurrentBody %EquipBody" />
<action type="equip" when="precast">
<body>Rogue's Vest</body>
</action>
<action type="equip" when="aftercast">
<body>$CurrentBody</body>
</action>
</elseif>
<!-- Uneqippes Dusk Gear, and equips Rogue's Poulaines for flee, then switches back to feet -->
<elseif spell="Flee">
<action type="var" cmd="set CurrentFeet %EquipFeet" />
<action type="equip" when="precast">
<hands>$DEHands</hands>
<feet>Rogue's Poulaines</feet>
</action>
<action type="equip" when="aftercast">
<feet>$CurrentFeet</feet>
</action>
</elseif>
</if>
<if type="WeaponSkill">
<if NotTPLT="100">
<if spell="Dancing Edge|Evisceration">
<action type="castdelay" delay=".2" />
<action type="equip" when="precast" set="THF-DE" />
<action type="Command">input /echo -----DE/EV GEAR Equipped!!!-----</action>
</if>
<if spell="Shark Bite|Mandalic Stab">
<action type="castdelay" delay=".2" />
<action type="equip" when="precast" set="THF-SB" />
<action type="Command">input /echo -----SB/MS GEAR Equipped!!!-----</action>
</if>
<action type="aftercastdelay" delay=".2" />
<action type="Command" when="aftercast">input /ma "Tonko: Ichi"</action>
</if>
</if>
<else>
<if spell="Sneak|Monomi: Ichi" buffActive="Sneak">
<action type="midcastdelay" delay="2" />
<action type="command" when="midcast">cancel 71</action>
</if>
<elseif spell="Spectral Jig" buffActive="Sneak">
<action type="command" when="precast">cancel 71</action>
</elseif>
<elseif spell="Utsusemi: Ichi">
<if buffActive="Copy Image">
<if advanced='"Ut"="Ni"'>
<action type="var" cmd="set Ut Ichi" />
<action type="midcastdelay" delay="2.5" />
<action type="command" when="midcast">cancel 66</action>
</if>
</if>
<action type="command" when="aftercast">input /ma "Tonko: Ichi"</action>
</elseif>
<elseif spell="Utsusemi: Ni">
<action type="var" cmd="set Ut Ni" />
</elseif>
</else>
<if commandPrefix="/ra">
<action type="midcastdelay" delay="4" />
<action type="equip" when="precast" set="THF-Range" />
<action type="Command" when="midcast">input /ma "Tonko: Ichi"</action>
</if>
</rules>
</spellcast>