Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refrencing script libraries?
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#1
Refrencing script libraries?

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).

04-06-2012, 07:38 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Refrencing script libraries?

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.

04-06-2012, 07:51 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: Refrencing script libraries?

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.

Tutorials: From Noob to Pro
(This post was last modified: 04-06-2012, 07:58 PM by Your Computer.)
04-06-2012, 07:57 PM
Website Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#4
RE: Refrencing script libraries?

Sad sad day. Oh well, thanks a lot for the help!

04-06-2012, 08:58 PM
Find




Users browsing this thread: 1 Guest(s)