Author Topic: advanced progres bar  (Read 3690 times)

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: advanced progres bar
« Reply #30 on: December 07, 2019, 04:38:53 PM »
ill add a  working one, and send it to ya..tonight

jedione thanks !
enjoying your work

jedione

  • Hero Member
  • *****
  • Posts: 930
  • punktoe
    • View Profile
Re: advanced progres bar
« Reply #31 on: December 07, 2019, 07:10:34 PM »
sent, test theme.... ;)
help a friend....

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: advanced progres bar
« Reply #32 on: December 12, 2019, 03:07:12 AM »
sent, test theme.... ;)

Ok, Jedione, thanks, but...

I've tried your aura4k coin-ops theme and the abc.nut layout gives exactly the same problem: If when changing filters or lists, there are no games, it gives the error of slice out of range and closes attract-mode. Logically, the code to get the first letter of the game is the same.

And with the statbar.nut layout, only one letter appears and then only the green line that changes size without any other letter.

Keil's code to get the first letter doesn't work either.

So we are the same as before.
Nacer a los 15 años Una novela de iOtero

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: advanced progres bar
« Reply #33 on: December 12, 2019, 04:24:32 AM »
Well, i have already solved it, it was much easier than it seemed.

You only have to give access to variable s2 if the name string --variable s-- is not empty.

Nacer a los 15 años Una novela de iOtero

Vaz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: advanced progres bar
« Reply #34 on: July 14, 2020, 04:46:52 AM »
This is my code contribution.

There's a "gameletter" function that acts differently if the list is sorted by name or manufacturer (returns the first letter), by category (returns the main category) or by year (returns the decade in the form 198x).

There is a routine in the on_transition section that, when transitioning to a new list, dynamically builds a table of "sort items" that are letters or years or categories according to the sort order, and changes it every time so the list is always consistent with the sort order. A small tweak can be done to space each "section" proportionally to the number of games in that slot but if there are few games then the category name will not fit, so I let it out

Code: [Select]
function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         s = s.slice (0,3)+"x"
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}


local flw = fe.layout.width
local flh = fe.layout.height
local gamename = fe.add_text("[Title]\n[SortValue]",0,0,flw,flh/10)
gamename.charsize = gamename.height*0.25

local accent = fe.add_text ("[!gameletter]",0,flh*0.5,flw,flh*0.25)
accent.charsize = flh*0.25


local keys = null

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {

   if (ttype == Transition.ToNewSelection){
      local l1 = gameletter(0)
      local l2 = gameletter(var)

      if (l1 != l2){
         keys [l1].alpha = 128
         keys [l2].alpha = 255
      }
   }

   if (ttype == Transition.ToNewList){
      local tableorder = []
      local tableletter = {}

      for (local i = 0 ; i < fe.list.size ; i++){
         local s =  (gameletter (i-fe.list.index))
         try { tableletter[s]++ }
         catch (err) {
            tableletter[s] <- 1
            tableorder.push (s)
         }
      }

      keys = {}
      local i = 0
      local x0 = 0

      foreach (key in tableorder){
         local key_obj = fe.add_text(key,x0,flh*0.5,flw/tableorder.len(),50)
         key_obj.charsize = 50
         key_obj.alpha = ((tableletter[key] > 0) ? 128 : 0)
         key_obj.set_bg_rgb (100+50*(i%2),100+50*(i%2),100+50*(i%2))
         i++
         x0 = x0 + flw/tableorder.len()
         keys[key] <- key_obj
      }

      keys [gameletter(0)].alpha = 255
   }

}

zpaolo11x,
If it is not too much to ask, would it be possible to put it on display in a vertical position?

Wenzon

  • Full Member
  • ***
  • Posts: 57
    • View Profile
Re: advanced progres bar
« Reply #35 on: July 15, 2020, 02:49:14 AM »
Quote
zpaolo11x,
If it is not too much to ask, would it be possible to put it on display in a vertical position?

I'm also interested.  ;D

zpaolo11x

  • Hero Member
  • *****
  • Posts: 868
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #36 on: July 15, 2020, 02:54:56 AM »
You mean you want the same sort of layout, but with the bar in vertical? I see if I can come up with a revised layout...

zpaolo11x

  • Hero Member
  • *****
  • Posts: 868
    • View Profile
    • My deviantart page
Re: advanced progres bar
« Reply #37 on: July 15, 2020, 03:05:01 AM »
Just a few changes allow to place the letter strip in vertical, although there are still some issues in this old code related to games with "The" or "Vs." in the name...

Code: [Select]

function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         s = s.slice (0,3)+"x"
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}


local flw = fe.layout.width
local flh = fe.layout.height
local gamename = fe.add_text("[Title]\n[SortValue]",0,0,flw,flh/10)
gamename.charsize = gamename.height*0.25

local accent = fe.add_text ("[!gameletter]",0,flh*0.5,flw,flh*0.25)
accent.charsize = flh*0.25


local keys = null

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {

   if (ttype == Transition.ToNewSelection){
      local l1 = gameletter(0)
      local l2 = gameletter(var)

      if (l1 != l2){
         keys [l1].alpha = 128
         keys [l2].alpha = 255
      }
   }

   if (ttype == Transition.ToNewList){
      local tableorder = []
      local tableletter = {}

      for (local i = 0 ; i < fe.list.size ; i++){
         local s =  (gameletter (i-fe.list.index))
         try { tableletter[s]++ }
         catch (err) {
            tableletter[s] <- 1
            tableorder.push (s)
         }
      }

      keys = {}
      local i = 0
      local y0 = 0

      foreach (key in tableorder){
         local key_obj = fe.add_text(key,0,y0,50,flh/tableorder.len())
         key_obj.charsize = 25
         key_obj.alpha = ((tableletter[key] > 0) ? 128 : 0)
         key_obj.set_bg_rgb (100+50*(i%2),100+50*(i%2),100+50*(i%2))
         i++
         y0 = y0 + flh/tableorder.len()
         keys[key] <- key_obj
      }

      keys [gameletter(0)].alpha = 255
   }

}

Vaz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: advanced progres bar
« Reply #38 on: July 15, 2020, 06:22:13 AM »
Just a few changes allow to place the letter strip in vertical, although there are still some issues in this old code related to games with "The" or "Vs." in the name...

Code: [Select]

function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         s = s.slice (0,3)+"x"
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}


local flw = fe.layout.width
local flh = fe.layout.height
local gamename = fe.add_text("[Title]\n[SortValue]",0,0,flw,flh/10)
gamename.charsize = gamename.height*0.25

local accent = fe.add_text ("[!gameletter]",0,flh*0.5,flw,flh*0.25)
accent.charsize = flh*0.25


local keys = null

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {

   if (ttype == Transition.ToNewSelection){
      local l1 = gameletter(0)
      local l2 = gameletter(var)

      if (l1 != l2){
         keys [l1].alpha = 128
         keys [l2].alpha = 255
      }
   }

   if (ttype == Transition.ToNewList){
      local tableorder = []
      local tableletter = {}

      for (local i = 0 ; i < fe.list.size ; i++){
         local s =  (gameletter (i-fe.list.index))
         try { tableletter[s]++ }
         catch (err) {
            tableletter[s] <- 1
            tableorder.push (s)
         }
      }

      keys = {}
      local i = 0
      local y0 = 0

      foreach (key in tableorder){
         local key_obj = fe.add_text(key,0,y0,50,flh/tableorder.len())
         key_obj.charsize = 25
         key_obj.alpha = ((tableletter[key] > 0) ? 128 : 0)
         key_obj.set_bg_rgb (100+50*(i%2),100+50*(i%2),100+50*(i%2))
         i++
         y0 = y0 + flh/tableorder.len()
         keys[key] <- key_obj
      }

      keys [gameletter(0)].alpha = 255
   }

}

Thank you!

Wenzon

  • Full Member
  • ***
  • Posts: 57
    • View Profile
Re: advanced progres bar
« Reply #39 on: July 16, 2020, 05:38:14 PM »
Just a few changes allow to place the letter strip in vertical, although there are still some issues in this old code related to games with "The" or "Vs." in the name...

Code: [Select]

function gameletter( offset ) {
   if (fe.filters.len() > 0){

      if (fe.filters[fe.list.filter_index].sort_by == Info.Year){
         local s = fe.game_info( Info.Year, offset )
         s = s.slice (0,3)+"x"
         return s
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Manufacturer){
         local s = fe.game_info( Info.Manufacturer, offset )
         return s.slice(0,1)
      }
      else if (fe.filters[fe.list.filter_index].sort_by == Info.Category){
         local s = fe.game_info( Info.Category, offset )
         if (s == "") return "?"
         s = split( s, "/" )
         return strip(s[0])
         }
      else {
         local s = fe.game_info( Info.Title, offset )
         if (s.find("The ") == 0) s = s.slice(4,s.len())
         local s2 = s.slice(0,1)
         if ("1234567890".find (s2) != null ){
            s2="#"
         }
         return s2
      }
   }
}


local flw = fe.layout.width
local flh = fe.layout.height
local gamename = fe.add_text("[Title]\n[SortValue]",0,0,flw,flh/10)
gamename.charsize = gamename.height*0.25

local accent = fe.add_text ("[!gameletter]",0,flh*0.5,flw,flh*0.25)
accent.charsize = flh*0.25


local keys = null

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {

   if (ttype == Transition.ToNewSelection){
      local l1 = gameletter(0)
      local l2 = gameletter(var)

      if (l1 != l2){
         keys [l1].alpha = 128
         keys [l2].alpha = 255
      }
   }

   if (ttype == Transition.ToNewList){
      local tableorder = []
      local tableletter = {}

      for (local i = 0 ; i < fe.list.size ; i++){
         local s =  (gameletter (i-fe.list.index))
         try { tableletter[s]++ }
         catch (err) {
            tableletter[s] <- 1
            tableorder.push (s)
         }
      }

      keys = {}
      local i = 0
      local y0 = 0

      foreach (key in tableorder){
         local key_obj = fe.add_text(key,0,y0,50,flh/tableorder.len())
         key_obj.charsize = 25
         key_obj.alpha = ((tableletter[key] > 0) ? 128 : 0)
         key_obj.set_bg_rgb (100+50*(i%2),100+50*(i%2),100+50*(i%2))
         i++
         y0 = y0 + flh/tableorder.len()
         keys[key] <- key_obj
      }

      keys [gameletter(0)].alpha = 255
   }

}

THX!!!!  ;D