<RetVar> = string <Var/String> to integer

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

<RetVar> = string <Var/String> to integer

Post by mark_a_condren »

<RetVar> = string <Var/String> to integer


<RetVar> = The converted string.
<Var/String> = The string you wish to convert to an integer.


Important when reading numerical data from a TFile. Those are always read as strings.

Known Limitation;
If an integer is read from a text file or converted to a string using the '[RetVar] = convert number [Var/Number] to string' command and it contains commas, which it will if it is longer than 3 characters, this command will break at the first comma it encounters.

eg,
12,345,678 will be returned as 12. Everything after the first comma will be ignored.


Example:

$number.string = read text: page= $page.id id = $text.id
$number.integer = string $number.string to integer

This allows you to read in a number as a string and convert it to an integer for used in calculations etc.


Command Location:

Return to “MSCI Reference”