Author Topic: Scripts claim to compile, but don't sometimes?  (Read 464 times)

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« on: March 14, 2011, 11:12:32 am »


               I was under the impression that doing Build > Build Module with all the boxes checked would compile all scripts (or at least attempt to).  Is this sometimes not true?

I've got custom scripts that I've changed - for example, to remove debugging messages that I put in earlier - that continue to act as if they were never changed even after a full build.

The function that's misbehaving is in an include file I made myself, so I assumed that it might require manual compilation of all scripts that use that include.  However, even after opening, editing, and manually saving each script, starting with the include file and progressing through all the scripts that use the include, this behavior still continues.

Is there any known bug or common mistake that would cause this?

Thanks in advance for any help.
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #1 on: March 14, 2011, 11:32:48 am »


               Possible causes: having an "old" copy of the script either in Override or in a Hak attached to the module. Either of those situations apply here?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #2 on: March 14, 2011, 01:07:44 pm »


               Also if you get a compile error while compiling, it will not replace the current working code.
               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #3 on: March 14, 2011, 01:22:56 pm »


               Another possible reason, is the object that fires the script, is running the wrong script. It happens, you do a bunch of scripting, and it compiles, but you did not add the correct script to be run, causing complete frustration.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #4 on: March 14, 2011, 04:06:37 pm »


               oh Number three.  If you compile a script with changes in an Include.  Make sure you save the include first. The compiler will use the Include that is saved to the disk.  not the one that in open in the script editor.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #5 on: March 14, 2011, 04:28:55 pm »


               Note
When you 'include' a script, in another script.

If the included script is in a hak, and the script that is using the include file is not inside a hak, the script using the include, will NOT build fresh, because it will have included in it, hardcoded stuff from the hak version.

I had this same issue, I had to trace it from

ScriptA which was including ScriptB, which was including ScriptC which was the one which was in a Hak.

In order to get Script A and B to build fresh, I had to make sure that Script C was not in a hak, so it too would build.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #6 on: March 14, 2011, 04:55:40 pm »


               

Baaleos wrote...

Note
When you 'include' a script, in another script.

If the included script is in a hak, and the script that is using the include file is not inside a hak, the script using the include, will NOT build fresh, because it will have included in it, hardcoded stuff from the hak version.

I had this same issue, I had to trace it from

ScriptA which was including ScriptB, which was including ScriptC which was the one which was in a Hak.

In order to get Script A and B to build fresh, I had to make sure that Script C was not in a hak, so it too would build.


Note - Once Script C is built fresh, it is then safe to put it back into the hak if desired.
               
               

               
            

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #7 on: March 14, 2011, 08:25:24 pm »


               Wow, thanks for all the quick responses!  Unfortunately...

 - The include file is not in a hak or override; it's one I wrote myself.  Same with all the scripts that are using that include.

 - When I made changes to the include (to add debugging messages), those changes worked.  When I took the debugging messags back out, they refused to go.

 - No compiler errors have appeared, either when saving the scripts or when doing a full build.  I've made sure to save the include file with a void main(){} at the end, to reveal all errors, then save it again with the void main(){} commented out.

 - The function that's refusing to give up its debugging messages appears in only one place - the include file - so I'm sure it's not duplicated elsewhere.

 - I'm being sure to manually compile my include first, then any file that uses that include, then any file that includes those files, and so on, from top to bottom.  At least, I think I am.  I've gone over this again and again, assuming that I'm failing to compile some script somewhere, but I can't find any that I've missed.

---

One question that's bothering me quite a bit:  I've been working under the belief that doing a full build recompiles all (non-hak, non-override) scripts.  Is that actually true?  I haven't been relying on this idea, but I still want to know if it's actually supposed to be true, or if I'm mistaken about that.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #8 on: March 14, 2011, 08:31:38 pm »


               Do not use full compile, thats useless, keep checked only compile scripts option and then yes it will try to compile all of them.

If the changes doesn't manifest you must be doing something wrong, also compiling the include isn't a good idea, rather delete the include ncs file and in future compile it with any script that uses it to ensure you don't have there any error. Then compile all scripts if the include is used in numerours scripts in your module.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #9 on: March 14, 2011, 08:33:40 pm »


               Also, if you can test it as a singleplayer, consider debugging via NWN debugger. This overlooked feature is the best way to find out any errors in your scripts.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #10 on: March 15, 2011, 12:44:31 am »


               

ShaDoOoW wrote...

Also, if you can test it as a singleplayer, consider debugging via NWN debugger. This overlooked feature is the best way to find out any errors in your scripts.


Well, I have never used the NWN debugger, that is used in singleplayer mode?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #11 on: March 15, 2011, 02:04:37 am »


               Yes, in multiplayer it wont stop the game and disappears unfortunately, also it has a quite limited abilities for delaycommands, actually you need to put the debugging line into delayed command too otherwise it stops there
               
               

               
            

Legacy_BCH

  • Full Member
  • ***
  • Posts: 160
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #12 on: March 15, 2011, 03:51:37 pm »


               I haven't used the script debugger before, so I will try to learn that tool before I post any more questions.  ;-)

Thanks, all!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #13 on: March 16, 2011, 02:39:33 am »


               Here's another suggestion: If you changed an include which is called by a "standard" script, the include will not be automatically recompiled for the main script unless you recompile and save the standard script just as though you'd changed it.  A full recompile of all scripts does not recompile any of the standard nwn scripts unless it's tagged as being changed by you manually recompiling and saving the script.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Scripts claim to compile, but don't sometimes?
« Reply #14 on: March 16, 2011, 08:59:56 am »


               Well I was the one who were giving the help here but just run into similar issue I can't explain.

So, I changed the Lay on Hands feat category in my Community Patch for default AI, cos there were wrong set resulted in this ability wasn't afaik used at all. So I changed it into correct one (btw feat.2da, line 299, collumn CATEGORY, default value of 7 changed to 5). But the creature with this feat that also get very badly wounded and tried to use it become bugged. It had no effect and since she was still injured she tried that again and again still with no effect and also it "frozen" that creature animations.

So I went to find where is problem, I added debugs into default AI libraries and suddenly it worked. Which i can't explain...

When I resaved all nw_c2_default* AI scripts and just recompiled them without any change into any AI library it didn't worked and creatures were bugged with the Lay on Hands.

But when I resaved the x0_i0_talent library (with no change there) and recompiled them again, it magically start to work without problems.

I tried the same on few other libraries, but it haven't had this effect. And I also tried to look if there is this library compiled in core nwn datas, but it wasn't there, so how is this possible???
               
               

               


                     Modifié par ShaDoOoW, 16 mars 2011 - 09:02 .