Jump to content

Recommended Posts

questscripts.txt bundle

View File


  • lua script formatting tool + source code
  • for each Addendum, Dark mod and Sacred 2 EE 3.2A:
    • questscripts sorted into different folders/files to increase overview and moddability
    • all scripts formatted and beautified
    • all known questscripts.txt bugfixes
    • merging tool to merge all scripts into a single questscripts.txt
    • pre-merged questscripts.txt
    • The security of no syntax errors being present due to it being tested with the standard lua interpreter
  • merging tool source code
  • source code README.txt with detailed description of the tools
  • overall README.txt with detailed description of the files (Dmitriy if you consider using it then you should read this)


detailed description:


Contains questscripts.txt bundle for Addendum, Dark mod and Sacred 2 EE 3.2A.

Questscripts have been sorted manually into folders to increase overview and simplify modding. There's an exe provided which merges everything into a single questscripts.txt.
Also contains already merged questscripts.txt for all three mods.

The questscripts.txt fixes I posted into the forum are all present. @Dmitriy: The FTYPE_MAGICLIGHT spelling error also exists on the dll level, as I discovered, so for EE, FTYPE_MAGICLIGHT definitely is the correct syntax. I don't know wether you fixed it in your dlls, but I acted as if you didn't, so I reintroduced the FTYPE_MAGICLIGHT spelling mistake in the scripts.

The final questscript.txt has been tested by me for syntax errors using the standard lua interpreter. There are none.

Formatting for everything in EE 3.2A except questscripts_core.lua and cutscenes.lua has been done by hand.
Everything else in EE 3.2A has been done by machine using prettify.exe (my lua script beautification tool).
Everything in Addendum has been done by machine.
Everything in Dark mod has been done by machine.

questscripts_special.lua, platten.lua and area_NPC-spawn.lua have been copied over from EE 3.2A into Addendum and dark mod to save me from triple formatting by hand because my prettify.exe had trouble with those scripts. If Dmitriy touched any of those functions, they are now set back to EE state. Unlikely, but possible.

The source code + exe for prettify.exe as well as the source code for merge.exe. The source codes are platform independent but the exes only work on windows due to the wrapper I used to create the exe binaries. Should be clear since exe is just for windows.
Nothing speaks against using prettify.exe on other files as well. I suggest quest.txt. It will take a while, though.

There are known bug for prettify.exe which had to be corrected manually by myself. Look into source code's README.


@dimitrius154 @Flix


Link to comment
On 6/11/2023 at 12:27 AM, dimitrius154 said:

Hmm, I see no erroneous references within the code.


The data comes directly out of the dlls, can't remember which EE version it was. Look at "questscripts.txt stuff/FXTYPTES". The first entry is "FTYPE_MAGICLIGHT".

Link to comment

I think the important point is the value in the scripts matches the value in the dll's.  You might rightly call it a typo but the fact it works as it is, right?

Link to comment
11 hours ago, Flix said:

I think the important point is the value in the scripts matches the value in the dll's.  You might rightly call it a typo but the fact it works as it is, right?

That's exactly my point.


11 hours ago, Flix said:

but the fact it works as it is, right?

I don't know this for sure. Someone needs to test it with all the different game versions.

Link to comment
1 hour ago, Lindor said:

I don't know this for sure. Someone needs to test it with all the different game versions.

Hmm, the typo was there after all.  The function is 101AF7DB ?getKind@cQuestStatic@@QBE?AW4eQuestKind@@XZ. Effectively, if the typo is present within both s2logic.dll and questscripts.txt, the fx static works.

  • Appreciation 1
Link to comment

I found a typo in the very first thing I checked. Line 148.

if (not args.singleplaye)

Should say 'singleplayer'.   Feeling some trepidation about adapting this for use in any mods.

  • Thanks! 1
Link to comment
12 hours ago, Flix said:

I found a typo in the very first thing I checked. Line 148.

if (not args.singleplaye)

Should say 'singleplayer'.   Feeling some trepidation about adapting this for use in any mods.

This shouldn't be the final version; there will hopefully be future updates if I find the time.

Unfortunately it seems to be impossible to debug these scripts ingame. I can only check for syntax errors using the standard lua interpreter, but this doesn't detect semantic errors or typos like this, or by doing it manually, but this is time consuming and risky as humans make mistakes.

Currently I know that I have to further develop and debug the code prettifyer which is doable. It's on my to-do-list for this weekend.



However at some point you just have to trust it and go with it, even if you know there are bad or even possibly game crashing mistakes. The community will report them so we can backtrace and correct. That's how it works. The script is simply too massive to ensure complete safety.



As for your report: thanks, things like these are super important information for me. I expected there to be errors which I couldn't find. Please continue reporting any mistakes you find.


And maybe I can calm you a little bit: Line 148 is pretty early in the script which means the mistake is human error since I formatted all the early functions myself and not by machine. That you found one right at the beginning is not an indicator about the mistake density. If you found one late in the file which wasn't there before so it got introduced by machine, that would be an indicator for a higher mistake density and it's even more important to find those errors so I can backtrace it in my prettifyer's code to see what went wrong.

Link to comment
  • 3 weeks later...

I want to give some perspective:



v2.0's purpose is to minimize manual work and to maximize machine work. The code prettifier 2.0 has been finished for quite a while now and also the new questscripts.txt files are already constructed since a couple of weeks. What takes time for me is to write the split.lua/.exe since I have planned to automate the sorting process as well.

Ideally only the semantic changes (the questscripts.txt fixes) would need to be applied manually, syntax would be handled completely automatically to minimize human error potential. There are still a couple of known bugs in 2.0. Those bugs had to be corrected manually by myself, I used N++ with compare plugin and standard lua interpreter to validate my work and I'm like 99.99999% sure that I got everything and there is no human error left.



I could fix those bugs within the current prettifier logic system, but that would explode runtime to at least a double, maybe even quadratic. I have a plan to handle this, but for that I need to start from scratch and completely rewrite the syntax beautifier. This will then be v3.0, the final version.

But 3.0 is like 100000% of work for like 0.0001% of gain. If I'm right, then 2.0's questscripts.txt are already top notch and there won't be any gain. It's just that 3.0 will have that little bit of extra safety because literally everything regarding syntax will be done by machine. For the mod creators I recommend to not wait for 3.0 and take 2.0 once it comes out. 3.0 will take an eternity, but 2.0 won't be very much time until release I think, depends on my real life.



You may request me to upload the current as 2.0alpha or smth like that if you want to, the syntax is completely finished but the functions aren't as sorted and commented out as 1.0's are and 2.0's/3.0's will be.

Edited by Lindor
Reason: spelling mistake
Link to comment
  • 7 months later...

I know that there were roughly three versions planned, v1, v2 and v3

I know that the current stage is v1 and v2 never got released.

I know that v1 had issues which I wanted to fix for v2 before making v3.

I know that I was very close at finishing v2 when I decided that it wouldn't be worth the time an I could just straightly jump to v3.

I know I have had an idea for a better lua code beautifyer for v3. I had a very specific idea and wanted to code it entirely different to what I had for v3. I just can't remember the idea anymore.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...
Please Sign In or Sign Up