artix5455, please do not bump your topic unless it has been 72 hours later since your last post. You can review our forum rules here. Thank you.
Also, please link to the origin of the scripts, do not copy them here (in part or complete), because a lot of scripter don't like that and it makes bughunting difficult.
Another question: Did you start a new game after installing the scripts?
Any "NIL"-Error usually means that you are missing something, either because it was not initialised (which only happens on new game, not on loading old saves) or because you didn't include all scripts neccessary for a more complex script system, or because you failed to follow the script's direction for configuring it...
If it only happens if you use magic, then check the notetags for your magic skills if everything was set like the script demands