Frictional Games Forum (read-only)

Full Version: Refrencing script libraries?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know for scripting languages you can generally (read: always) build your own libraries of functions that can then be referenced from other scripts, and I was wondering if it is possible to do this kind of this with the level scripting for the hpl2 engine. I don't really know anything about AngelScript beyond what I've used to script levels with, but I have a list of function declarations that I would like to put into a library and have added to the script function list. Is this possible at all, or am I eternally doomed to copy and paste my list of functions into every script hps file?

Also as a bonus question, is it ok to have script below the "OnStart""OnEnter" and "OnLeave" functions? I remember from way back when when I tried to teach myself some cpp, I remember something about the order which functions are declared being important, but I don't really remember what these rules were exactly, so if someone could refresh my memory and tell me whether or not they apply to my dear hps files (though I assume that they would).
AngelCode has the keyword import, but I wasn't able to get it to work. Importing a function would let me call it, but it wouldn't do anything. Since AngelCode, like C++, ignores whitespace, you can delete all your return characters (newline characters) and compress your script into a single line once you're done writing it. That way when you copy and paste it over to another map, it doesn't take up a huge amount of screen space. Just be sure to make a comment so you know what that line of code does.

And yes, there's no requirement as to the order of the functions.
http://www.frictionalgames.com/forum/thread-12023.html

FYI, import only works if the module already exists. However, you cannot (AFAIK) create your own modules in HPL2.
Sad sad day. Oh well, thanks a lot for the help!