Dunno if you still browse the boards or not, but this INT to STRING is very helpful. Working on this quest where I check the skills of NPCs to simulate the results of battle and this is perfect for debugging it.

I added a DebugBreak to ITS_MakeResult so that it prints out the result in the message box.

Also helpful in creating my Day/Night cycle.

Originally Posted by Rhidian


I have also created a Utility script that converts Integers into Strings. I'm not completely sure where this could be useful yet, but it works.


Code
INIT

DB_Digit(1, "1");
DB_Digit(2, "2");
DB_Digit(3, "3");
DB_Digit(4, "4");
DB_Digit(5, "5");
DB_Digit(6, "6");
DB_Digit(7, "7");
DB_Digit(8, "8");
DB_Digit(9, "9");
DB_Digit(0, "0");


KB

PROC
ITS_MakeResult((STRING)_val)
THEN
ClearResults();
DB_Result(_val);

PROC
ClearResults()
AND
DB_Result(_val)
THEN
NOT DB_Result(_val);

PROC
IntegerToString((INTEGER)_int)
THEN
ITS_DivideByTen(_int, "");

PROC
ITS_DivideByTen((INTEGER)_int,(STRING)_str)
AND
IntegerDivide(_int, 10, _quot)
AND
_quot < 1
THEN
ITS_GetDigit(_int, _str);

PROC
ITS_DivideByTen((INTEGER)_int,(STRING)_str)
AND
IntegerDivide(_int, 10, _quot)
AND
_quot > 0
AND
IntegerModulo(_int, 10, _ret)
AND
DB_Digit(_ret, _aStr)
AND
StringConcatenate(_aStr, _str, _nStr)
THEN
ITS_DivideByTen(_quot, _nStr);

PROC
ITS_GetDigit((INTEGER)_int, (STRING)_str)
AND
DB_Digit(_int, _ITS)
AND
StringConcatenate(_ITS, _str, _finalString)
THEN
ITS_MakeResult(_finalString);



For this one you need to call IntegerToString((INTEGER)_int), and it will store the result into DB_Result((STRING)_num). I used this code to test it out, for example: