Got it working.
::OBJECTS <- {
system1= fe.add_text("",47,48,300,40)
system2= fe.add_text("",47,90,300,40)
system3= fe.add_text("",47,132,300,40)
system4= fe.add_text("",47,174,300,40)
system5= fe.add_text("",47,222,300,40)
}
function transition_callback(ttype, var, ttime)
{
switch ( ttype )
{
case Transition.ToNewList:
case Transition.StartLayout:
case Transition.ToNewSelection:
case Transition.FromOldSelection:
switch ( fe.list.name )
{
case "Atomiswave":
local display1 = fe.displays[fe.list.display_index - 2].name;
local display2 = fe.displays[fe.list.display_index - 1].name; //previous display
local display3 = fe.displays[fe.list.display_index].name; //current display
local display4 = fe.displays[fe.list.display_index + 1].name; //next display
local display5 = fe.displays[fe.list.display_index + 2].name;
OBJECTS.system1.msg = display1;
OBJECTS.system2.msg = display2;
OBJECTS.system3.msg = display3;
OBJECTS.system4.msg = display4;
OBJECTS.system5.msg = display5;
OBJECTS.frame.file_name = "images/frames/Default_frame.png";
break;
case "Dreamcast":
local display1 = fe.displays[fe.list.display_index - 2].name;
local display2 = fe.displays[fe.list.display_index - 1].name; //previous display
local display3 = fe.displays[fe.list.display_index].name; //current display
local display4 = fe.displays[fe.list.display_index + 1].name; //next display
local display5 = fe.displays[fe.list.display_index + 2].name;
OBJECTS.system1.msg = display1;
OBJECTS.system2.msg = display2;
OBJECTS.system3.msg = display3;
OBJECTS.system4.msg = display4;
OBJECTS.system5.msg = display5;
OBJECTS.frame.file_name = "images/frames/Default_frame.png";
break;
}
break;
}
}
fe.add_transition_callback("transition_callback" );
Make sure to add all your systems/displays by adding more "cases".
EDIT: Has problems with the beginning and the end of the list. I'm not sure how to make it loop. Will research.
EDIT 2: Found a very rough workaround. You have to subtract or add the total index number which you can use fe.displays.len() to find.
So for example if you have a list of 10 systems then for the first system you need to -2, -1, 0, +1, +2 but make sure the first two formulas you are adding 10 to it. So the formula will be (-2 + 10) and (-1 + 10). That way the end result is the number that is at the end of the list 8 and 9 respectively and not negative numbers. Because you the display index will never be a negative number.
For example i am doing this:
local displaytotal = fe.displays.len();
//excerpt code below
case "Atomiswave":
local display1 = fe.displays[fe.list.display_index - 2 + displaytotal].name;
local display2 = fe.displays[fe.list.display_index - 1 + displaytotal].name;
local display3 = fe.displays[fe.list.display_index].name;
local display4 = fe.displays[fe.list.display_index + 1].name;
local display5 = fe.displays[fe.list.display_index + 2].name;
break;