Macro help please

is there a way to create a macro that can target last target and if dead /use item?

Possibly. Depends if the conditions are evaluated immediately or after the target switch.

/targetlasttarget
/use [dead] whatever

unfortunately that wont work for what i am trying to do.
Trying to find a way to macro in the toy “The Flag of Ownership” with attack macros so it just fires off. Problem is that it takes druids out of Feral form when you try to use it.

so I need to figure out something that will only let it be used once out of combat.
I was hoping there was a way to pull it off.

that’s easy add this as the first line:/stopmacro [combat]

unfortunately, it doesnt work with my setup.
I hit my button that puts me into stealth if possible and it winds up taking me out of stealth and cat form.
This toy needs an update to not take you out of form

EDIT: I have an idea, but going to have to go test this out in some pvp after killing enemy faction player and see if it will work without messing with macros or trying to fire off when I dont want it to.
/stopmacro [nocombat]
/use [nostealth,dead] The Flag of Ownership