Advanced Script Compiler for NWN2 release thread
#51
Geschrieben 04 September 2012 - 09:22
He does not like it when people change his scripts, and end up botching everything and then don't support their changes. He ends up getting a lot of users coming to him for help and after way too much effort wasting his time, they reveal they are not using his scripts but something which is not even set up properly. This has been going on for a long time.
He basically is not letting those who were wasting his time get his source anymore, if you are not one of those people he emails the source as needed.
If you need his source files, you need to talk to kaedrin, not skywing. Just send him a PM.
#52
Geschrieben 04 September 2012 - 11:37
if you need to know the details, the pack includes ncs files not nss files so I cannot see the scripts. I am using custom feats to cast about six spells and need to modify those spells so they work for those with zero caster levels. But since I was going to support the Kaedrin pack, users of that might get annoyed if my updates to broken standard scripts result in casting of broken spells. He already just kindly gave me the fix for darkvision which I have implemented separately. I didn't want to bother him with six other script requests. That was the only reason why I wanted someone to tell me how to use the advanced script compiler to decompile a single script. I have created about 10 large modules in NWN and NWN2 and am not in the habit of wasting people's time.
Anyway thanks for the lecture.
JM
#53
Geschrieben 06 September 2012 - 12:40
He SAID to pm him.
He has sent me those nss files, since i needed the same thing. He sends me a copy whenever he's got another version up. I will not however let others have those since he wanted to choose who gets them, nor is decompiling his ncs files a work around since he is offering to email them when needed.
He prefers to do this because it means he can review what you are doing and prevent wasting much more of his time via end users having borked versions of his content.
#54
Geschrieben 07 Januar 2013 - 09:03
So may I ask? Is the source code available and usable for this purpose?
Sorry for my bad english, it's been a long time since school XD
#55
Geschrieben 08 Januar 2013 - 04:17
http://social.biowar...9/index/3116521 has a recent drop of it.
Bearbeitet von SkywingvL, 08 Januar 2013 - 04:19 .
- dunahan_schwerterkueste_de gefällt das
#56
Geschrieben 08 Januar 2013 - 02:17
#57
Geschrieben 02 März 2013 - 07:32
Release 13:
-----------
- Added -j option to standalone compiler to show where an include file was
really picked up from (useful for debugging include priority ordering
problems).
- The compiler now correctly disambiguates between struct tag symbols and other
symbols (improved language conformance with the BioWare compiler).
- Added support for recognizing the GOG.com NWN2 edition installation path.
Bearbeitet von SkywingvL, 02 März 2013 - 07:32 .
#58
Geschrieben 02 März 2013 - 07:10
thanks Sky.
Say, I just realized I have all my base game scripted resources in my Override, but the #includes are strewn about in various subdirectories. So presently I'm using
-l
to load the base resources (which gets really taxing on my system when I compile my entire Override from a batchfile: load, unload, load, unload as it recurses subdirectories). I removed -l and tried out
-i path[;path...]
and that works great -- except I have ~6 very long path strings (that can also change at any time). So I'm wondering, is there a way to use -i path_to_dir
and then let the ASC search subdirectories for #includes?
#59
Geschrieben 02 März 2013 - 07:54
Subdirectories are searched if they are a part of a module directory itself that is being loaded, or part of the resource system initialized to match the game's resource loading strategy if -l is used. The -i include file directories option is handled more like your C compiler would, just a semicolon-delimited list of include directories to search without recursion. (It's also okay to use -i multiple times, the list appends, the same as -i path1;path2.)
#60
Geschrieben 03 März 2013 - 03:00
yes. I've been using *.nss as input for some time ... but without the -b switch, and it works great when compiling a single directory full of mixed files.SkywingvL wrote...
You can compile multiple scripts with the same NWNScriptCompiler.exe invocation, which will avoid loading/unloading things every time.
But... using the -b switch it seems I have to list out the input files and what directories they're in(?) Because *.nss as input gives output files like "script.nss.ncs" ( yet correctly names the output as "script.ncs" when not using -b ) And this still leaves an issue, for me, of automatically recursing subdirectoriesUse -b to specify the output directory and then specify as many files/wildcard patterns for input as desired (not all need be in the same directory).
- just a note, unless i'm overlooking something else .... -b keeps appending ".nss.ncs" onto wildcarded scriptnames. :\\
- typical command line:
currentDir>f:\\asc -gl -b . -y *.nss
#61
Geschrieben 03 März 2013 - 06:51
#62
Geschrieben 03 März 2013 - 07:29
:|_~
edit, still working otherwise fine as ever, SvL
Bearbeitet von kevL, 03 März 2013 - 11:30 .
#63
Geschrieben 04 März 2013 - 05:12
#64
Geschrieben 04 März 2013 - 07:52
ps. Don't laugh ->
for /r . %%1 in (.) do f:\\asc -aglo -i . -v1.69 -y "%%1\\*.nss"
- now that i look at it, I just have to expand -i to include the #includes ... (then -l can be taken out
#65
Geschrieben 21 August 2013 - 10:15
https://github.com/C...verwinterScript
This package provides :
- Syntax Highlighting
- Auto completion for NWScript built-in constants
- Auto completion for NWScript built-in functions with their arguments
- Quick build with the AdvancedScriptCompiler (for Windows or Linux using wine)
Hope this might be useful
(Also, thanks Skywing for this awesome compiler !)
Bearbeitet von CromFr, 21 August 2013 - 10:16 .
#66
Geschrieben 28 Januar 2014 - 08:51
Release 15:
-----------
- Added -k option to standalone compiler to generate a pseudo-preprocessed
version of script source text, annotated with originating line numbers and
file names (useful for diagnosing problems with conflicting #includes).
- Fixed internal compiler assertion when printing out the error diagnostic
for a duplicate default: block in a switch statement.
- The compiler was not previously issuing an error diagnostic if a duplicate
case select value was supplied within a switch statement (longstanding bug
dating back to nwnnsscomp). This has been rectified with new error
diagnostic NSC1089: Case value '<integer>' already used. Previously, code
for duplicate case blocks would be generated silently.
#67
Geschrieben 28 Januar 2014 - 10:57
At the moment I'm using a version of nwnnsscomp that was modified for Star Wars: KotOR to not require a specific game installed on your machine (nwnnsscomp_st). It works if I copy the NWN2 version of nwscript.NSS into the same directory, although it decompiles to .pcode format that is difficult to make sense of (although at least you can see what functions are being called).
#68
Geschrieben 29 Januar 2014 - 10:58
#69
Geschrieben 29 Januar 2014 - 04:07
never tried it tho.
#70
Geschrieben 29 Januar 2014 - 10:10
kevL wrote...
yes it has -d parameter. Disassemble the script (overrides -c Compile)
never tried it tho.
Well, it works - but the ASC also decompiles to pcode, rather than NSS.
#71
Geschrieben 29 Januar 2014 - 10:25
I looked into decompiling once.. upon a time.. then figured my time would be better spent counting grains of sand on a beach in Maui -- with tweezers and a blindfold and a 500 lb. gorilla on rabies nearby.
#72
Geschrieben 30 Januar 2014 - 02:29
Thief/Acrobat: Well I take downers; helps me stay steady. Perchance we can exchange dealer cell numbers?
GM: *sigh*
Thief/Acrobat: I would LOVE to have a poison bite!!
Bearbeitet von Morbane, 30 Januar 2014 - 02:31 .
#73
Geschrieben 30 Januar 2014 - 02:33
Dwarf: Befriend the gorilla by pulling out the tweezers.
GM: ............
#74
Geschrieben 30 Januar 2014 - 03:47
DannJ: Yes, you can disassemble a script. As with nwnnsscomp, -d will give you a .pcode file that is (basically) an NWScript assembly language listing of the script. You need to tell the compiler how to load nwscript.nss for the script in order for this to work, so continue to use -l (or a path to nwscript.nss with -i). This is necessary for the static analysis package to function (producing the .ir and .ir-opt files as you'll see below).
In addition to the pcode output, you get two more files:
- A <script>.ir file, which is an "intermediate representation" of the script after running the NWScript binary through a static analysis package that is used by the NWScript accelerator to JIT the script to .NET code. The script's IR is sometimes easier to read than the raw NWScript assembly language listing, as the static analysis engine discovers functions, flattens the script stack out into variables, etc. Basically speaking, each "variable" here corresponds to a logical location on the NWScript stack.
- A <script>.ir-opt file, which is again an intermediate representation of the analyzed script, but after running the compiled script through an internal optimization pass to fold variables that were purely temporaries together into merged variables. This is often easier to read than the .ir file.
Here is an example that you might see for a function in NWScript:
struct Struct2 Function1()
{
struct Struct2 Variable;
Variable.Value = 0;
return Variable;
}
The NWScript assembly listing for this function might look something like so (i.e. the "pcode" output that you would get in the .pcode file):
00000037 02 03 RSADDI
00000039 04 03 00000000 CONSTI 00000000
0000003F 01 01 FFFFFFF8 0004 CPDOWNSP FFFFFFF8, 0004
00000047 1B 00 FFFFFFFC MOVSP FFFFFFFC
0000004D 03 01 FFFFFFFC 0004 CPTOPSP FFFFFFFC, 0004
00000055 01 01 FFFFFFF4 0004 CPDOWNSP FFFFFFF4, 0004
0000005D 1B 00 FFFFFFF8 MOVSP FFFFFFF8
00000063 1D 00 0000000C JMP off_0000006F
00000069 1B 00 FFFFFFFC MOVSP FFFFFFFC
0000006F 20 00 RETN
The .ir file listing for this function would be something like this (note that the disassembler can only give you a name for a function if you had a .ndb file as I did here):
Printing IR for function 0000002A (Function1)
label 0000002A:
0000002A: CREATE 097B40F0 ( temp int )
0000002A: INITIALIZE 097B40F0 ( temp int )
0000002C: CREATE 097ABFC0 ( temp SSA int )
0000002C: ASSIGN 097ABFC0 ( temp SSA int ), 097B4248 ( const int ) [0]
00000032: ASSIGN 097B40F0 ( temp int ), 097ABFC0 ( temp SSA int )
0000003A: DELETE 097ABFC0 ( temp SSA int )
00000040: CREATE 097B44B0 ( temp SSA int )
00000040: ASSIGN 097B44B0 ( temp SSA int ), 097B40F0 ( temp int )
00000048: ASSIGN 0979B7B0 ( retval int ), 097B44B0 ( temp SSA int )
00000050: DELETE 097B44B0 ( temp SSA int )
00000050: DELETE 097B40F0 ( temp int )
goto 00000062
label 00000062:
00000062: RETN
And the .ir-opt file listing for this same function would look like so:
Printing IR for function 0000002A (Function1)
label 0000002A:
0000002A: CREATE 097AEC20 ( temp int )
00000032: ASSIGN 097AEC20 ( temp int ), 097AED78 ( merged const int ) [0]
00000048: ASSIGN 0979AAF8 ( retval int ), 097AEC20 ( merged temp int )
00000050: DELETE 097AEC20 ( temp int )
goto 00000062
label 00000062:
00000062: RETN
If you really wanted something easier to read for a script, you could grab the NWScript Accelerator NWNX4 plugin, install it on a dedicated server instance with NWNX4 in use, set CodeGenOutputDirectory= to point to a writeable directory and run the script from that server instance. That would generate a managed code .DLL for the JIT'd-to-.NET script in the CodeGenOutputDirectory. You could run this through one of the .NET disassembly tools to see if it could produce a C# representation that's easier to read. (Or ILDasm if you prefer to read MSIL instead.)
But these are fairly esoteric use cases... unless you're working on the compiler (like I am), or the NWScript JIT system (like I am), you're probably not going to need that level of detail.
Given a .ndb file and the .ir-opt file, and some familarity with what's going on under the hood with how the NWScript instruction set works (and the IR for my script analysis library), you can usually get a fairly feel for what's going on, but it's not by any means for the faint of heart.
Bearbeitet von SkywingvL, 30 Januar 2014 - 05:53 .
#75
Geschrieben 30 Januar 2014 - 03:59
jk!





Nach oben






