Couldn't find anything that works in vanilla. Like the title says, I'd like to be able to tell my pet to attack, or tell it to follow depending on if it is already targeting something.
As requested - I believe this is what you're looking for.
/script if UnitExists("target") then if a==0 then PetAttack(target) a=1 else if UnitExists("pettarget") and UnitIsUnit("target", "pettarget") then PetFollow("YourNameHere") a=0 else PetAttack(target) end;end; else PetFollow("YourNameHere") a=0 end;