All right, thanks to liquid8d's example, I managed to get most of what I'm gunning for working! Now (of course!) I've run into another snag.
With the following:
local tfCountDeets=fe.add_text("", 0, 0, 100, 100);
local countDeets;
countDeets=(fe.list.index.tointeger()+1)+" ("+fe.list.size+")";
tfCountDeets.msg=countDeets;
on first run the index appears correct: as soon as I start AM, I see whatever the last list was and whatever the last game was, just like I should, and they're properly indexed. However, if I press up or down (using a keyboard right now), the list changes appropriately, but the index starts doing crazy things! For example, if I was at, say, game 10 of 40, when I start AM, the following would spit out "9":
print (fe.list.index); // outputs 9 (as expected!)
But the next up/down would give me the same result (9 in this case)! And, supposing I pressed down in the prior example, the next press up would display 10 (game 11); the next press up would display 9 again... What it looks like is happening is AM is one game behind (or ahead) of where it needs to be. I'd think it was just a screen redraw issue except the print() statement returns the same (wrong) values.
Any thoughts? Thanks!
EDIT: All right, I just noticed that if I'm on, say, filter A and game 20, if I switch filters, then switch back, suddenly I'm on game 21, but an up or down leaves me at the same "new" index, which sorts itself with the next up/down, but it's odd nonetheless...So here's what I've got going on, just in case anyone more knowledgeable than me can tell me what I'm doing wrong:
function transitionCallback (ttype, var, ttime)
{
switch (ttype) {
case Transition.ToNewList:
local filter;
local filterDeets;
filter=fe.filters[fe.list.filter_index].name;
filterDeets=filter;
// print ("\nCurrent filter ("+fe.list.filter_index+"): "+filterDeets+"\n");
tfFilter.msg=filterDeets;
case Transition.ToNewSelection:
local title, rom, cat, players, year, mfr;
local titleDeets, romDeets, copyDeets, countDeets;
title=fe.game_info(Info.Title, var);
titleDeets=(title!=null ? getPrettyTitle(title) : "???");
tfTitle.msg=titleDeets;
tfTitleShadow.msg=titleDeets;
rom=fe.game_info(Info.Name, var);
cat=fe.game_info(Info.Category, var);
players=fe.game_info(Info.Players, var);
romDeets=(rom!=null ? rom : "???")+"\n";
romDeets+=(cat!=null ? getPrettyCat(cat) : "n/a")+"\n";
romDeets+=(players!=null ? getPrettyPlayers(players) : "? player(s)");
tfRomDeets.msg=romDeets;
tfRomShadow.msg=romDeets;
year=fe.game_info(Info.Year, var);
mfr=fe.game_info(Info.Manufacturer, var);
copyDeets=(mfr!=null ? (year!=null ? "© "+year+" "+mfr : "") : "© n/a");
tfCopyDeets.msg=copyDeets;
// countDeets=(fe.list.index.tointeger()+1)+" ("+fe.list.size+")"; // Always one index "behind" it seems...
tfCountDeets.msg="[ListEntry] ([ListSize])";
// tfCountDeets.msg=countDeets;
break;
}
}
fe.add_transition_callback (this, "transitionCallback");