I could not for the life of me get part of the player’s command -> snippet -> indexed text -> text to compare to a column of table (long story, code snippets below). I could possibly have renamed the table column “topic” but I really didn’t want to do that (partly because it’s NOT a topic!). And I’ve been the value route, and didn’t really want to do that either – if I could avoid it.
So I bit the bullet and changed that first column of all my tables to indexed text. Then I hit memory limits – to the tune of having to raise memory limits tremendously to get to compile. Now my table-coping/populating routines caused a much longer delay than before (30 seconds on the Glulx welcome screen before the game start screen loads), and I’m just worried that I may have done something Very Wrong™ or unnecessary…
So here’s my current memory limits:
Use MAX_OBJ_PROP_COUNT of 256.
Use MAX_PROP_TABLE_SIZE of 2000000.
Use MAX_STATIC_DATA of 5000000.
Use MAX_OBJECTS of 4000.
Use MAX_ARRAYS of 4000. [wasn't sure I needed this, but it also looked like a safe bet to add it...]
A small sample table (I have longer ones with up to 6 columns – only the 1st column being indexed text on any of them…I may be able to do cross-reference tables on some of the other columns of information in the future but I’m trying to get it running to proof-of-concept for the tables before fussing with that):
Table of Node Stats
stat (indexed text) rating activation is-attack is-program
"rating" 0 false false false
"matrix initiative bonus" 0 false false false
"matrix initiative pass bonus" 0 false false false
"response" 1 false false false
"firewall" 1 false false false
"system" 1 false false false
"signal" 1 false false false
"persona limit" 1 false false false
"processor limit" 1 false false false
"analyze" 0 false false true
"rigged" 0 false false false
"encrypted" 0 false false false
with 6 blank rows
And one of the rules – the one I had to index the first column of the tables for – and the definition I created to change the snippet (the topic understood) into an indexed text:
To decide what indexed text is the stattext (oldsnippet - a snippet) (this is fixingtext):
let N be indexed text;
now N is “[oldsnippet]”;
replace the text “’” in N with “”;
decide on N;
Understand “activate [text]” as activating a program.
Activating a program is an action applying to one topic.
Carry out an actor activating a program:
let thistopic be fixingtext applied to the topic understood;
if thistopic is a stat listed in the stat table of the actor:
if activation entry is true:
say “You remember that [the topic understood] is already running.”;
if the rating entry is greater than 0:
now activation entry is true;
if the actor is the player, reset player successes;
say “[1 ca][The topic understood] is now running.”;
say “You don’t have that program.” instead;
say “[The topic understood] is not a [if actor is a technomancer]complex form[otherwise]program[end if].”;
(I can change things to Check…Carry Out…Report after I know each segment works…so it’s all in Carry Out because I couldn’t tell what was failing without everything being in one block so I could showme snippets and work out how to parse the text…)
So do I really have to change “the topic understood” to indexed text, hence change all the tables to indexed text, to find the topic understood in the ‘stat column’ of the table? I tried many permutations to try to get the text & table to match up before I found the example with naming Fido in the manual and decided to try indexed text. It seems to be a memory hog and to really slow things down a whole lot, though.
I’m getting pretty tired of re-writing everything to get it right…I know it’s the wise thing to do in the long run but I’ve been rewriting full-time for at least 2 weeks…It’s taking the excitement and fun out of the project. At least I haven’t spent 3 days on one bug in a while…