Author Topic: Has anyone been able to mod Toolset?  (Read 8814 times)

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #120 on: January 21, 2012, 06:22:22 pm »


               Is it me or have you wonderful peeps finally sorted out the "Takes ages to delete objects" problem? I've just deleted an item I got wrong and it went in a flash instead of locking up the toolset for ages. Woot!!! You've speeded up deleting scripts as well. Love you peeps. ':wizard:'
               
               

               


                     Modifié par Borden Haelven, 21 janvier 2012 - 06:24 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #121 on: January 21, 2012, 08:40:30 pm »


               Heads up. I'm using a slightly older version of Skywing's compiler, but I had another of our devs check on the compiler he downloaded with the latest version of NWTX yesterday, and the problem is still there. It seems the compiler doesn't notice if implementation and declaration differ in default values. This declaration and implementation yeild no compiler errors:


fky_loot_inc (78): string GetRandomResrefLootBeyondUltraRare(int nRaceBkSlots=1, int nCraftBkSlots=7);
fky_loot_inc (2717): string GetRandomResrefLootBeyondUltraRare(int nRaceBkSlots=1, int nCraftBkSlots=2) {
And again, thanks for your work on this incredible tool. '<img'>

Funky
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #122 on: January 21, 2012, 09:15:05 pm »


               I will look into adding a warning about this.

However, because the standard compiler is silent about this sort of construct, there are standard scripts that will trigger the warning.

The observed behavior will be that the first declaration observed takes precedence in terms of the default values assigned.
               
               

               


                     Modifié par SkywingvL, 21 janvier 2012 - 09:15 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #123 on: January 21, 2012, 09:23:42 pm »


               

SkywingvL wrote...

I will look into adding a warning about this.

However, because the standard compiler is silent about this sort of construct, there are standard scripts that will trigger the warning.

The observed behavior will be that the first declaration observed takes precedence in terms of the default values assigned.

Thank you very much. '<img'> We'd guessed as much about the declaration, based on the behavior of C and C++ compilers, but it's good to know for sure.

[Edit] I mis-read/spoke. We'd guessed, based on the behavior of the other compilers, that the implementation, rather than the declaration, was defaulted to, but it sounds like that isn't the case.

Thanks again,
Funky
               
               

               


                     Modifié par FunkySwerve, 21 janvier 2012 - 09:26 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #124 on: January 21, 2012, 10:35:34 pm »


               For the record I have noticed that declarations and implementations of functions can differ in other ways as well, and not generate compile errors.
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #125 on: January 21, 2012, 11:04:37 pm »


               

henesua wrote...

For the record I have noticed that declarations and implementations of functions can differ in other ways as well, and not generate compile errors.


With the new compiler or the standard one?  The standard one does not check many things.  I'd like to hear what the remaining unchecked mismatches are for the new compiler.

(Different identifier names for parameters don't count; I consider that by design and C/C++ certainly permit that.)
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #126 on: January 21, 2012, 11:18:29 pm »


               I am adding an additional pragma extension:

#pragma pure_function(function-symbol-name)

For example, #pragma default_function(foo)

The function-symbol-name must be declared as a function before the pragma is parsed. The effect of the pragma is to mark the function as having no side effects in the compiler. This allows the compiler to optimize calls to that function away in certain cases (currently the optimizer's dead subexpression optimization is very limited, however; if someone is interested in contributing a better optimizer framework, there's some infrastructure to use it). It also allows a non-const global variable whose initializer expression involves a call to foo to be considered for making the global variable an inlined constant if the global was suitable.

This may change program behavior if applied incorrectly. A function tagged as a 'pure function' must not modify any globally visible state, i.e. it should not write to global variables or call functions that modify global state or call engine functions that modify global state. The compiler doesn't enforce any of these rules, it is up to the programmer to only tag appropriate functions.

For an example, consider the following:

int purefunction(int x, int y) { return x + y; }

int global1 = purefunction(1, 2);
int global2 = purefunction(global1, 3);

void main()
{
if (d100() < 50) return;
PrintInteger(global2);
}

Without the pure_function declaration, global2 is created as an actual global variable and its initialization code runs every time before main(). With the pure_function declaration, global2 (because it is not written to and follows the other rules for inline promotion eligiblity) is not created as a global if optimizations are turned on; instead, its initializer expression is substituted in every place global2 is referenced.
               
               

               


                     Modifié par SkywingvL, 21 janvier 2012 - 11:20 .
                     
                  


            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #127 on: January 22, 2012, 12:06:32 am »


               Release 10 posted of the Advanced Script Compiler.  Direct download link (same as always): http://www.nynaeve.n...iptCompiler.zip

You may use NWNScriptCompiler.ndl from the 'ToolsetPlugin' directory with NWNTX for NWN1.  The standalone compiler EXE is also updated.

Release 10:
-----------

- A longstanding bug dating back to nwnnsscomp, where global variables that
 were readonly and had initializers with assignments might be improperly
 inlined if optimizations were enabled, has been fixed.

- The compiler can now optimize away dead sub-expressions in simple cases, such
 as multiplication by zero or shift by 32 bits.

- The compiler can now optimize a multiply operation into a shift by power of
 two.

- The compiler can now optimize addition by one and subtraction by one into a
 decrement or increment operation.

- The compiler now issues a new warning, NSC6023, should function prototypes be
 declared for the same function but with conflicting literal values for a
 default value argument.  It is legal for a prototype that does not set a
 default value for an argument to follow a prototype that does set a default
 value for an argument, but if a default value was set, it must match.

- A new pragma directive, #pragma pure_function(function-identifier), is now
 supported.  This pragma hints to the compiler that function-identifier, which
 must be an already-declared function symbol, does not modify global state and
 generates no side effects.  This enables calls to the function to be elided
 in certain circumstances, or for global variable initializer expressions that
 invoke the function to be inlined in certain circumstances.

 The programmer bears responsibility for ensuring that pure_function tagged
 functions actually follow the rules for a pure function.  Otherwise, program
 behavior may be incorrect.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #128 on: January 22, 2012, 12:15:07 am »


               

SkywingvL wrote...

henesua wrote...

For the record I have noticed that declarations and implementations of functions can differ in other ways as well, and not generate compile errors.


With the new compiler or the standard one?  The standard one does not check many things.  I'd like to hear what the remaining unchecked mismatches are for the new compiler.

(Different identifier names for parameters don't count; I consider that by design and C/C++ certainly permit that.)


NWNScriptCompilerDll.ndl    11/20/2011
nwntx_compiler.dll                   6/26/2011
nwntx_optimizations.dll           12/13/2011

Yes, different identifier names
 (of function vars) . C/C++ may permit that, but I don't believe the functions work properly in compiled NWScript if the identifiers are different. I haven't pinned this down but I recall my script was not working properly when these were in disagreement.

[edit: crap! I wish this forum would let you know when another reply has been posted since you clicked reply...]
               
               

               


                     Modifié par henesua, 22 janvier 2012 - 12:18 .
                     
                  


            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #129 on: January 22, 2012, 02:45:54 am »


               The functions should work properly if the identifiers are different.  The identifier is just a local name; compiled NWScript accesses functions arguments by position and not name.

Can you show the differing disassembly (and, preferably, .ir-opt) for a function that is behaving differently based on differing identifier names in the prototype versus implementation?  Use the -d option to disassemble a script and generate the .pcode, .ir, and .ir-opt files.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #130 on: February 09, 2012, 05:48:29 pm »


               <holding his head...>

SkywingvL wrote...
Release 10 posted of the Advanced Script Compiler.  Direct download link (same as always): http://www.nynaeve.n...iptCompiler.zip

You may use NWNScriptCompiler.ndl from the 'ToolsetPlugin' directory with NWNTX for NWN1.  The standalone compiler EXE is also updated.

...

Ok. Now I'm confused. <normal, isn't boss?> Hush.

Disclosure: I've avoided installing NwNTx simply because the oToolset has been "good enough". Finally convinced that I *need* this, I installed it (root NwN directory). Cool :-) I *like* it.

Now, having gone that far and having ASCv10 sitting around...
Wait. Toolset directory for NwN1? Plugins directory? Don't exist.
Also, in the NwNTx toolset I see no options for plugins.

To upgrade the ASC that Virusman includes in 1.0..5, do I just overwrite the NWNScriptCompilerDll.ndl? That is, there is nothing else I need do and that will break nothing?

<...so it doesn't explode>
               
               

               
            

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #131 on: February 09, 2012, 06:54:09 pm »


               Rolo,

I just started playing with this and couldn't find installation instructions for NWN1 either. I just put all the NWNTX files in the main NWN directory and then overwrote the ASC dll with the new version. That seems to be working fine, everything compiles, and I get new logs with new compile warnings and such.

I do have one weird bug with NWNTX. The "Show Preview Window" tool now only shows the last item selected from the palette, not the the last item selected in the editing window. Normally you can select any item in the area and click on "Show Preview Window" to see its resref and such. With NWNTX running, clicking on an object and clicking Show Preview Window just shows a blank window until you select something from the palette. Then it only shows that item in the preview until you click another palette item even if you click on other objects in the area editing window. Loading the same module without using the launcher goes back to the normal behavior.
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #132 on: February 09, 2012, 07:38:03 pm »


               SkywingvL focuses mostly on the NWN2 version. He has a DLL that works in NWN by placing it in the NWN install folder.
You need Virusman's latest install first. Check page.. 5, I think? for his newest NWN1 version. If you want, you can overwrite the DLL with SkywingvL's newest version. Virusman's is the override for NWN1 toolset though.

EDIT:
Here:
http://social.biowar...45830/5#8824390
               
               

               


                     Modifié par wyldhunt1, 09 février 2012 - 07:39 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #133 on: February 09, 2012, 08:51:44 pm »


               <nods...>

Yup, had that, but was unclear if overwriting the NWNScriptCompilerDll.ndl was sufficient.

Thanks both.

<...thanks>
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Has anyone been able to mod Toolset?
« Reply #134 on: February 10, 2012, 06:35:37 am »


               

virusman wrote...

NWN Toolset Extender 1.0.0 + Compiler plugin
Required CRT: http://www.microsoft...ls.aspx?id=5555
Download: http://data.virusman...piler-1.0.0.rar
Install: Just unpack the files to your NWN folder and use NWNTX Loader.exe to launch the Toolset. The compiler will be switched seamlessly.
Thanks a lot to Skywing for the help and for his compiler library.



There's your instructions.