I finally came back around to this and after a few hours of coding and testing I now have a functional version of outputting strings letter by letter.


Code
INIT Section
DB_SingleLetter("A", 1);
DB_SingleLetter("B", 2);
DB_SingleLetter("C", 3);
DB_SingleLetter("D", 4);
DB_SingleLetter("E", 5);
DB_SingleLetter("F", 6);
DB_SingleLetter("G", 7);
DB_SingleLetter("H", 8);
DB_SingleLetter("I", 9);
DB_SingleLetter("J", 10);
DB_SingleLetter("K", 11);
DB_SingleLetter("L", 12);
DB_SingleLetter("M", 13);
DB_SingleLetter("N", 14);
DB_SingleLetter("O", 15);
DB_SingleLetter("P", 16);
DB_SingleLetter("Q", 17);
DB_SingleLetter("R", 18);
DB_SingleLetter("S", 19);
DB_SingleLetter("T", 20);
DB_SingleLetter("U", 21);
DB_SingleLetter("V", 22);
DB_SingleLetter("W", 23);
DB_SingleLetter("X", 24);
DB_SingleLetter("Y", 25);
DB_SingleLetter("Z", 26);



KB Section

PROC
StringSplit((STRING)_word)
THEN
StringSplitForward(_word, "", 1, 0);
DisplaySplitResult();
ClearSplitResult();

IF
StringSplitForward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
NOT DB_SingleLetter(_, _int)
THEN
StringSplitBackward(_word, _current, 1, -1);

IF
StringSplitBackward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
NOT DB_SingleLetter(_, _int)
AND
IntegerSum(_counter, 1, _result)
THEN
DB_SplitMin(_result);

IF
StringSplitForward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
DB_SingleLetter(_char, _int)
AND
StringConcatenate(_current, _char, _test)
AND
StringContains(_word, _test, _result)
AND
_result != 0
AND
IntegerSum(_counter, 1, _nextCounter)
THEN
DB_SplitResult(_char, _counter);
StringSplitForward(_word, _test, 1, _nextCounter);

IF
StringSplitForward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
DB_SingleLetter(_char, _int)
AND
StringConcatenate(_current, _char, _test)
AND
StringContains(_word, _test, _result)
AND
_result == 0
AND
IntegerSum(_int, 1, _nextInt)
THEN
StringSplitForward(_word, _current, _nextInt, _counter);


PROC
ClearSplitResult()
AND
DB_SplitResult(_char, _counter)
THEN
NOT DB_SplitResult(_char, _counter);
ClearSplitResult();

PROC
ClearSplitResult()
AND
DB_SplitMin(_min)
THEN
NOT DB_SplitMin(_min);

IF
StringSplitBackward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
DB_SingleLetter(_char, _int)
AND
StringConcatenate(_char, _current, _test)
AND
StringContains(_word, _test, _result)
AND
_result != 0
AND
IntegerSubtract(_counter, 1, _nextCounter)
THEN
DB_SplitResult(_char, _counter);
StringSplitBackward(_word, _test, 1, _nextCounter);

IF
StringSplitBackward((STRING)_word, (STRING)_current, (INTEGER)_int, (INTEGER)_counter)
AND
DB_SingleLetter(_char, _int)
AND
StringConcatenate(_char, _current, _test)
AND
StringContains(_word, _test, _result)
AND
_result == 0
AND
IntegerSum(_int, 1, _nextInt)
THEN
StringSplitBackward(_word, _current, _nextInt, _counter);

IF
DisplaySplitResult()
AND
DB_SplitMin(_start)
THEN
DisplaySplitResult(_start);

IF
DisplaySplitResult((INTEGER)_counter)
AND
DB_SplitResult(_char, _counter)
AND
IntegerSum(_counter, 1, _nextCounter)
THEN
CharacterDisplayText(CHARACTER_FirstCharacter, _char);
DisplaySplitResult(_nextCounter);



CHARACTER_FirstCharacter is the Player character I used in my testing for displaying the result. For each of the single letters there is an entry in the TranslatedStringKeys that matches up.

I also found out that PROC doesn't even need to be used at all for "modder defined" functions.

Edit:
Or I spoke too soon, since it appears that it only works once, after which it doesn't display anything until after the Story is rebuilt/reloaded.

Edit:
Changing the IFs to PROCs fixed the issue. Now I just need to find out what the memory limit is for this, since it's crashing after trying to print a certain length of Strings.

Last edited by Rhidian; 07/03/15 04:08 AM.