It will not give a very strict answer but I'm not really 100% sure what it is that you are asking about. Generally you have two ways of scripting in rom:
1. a macro - it's usually simpler but it can do a lot (interact with npcs etc.); it basically can only be triggered by a keyboard shortcut or mouse click on an action-bar button; there are several good examples e.g.
here - if you look at the examples you will see how to use an item or use a skill in a macro (incl. "if" conditions, "for" loops etc.);
in your case: you would have to pay attention to your health and if it drops bellow 50% hit a key which would trigger the macro activating a set of special skills you need.
2. lua/addons: more complex to set up; more powerful in structure (e.g. length of macros is limited, length of lua scripts is not), can react to certain "events" (like chat strings) etc. BUT: I don't think there is an event notifying about hp drop, and probably you don't want to run complex checks constantly (and actions you can run on this kind of constant "refresh" events is limited exactly to avoid too much automatisation); so my first impression is that you would not be able to trigger such action totally automatically when your health drops
2a. there is a nice addon that is really simple to use for simple actions: it's called "do it yourself combat engine"; it lets you use flexibility of lua in a simple way; you define a number of actions and a number of conditions when which of them should be triggered; it does not let you do more than what you can anyway do with macros or lua, but does help you line things up; the script does not run by itself, you need to hit a specific key; but what it would do could depend on a number of conditions; so you can easily write a diyce script which does something like:
* if my health is more than 50% use XXX attack skill
* but if my health is bellow 50% use skill YYY (Survival Instinct or whatever) instead
You still need to hit the key, but the logic inside the script would remember for you to use the low-hp skill when your hp is low.
I guess the question is what do you mean by a "macro driven by your current H/P". If you want an action triggered automatically just by the fact that your HP dropped - I'm not sure but I think it is not possible (and most people would not consider it fair use of macros). If you want an action triggered by your clicks but with internal logic based on your current HP - DIYCE may be the answer. Still, maybe a simple macro would be enough (you can use "if" in a macro => see the link above for some examples).