Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: Wenzon on September 14, 2019, 08:39:19 PM

Title: [ListSize] [Resolved]
Post by: Wenzon on September 14, 2019, 08:39:19 PM
Is it possible to run [ListSize] by decreasing the number of items? For example, my theme lists 13 systems, 3 of which are not systems but options. I would like to use [ListSize] by decreasing these 3 items.
Title: Re: [ListSize]
Post by: iOtero on September 15, 2019, 04:43:59 AM
I have not understood you well, nor do i know where your system lists anything...
I would need to see some of the code you are using or know exactly what list you are talking about.  :-[
Title: Re: [ListSize]
Post by: Wenzon on September 15, 2019, 09:55:44 AM
I hope you can understand with my bad English. ;D
 Below is the code and the image.


Code: [Select]
//Display ListEntry and ListSize info
local lels = fe.add_text( "[ListEntry]/[ListSize]", flx*0.032, fly*0.683, flw*0.25, flh*0.04 );
lels.set_rgb( 255, 255, 255 );
lels.font="LEDSCORE";
lels.charsize = 12;
lels.align = Align.Right;

For example, the magic token [ListSize] the number of items in the game list.

In the "Display Menu" atract mode lists the systems I created. It has a total of 10 systems, but I added options as "shutdown", "favorites" and "all games", the listing goes to 13 items. I would like [ListeSize] to remove these 3 items. As if subtracting [ListSize] -3 to list the 10 items. I feel very difficult in this part of script and programming language. Thanks for the help.
Title: Re: [ListSize]
Post by: iOtero on September 15, 2019, 10:32:54 AM
I need to see your attract.cfg, i think i already know what it is...
My english is very bad, i am from Spain.
Title: Re: [ListSize]
Post by: jedione on September 16, 2019, 06:28:48 PM
just a guess but,
 is-int this,,,

     in_cycle             yes
   in_menu            no


in the am, config....?

Title: Re: [ListSize]
Post by: iOtero on September 17, 2019, 06:51:00 AM
just a guess but,
 is-int this,,,

     in_cycle             yes
   in_menu            no


in the am, config....?


You have already spoiled my surprise  :'(
Title: Re: [ListSize]
Post by: qqplayer on September 17, 2019, 10:07:48 AM
I think you can´t use magic tokens for this purpose.
I suppose you need to create a function with "fe.CurrentList"

Code: [Select]
#### `fe.CurrentList` ####

This class is a container for status information regarding the current display. The instance of this class is the fe.list object. This class cannot be otherwise instantiated in a script.

Properties:

    name - Get the name of the current display.
    display_index - Get the index of the current display. Use the fe.set_display() function if you want to change the current display. If this value is less than 0, then the 'Displays Menu' (with a custom layout) is currently showing.
    filter_index - Get/set the index of the currently selected filter. (see fe.filters for the list of available filters).
    index - Get/set the index of the currently selected game.
    search_rule - Get/set the search rule applied to the current game list. If you set this and the resulting search finds no results, then the current game list remains displayed in its entirety. If there are results, then those results are shown instead, until search_rule is cleared or the user navigates away from the display/filter.
    size - Get the size of the current game list. If a search rule has been applied, this will be the number of matches found (if > 0)
Title: Re: [ListSize]
Post by: Wenzon on September 17, 2019, 10:21:53 AM
I think my explanation is a little confusing. I want the 13 item to appear on the menu. What I don't want is for the number 13 to appear instead of 10 because atract mode lists those options as items. When I use [LastSize] list the number 13. I would like to present 10 items where I circled the image written SYSTEMS.
Title: Re: [ListSize]
Post by: qqplayer on September 17, 2019, 11:36:24 AM
I think I know exactly what you want.
I made something similar some time ago, dukpoki helped me.

http://forum.attractmode.org/index.php?topic=2250.msg15278#msg15278

You need to modify this functions with fe.CurrentList , so attrack mode will check the size of your list,rest 3 and ten, return (list -3) as the result,
If you cant make the function Ill try to make the code this weekend.

Title: Re: [ListSize]
Post by: iOtero on September 18, 2019, 03:08:56 AM
Wenzon, the line in which we were jedione and i, after some checks i have done, will not help you. Better try what qqplayer tells you...
Title: Re: [ListSize]
Post by: qqplayer on September 18, 2019, 03:50:37 PM
This works, just need to set the right position and color.
I mean, you will need to show ListEntry and in this case system1 its like a fake ListSize with 3 less items.


Code: [Select]
//
//


 ::OBJECTS <- {

system1= fe.add_text("",0, 25, 640, 30)

}


function transition_system(ttype, var, ttime)
{
    switch ( ttype )
    {
        case Transition.ToNewList:
case Transition.StartLayout:
case Transition.ToNewSelection:
case Transition.FromOldSelection:

local display1 = fe.list.size - 3
OBJECTS.system1.msg = display1;
    break;
    }

}

fe.add_transition_callback("transition_system" );

//
//
Title: Re: [ListSize]
Post by: Wenzon on September 23, 2019, 12:12:36 PM
Quote from: qqplayer
This works, just need to set the right position and color.

That's easy.  :)

Quote from: qqplayer
I mean, you will need to show ListEntry and in this case system1 its like a fake ListSize with 3 less items.

But "ListEntry" keeps popping up at number 13. Not wanting to abuse, could you pass me another code or script using "ListEntry" as the last?  ::)
Besides English, I'm horrible in programming. Thank you very much for your goodwill qqplayer.


Title: Re: [ListSize]
Post by: qqplayer on September 24, 2019, 02:58:02 PM
Just replace 'size' with 'index '
Something like this, cant test atm

Code: [Select]
//
//


 ::OBJECTS2 <- {

system2= fe.add_text("",0, 25, 640, 30)

}


function transition_system2(ttype, var, ttime)
{
    switch ( ttype )
    {
        case Transition.ToNewList:
case Transition.StartLayout:
case Transition.ToNewSelection:
case Transition.FromOldSelection:

local display2 = fe.list.index - 3
OBJECTS2.system2.msg = display2;
    break;
    }

}

fe.add_transition_callback("transition_system2" );

//
//


P.D. Should be better create a single working function but I think this its better for you to understand how it works  ;)

Code: [Select]
This class is a container for status information regarding the current display. The instance of this class is the fe.list object. This class cannot be otherwise instantiated in a script.

Properties:

    name - Get the name of the current display.
    display_index - Gett the index of the current display. Use the fe.set_display() function if you want to change the current display.
    filter_index - Get/set the index of the currently selected filter. (see fe.filters for the list of available filters).
    index - Get/set the index of the currently selected game.
    search_rule - Get/set the search rule applied to the current game list. If you set this and the resulting search finds no results, then the current game list remains displayed in its entirety. If there are results, then those results are shown instead, until search_rule is cleared or the user navigates away from the display/filter.
    size - Get the size of the current game list. If a search rule has been applied, this will be the number of matches found (if > 0)

So you can use all this properties depending on what you need, I mean fe.list.name, fe.list.size, fe.list.index...
Title: Re: [ListSize]
Post by: Wenzon on September 25, 2019, 11:13:30 AM
Just replace 'size' with 'index '
Something like this, cant test atm

Code: [Select]
//
//


 ::OBJECTS2 <- {

system2= fe.add_text("",0, 25, 640, 30)

}


function transition_system2(ttype, var, ttime)
{
    switch ( ttype )
    {
        case Transition.ToNewList:
case Transition.StartLayout:
case Transition.ToNewSelection:
case Transition.FromOldSelection:

local display2 = fe.list.index - 3
OBJECTS2.system2.msg = display2;
    break;
    }

}

fe.add_transition_callback("transition_system2" );

//
//


P.D. Should be better create a single working function but I think this its better for you to understand how it works  ;)

Code: [Select]
This class is a container for status information regarding the current display. The instance of this class is the fe.list object. This class cannot be otherwise instantiated in a script.

Properties:

    name - Get the name of the current display.
    display_index - Gett the index of the current display. Use the fe.set_display() function if you want to change the current display.
    filter_index - Get/set the index of the currently selected filter. (see fe.filters for the list of available filters).
    index - Get/set the index of the currently selected game.
    search_rule - Get/set the search rule applied to the current game list. If you set this and the resulting search finds no results, then the current game list remains displayed in its entirety. If there are results, then those results are shown instead, until search_rule is cleared or the user navigates away from the display/filter.
    size - Get the size of the current game list. If a search rule has been applied, this will be the number of matches found (if > 0)

So you can use all this properties depending on what you need, I mean fe.list.name, fe.list.size, fe.list.index...


Thank you so much!  ;D