Apple Script runs fine, need kill switch
Crossing the user session barrier is non-trivial. Typically a local host only network connection is used, such as TCP/IP or a Mach port. These are complex to set up with AppleScript.
Below are a couple of reasonable alternatives.
File Based Flag
You could use the existence (or lack of) a file to determine how the script behaves:

On launch, script creates an accessible file at a known path:
/Users/Shared/delete-to-stop-power-script.txt

Periodically, or via kqueue, the script can check the file still exists;

On exit, the script should remove the file.


Using files makes dealing with permissions easier. Use chmod 0666 to allow anyone to delete the file.
The access permissions of the file can be used to ensure only specific groups of users can delete the file.
notifyutil
Use the lesser known notifyutil utility:

notifyutil is a command-line utility for interacting with the notify(3)
notification system and the notifyd(8) server.  It may be used to post
notifications, detect and report notifications, and to examine and set
the state values associated with notification keys.

notifyd allows processes to exchange integer values across processes and user sessions. The format is deliberately simple and constrained to enforce security.
See the linked manual page and Brett Terpstra's Quick Tip: system-wide notifications with notifyutil for samples.
Non-polling
If you need a non-polling alternative, Power Manager can trigger scripts on battery levels, offers a power source scripting API, and non-administrator users can be granted rights to cancel or stop events.
I am a software engineer involved with Power Manager, so feel free to ask me technical questions about how it works.