Jump to content
t1a2l

Scripting Question

Recommended Posts

8 hours ago, t1a2l said:

Hi, 

I am trying a little scripting and I wondered if i could take all the scripts files and combine then into one file? also can I use visual studio or eclipse as a script editor? can i save the project as a script file?

Thanks anyway.

Yes, you can combine all scripts into one .script file but you must make sure the whole 'structure' of each script file remains intact.

You can use Visual Studio or Eclipse, but you cannot debug any scripts, cannot run any scripts, and cannot compile them. The game is the only thing that can read scripts, and even then, the game doesnt give a conclusive error line or code. Your best bet is simply editing them as code in C language, which is what the game uses, and just editing it as code. After that, its all trial and error, as it is with this game.

Note that there is no benefit to merging the scripts into one single file. The game loads scripts on a per 'command' basis, so you cannot merge them. If using the LA mod or any mod using its scripts, you cannot merge scripts period. Each script relies on a set of constant character variables specific to each script, so they cannot be merged, or else you will have one convulated mess on your hands.

Link to comment
Share on other sites

It's actually a subset of C++ since it has the built in ability to create Objects and Classes. Definitely not C#. C# code looks much different.

The scripting language used is proprietary. While many of the built in functions, syntax, and features of the scripting language make it look like its pure C++, it is not. It's a scripting language created by STE that took a subset of features from C++ and was structures the same as C++. They probably saw it easier to do that than create a language from scratch since they were already coding the game in C++, so there would have been a minimal learning curve when it came time to create the scripts since they already more or less knew the language. 

Since scripts are not real C++, more of a C+- in reality, you cannot use tools made for C++.

As itchboy stated, the game compiles scripts itself so precompiling is not possible. From my investigations, I believe that scripts are actually interpreted rather than compiled. When a modification is loaded, the script is translated from human readable code to byte code. When a command is ran, it is then interpreted by the game, hence why most errors are thrown at runtime and not when the game is loaded.

 

On a second note, I would never consolidate scripts into one file unless you have to, which is the case with mission scripts. It makes maintenance a nightmare. Ever try to debug a 30,000 line long script file? In my book, more, smaller script files are the best way to go.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...