Author Topic: Module CONSTANTS Limit - Need To Know  (Read 451 times)

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« on: May 08, 2012, 07:11:53 pm »


               I was wondering if anyone knew just how many Constants you can use in a Module, also how many constants you can use in a particular set of scripts (obviously all the scripts are linked together via includes etc)??

Anyone?
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #1 on: May 08, 2012, 07:35:54 pm »


               I don't think the limit is in the entire module, as I've only come across a limit within a single script at a time (which includes all constants in referenced include files).  

I'm not sure of the actual limit, but I ran into it with things like new spell constants and new visual effect constants in the same script.  I've run into this a couple times over the last 6 years and had to cut constants out of several heavily used include files.

Just part of the reason that I often just keep copies of certain 2da files open when building/scripting.  Much less hassle sometimes to just use the raw 2da line numbers (especially with visualeffects.2da, spells.2da, and appearance.2da).

For scripts that I know I'll have serious use for constants, I define them at the start of that particular script, rather than pulling them from an include file.  That way I'm adding only the constants I'll be using in that specific script.  Not as convenient as having module-wide constants from a central include file, but workable.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #2 on: May 10, 2012, 03:34:14 pm »


               I see...

So do you know a "round figure" on how many constants are "Too many" for a script ???

(maybe 100?)
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #3 on: May 10, 2012, 04:22:29 pm »


               100 is well below the limit.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #4 on: May 10, 2012, 04:42:11 pm »


               

Lightfoot8 wrote...

100 is well below the limit.


I need a guesstimate, if you can provide that Lightfoot8, thanks...
               
               

               
            

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #5 on: May 10, 2012, 05:50:17 pm »


               Based on Skywing's release notes in the advanced script compiler thread, there is a limit of 16384 global identifiers in the bioware script compiler. This would include constants or variables defined at global scope as well as function names. I doubt there is a limit specifically on constants. The ASC removes the identifier limit unless the -v1.69 flag is used.
               
               

               


                     Modifié par eeriegeek, 10 mai 2012 - 04:52 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #6 on: May 10, 2012, 10:46:25 pm »


               Sounds about right to me.    it would be the limit of a 16 Bit number.  

eeriegeek is also correct, in that there is no linit on constants by themselves.  The limit is on all Lables.  So any Var or function name you create counts towards the limit.  and as said there are already a bunch created before you create or include  any of your own.   The entire nwscript.nss file counts against the limit.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Module CONSTANTS Limit - Need To Know
« Reply #7 on: May 11, 2012, 03:54:02 am »


               Great info eeriegeek TYVM!

I have other questions, these are about scripting / algorithms / etc..

I made a very long script, (5000+ Lines), which has well over 20 includes attached to it.
(Big system indeed)

Anyway, I used this system for ALL of the important & big conversations in my module, integrating them all together into two major scripting routine systems / sets of scripts...

The thing is, building the module takes much longer than normal, as many small scripts are linked to this humungous system of scripts...

Anyway, I guess my question is, was this a bad idea?  Will it greatly effect game play / server resources (e.g. RAM / CPU usage), considering all the constants & size of all these scripts which would be firing A LOT, what do you think?

The main script include(s) use Switch/Case statments (multiples) to quickly find the functions for each line in all of these conversations (yes it was a bit of work trust me), anyway, I did it because I wanted to reduce the number of scripts in my module (there was well over 2400, now there is only 507)...
               
               

               


                     Modifié par _Guile, 12 mai 2012 - 01:56 .