Author Topic: Limit to string variables?  (Read 567 times)

Legacy_olivier leroux

  • Hero Member
  • *****
  • Posts: 913
  • Karma: +0/-0
Limit to string variables?
« on: November 12, 2010, 10:29:23 pm »


               Does someone know if there's a limit as to how many characters a string variable can hold? Thanks!
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Limit to string variables?
« Reply #1 on: November 12, 2010, 11:18:57 pm »


               I think its 32 characters, not positive on that though - maybe I'm thinking tags/resrefs.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Limit to string variables?
« Reply #2 on: November 13, 2010, 12:06:16 am »


               The Size limit on strings is suggested to be 1024 bytes.  This is for performance reasons in trying to keep bandwith low.   The real size limit for the string  data type is 4GB.  In effect there is no limit.  



If you are asking about the string name in a script there may be a compiler limit given to the length of the names I do not know.   the lables in the script will be converted to offsets to the data on the stack when compiled with the lable never being saved.  



For local variable names( vars stored on objects) the name for the var is the same data type as the strings, Giving the max length for the var name 4GB.   I would hope you keep things well below the limits and even the suggested 1024 character limit.   Yuo can hit performance problems if you start making lables or strings too big.
               
               

               
            

Legacy_olivier leroux

  • Hero Member
  • *****
  • Posts: 913
  • Karma: +0/-0
Limit to string variables?
« Reply #3 on: November 13, 2010, 01:13:15 am »


               Thanks, Lightfoot8!

The string I'm thinking about replaces the journal, so it's a stringing together of (shorter) journal entries. And I was wondering if there's a chance it won't store any more characters after a certain size. Since this is for a PW performance might be an issue, too. On the other hand maybe 20-40 phrases might not be anywhere near 1024 bytes, or is it? Frankly speaking, I have no idea...  
:innocent:

One thing I forgot to mention is that this string is stored in the mod's database, does that change anything, make things worse?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Limit to string variables?
« Reply #4 on: November 13, 2010, 02:05:20 am »


               Even bioware has a few strings out there that are larger then 1024 characters normally placed in the talktable so bandwith is not a problam.  Here is one that is 1211 characters long for refferance.



Clerics act as intermediaries between the earthly and the divine (or infernal) worlds. A good cleric helps those in need, while an evil cleric seeks to spread his patron's vision of evil across the world. All clerics can heal wounds and bring people back from the brink of death, and powerful clerics can even raise the dead. Likewise, all clerics have authority over undead creatures, and they can turn away or even destroy these creatures. Clerics are trained in the use of simple weapons, and can use all forms of armor and shields without penalty, since armor does not interfere with the casting of divine spells. In addition to his normal complement of spells, every cleric chooses to focus on two of his deity's domains. These domains grants the cleric special powers, and give him access to spells that he might otherwise never learn.



WARNING: To cast a spell, a cleric must have a Wisdom score of 10 + the spell's level. For example, to cast a 2nd-level spell, a cleric must have a Wisdom of 12.



- Hit Die: d8.

- Proficiencies: All simple weapons, all armor, and shields.

- Skill Points (*4 at 1st level): 2 + Int Modifier.

- Spellcasting: Divine (Wisdom-based, spell failure from armor is ignored).


               
               

               
            

Legacy_olivier leroux

  • Hero Member
  • *****
  • Posts: 913
  • Karma: +0/-0
Limit to string variables?
« Reply #5 on: November 13, 2010, 02:48:48 am »


               Hm, the string I'm working with could easily be 4-5 times as much... ':unsure:'
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Limit to string variables?
« Reply #6 on: November 13, 2010, 02:56:57 am »


               I would not wory to much about it.  internet connections have come a long way in the last few years.  It is just something to keep in mind if you start having trouble.  Also by what you are doing it sounds like you would never be sending the whole string at one time anyway, rather cutting it up and sending it in pieces.  one advantage to the journal system you are replaceing is that the strings only have to be sent to the client one time for them to be stored on the client.  With your new system they will have to be sent every time they are displayed.
               
               

               
            

Legacy_olivier leroux

  • Hero Member
  • *****
  • Posts: 913
  • Karma: +0/-0
Limit to string variables?
« Reply #7 on: November 13, 2010, 04:31:04 pm »


               Thanks! It remains to be be seen whether there will be issues with the performance once it's online but in any case it's a relief to know the string won't get "stuffed" and burst at one point (it's unlikely the string will ever reach 4GB ':lol:').
               
               

               


                     Modifié par olivier leroux, 13 novembre 2010 - 04:31 .