I need assistance adding a feature to my macro

I have been at this for a day now and need help creating a macro to cast spell a if harm exists and spell b if help is required.

Also I would like to use mouse over or target to heal.

I know how to create a macro for this with just the mouse over feature but I would like to have the added feature of clicking a target frame and still being able to cast a spell to that target.

Any help is appreciated. I don’t want an add on.

Here is my spell currently that I would like to change to ADD a click target feature

The below currently works
/cast [@mouseover,help]Riptide;[@mouseover,harmexists][harm]flame shock;[help][]]Riptide

Thanks for any help.

The macro that “works” has some typos in it.

Can you tell me if this is what you intend to happen?

If you have a helpable unit under your cursor, cast Riptide
Else if you have a harmable unit under your cursor or you have a harmable target, cast Flame Shock
Else if you have a helpable target or no target, cast Riptide

Assuming that’s correct, this should work:

#show
/cast [@mouseover,help,nodead]Riptide;[@mouseover,harm,nodead][harm,nodead]Flame Shock;[help,nodead][]Riptide

Pins are your friend.