Just so I have this straight... You need a script attached to a spell. When the spell hits the target you want the script on the spell to do something to that target, right?
In that case, a simple script like;
CODE
ref target
begin scripteffectstart
set target to getself
target.<insert function here>
end
should work. If however I have this wrong, and you want the target to be known before the spell hits, then you may be a bit out of luck as that can't really be done.
You could also set the reference in another script (like a quest script (set <questname>.<refname> to getself)) if you wanted other scripts to access that reference. However this can cause significant problems if the target isn't a persistant reference, or the reference isn't cleared out before that reference becomes invalid.