Difference between revisions of "StrNew"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Tibixe
(a new feature of StrNew)
imported>Speedo
(Crash note)
 
(2 intermediate revisions by one other user not shown)
Line 9: Line 9:
If initialValue (a string as recognized by the CS, not a stringID) is given, it will be copied to the resulting string.
If initialValue (a string as recognized by the CS, not a stringID) is given, it will be copied to the resulting string.


StrNew attaches the calling object's (a reference or quest) identifier to the new string. This means that script will be associated with the current object.
StrNew attaches the calling script's identifier to the new string.
 
==Note==
Due to a bug with [[Set]], you can't directly create large strings with StrNew, as the CS will crash when you attempt to compile the script.  To get around this, simply use StrNew to create an empty string and immediately follow it with [[StrSet]]:
set myString to StrNew
StrSet myString "Very, very, very, long string [...]"
 


[[Category: Functions (OBSE)]]
[[Category: Functions (OBSE)]]
[[Category: TSFC]]
[[Category: TSFC]]

Latest revision as of 17:07, 1 April 2008

Function:

newString:stringID StrNew [initialValue:string]

Syntax:

set StringRef:long to StrNew "Hello World!"

Registers a new string, and returns it's reference number as a long. This number is used when performing functions on the string -- the long itself does not contain the string, merely points to it.

If initialValue (a string as recognized by the CS, not a stringID) is given, it will be copied to the resulting string.

StrNew attaches the calling script's identifier to the new string.

Note[edit | edit source]

Due to a bug with Set, you can't directly create large strings with StrNew, as the CS will crash when you attempt to compile the script. To get around this, simply use StrNew to create an empty string and immediately follow it with StrSet:

set myString to StrNew
StrSet myString "Very, very, very, long string [...]"