Frictional Games Forum (read-only)
Script helpers by modders for modders - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: SOMA (https://www.frictionalgames.com/forum/forum-55.html)
+--- Forum: User created content (https://www.frictionalgames.com/forum/forum-79.html)
+---- Forum: Development (https://www.frictionalgames.com/forum/forum-82.html)
+---- Thread: Script helpers by modders for modders (/thread-31236.html)



Script helpers by modders for modders - Vale - 10-08-2015

I was thinking that as a modding community it might be a good idea to create our own helpers as we get more used to hpl3. While its a bit out of reach right now, I think before long it would be wise to set up a modders helper library for various functions that people might find useful, which modders could download and add to their mods.
For example, it would probably be possible to make an hpl2 helper which lets you use imitations of the scripts in hpl2 with the same syntax.
Any thoughts?


RE: Script helpers by modders for modders - Mudbill - 10-08-2015

I've had this thought as well, and I think it's a great idea. We gotta make sure it's easy for people to understand how to apply though, or else people might be scared to try them. A convenient and user-friendly library would work, either on the wiki or the forums (or both).


RE: Script helpers by modders for modders - Vale - 10-08-2015

Alright.
After I finish up the wiki page on terminals Im going to look into setting up a simple helper library.
I'll be going with the hpl2 imitator library for now unless anyone has a better suggestion?


RE: Script helpers by modders for modders - TheGreatCthulhu - 10-08-2015

^That's not a bad idea. I think you can mostly just wrap existing functions with the ones in your library. You can probably make it all in one .hps file. (Some aspects could prove tricky (or not), but if something too tricky comes along, you might be able to simply omit it - as long as the library supports the most used/useful functions, it should be fine.)
Using it should then just be a matter of a adding a single #include.


RE: Script helpers by modders for modders - Vale - 10-08-2015

Alright. I may open a thread somewhere asking what functions people miss most from hpl2.
And yeah, having a single include is the idea. I think it will be mainly for people experienced with hpl2 who dont want to have to learn hpl3.


RE: Script helpers by modders for modders - PathOS - 10-08-2015

For newcomers not familiar with HPL, is there a document or description which best summarizes what these "Helper" objects do?

I know they are important as Jens in another thread pretty much emphasized that most people who wish to do anything in the editor should be using them almost all the time.

Thanks!


RE: Script helpers by modders for modders - Vale - 10-08-2015

Ok, so heres the idea of a helper. (Not only does hpl use them, but most programming languages have some form of them.)
Imagine you create a bunch of functions that you can use between a bunch of maps. Rather than coding them for every map, you code them into another 'helper' hps file which you include in each map. You can then use these functions in that map!
So a function like ImGui_drawGfx(), which may seem like something hardcoded into Soma, is actually a function coded somewhere else and included with a #include.
Its no different from you making a custom void myFunc().


RE: Script helpers by modders for modders - PathOS - 10-08-2015

So would you say that Helpers have a similar function in a sense to "Prefabs"? (which to my understanding are bundles of assets grouped together). I'm not a coder/programmer so I'm trying to relate Tongue


RE: Script helpers by modders for modders - Mudbill - 10-08-2015

It's a common file used throughout multiple script files.

If you know of The Second Dimension (which I'd find likely) and looked at its code (which I'd find unlikely), you'd see that there's a section in every map that had the exact same code. It's under a comment that says //GENERAL SCRIPTS or something. This is because Amnesia does not use the #include, so MrBehemoth had to add the same code to every file in order to access it.

If we made a helper file with useful helpers, then others could download that, use #include, and then use those helpers without having to know how they work under-the-hood. For example, we could have a function there like CreateExplosion(). The user of this helper would give it some arguments, like position, velocity etc. but the function itself in the helper file would be specifying things like "GetPosition, PlaySoundAtPosition, CreateImpulse, AddScreenEffects" and so on, which the user would not need to touch or even know about. They just need to know the result. Hope this makes sense.


RE: Script helpers by modders for modders - TheGreatCthulhu - 10-08-2015

Quote:"Prefabs"
Well, in some sense, I guess you can think of them like that. Scripts that offer functionality you can reuse in many different projects and in various ways.

But Jens was talking about something slightly different. In HPL2, the scripting system consisted more or less of a bunch of functions that you could call in user scripts, but that were defined in the game engine itself (as in, embedded in the game executable files).
With HPL3, there are also functions and some other stuff defined in this way, but they are much more low-level (that is they are much more "closer" to the "core" engine features other stuff is built upon), and there's quite a bit more of them.
Then there's a whole another level (or two) of script code written "on top" of those core features that makes all kinds of things happen. To work with that directly, you have to know quite a bit about programming.

However, FG then created on top of all that these helper scripts that make it much more simpler to use that stuff, and make scripting feel more like it was in HPL2/Amnesia - and these are the helper scripts that Jens was talking about.
For what most people will be doing, these will suffice for pretty much everything you can think of.
So, they are important in the sense that here they play the role engine script functions played before in HPL2.
And there's a lot more of these helper functions this time around, so there's a lot more things you can do. And while some of the documentation on the wiki is still being prepared - for helper functions, there's documentation in the .hps files themselves that scripters can make use of, so that's pretty neat.

(10-08-2015, 08:50 PM)Mudbill Wrote: If you know of The Second Dimension (which I'd find likely) and looked at its code (which I'd find unlikely)

Hehehe @ that second part Big Grin

I guess when most people look at the code they go: "What sorcery is this?!"