Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: jedione on September 27, 2018, 06:32:35 PM

Title: help with game indicator bar....
Post by: jedione on September 27, 2018, 06:32:35 PM
so iv seen two or three theems now that are using a bar  to indicate your
position or letter index of you rom colection

iv tried breaking the themes down to see if i could isolate just the code
but seems their all heavily tied to a lot of options config,  so it will break the theme.

all im looking for would be the most generic simple coding to make this bar
my goal is to make it into a donut, file that the themer can use and alter .

soon im hoping to release a zip file that will contain abought 20 plus donut to simplefy codeing
for many to build cool themes

hear is generic  pic of it..
(http://i66.tinypic.com/2wpuq05.png)

thanks if you can help me.....
Title: Re: help with game indicator bar....
Post by: zpaolo11x on September 27, 2018, 10:10:26 PM
all im looking for would be the most generic simple coding to make this bar
my goal is to make it into a donut, file that the themer can use and alter .

Well the easiest way to do it is tie the dimension of the bar to you index position, and change it in an "on transition" routine. Something like

bar.width = (fe.list.index*1.0/(fe.list.size - 1))*full_bar_size

should do the trick. Remember to put the 1.0 somewhere so that data is treated as float as not integer. I don't remember why I needed the *- 1* but try experimenting with that. To be sure that the update is always consistent I just change it for every transition, just at the beginning of the on_transition routine.

Title: Re: help with game indicator bar....
Post by: jedione on September 28, 2018, 07:46:45 AM
thanks for some clues,  will have to mess with it this weekend

just a quick test with this

local blue = fe.add_image(  "blue.png", flx*0.300, fly*0.500, flw*0.400, flh*0.100 );
blue.width = (blue)/(fe.list.size) * (fe.list.index+1);

gives this error: Script Error in C:\AMarcade\layouts/bar/layout.nut - arith op / on between 'instance' and 'integer'

Title: Re: help with game indicator bar....
Post by: zpaolo11x on September 28, 2018, 08:07:45 AM
local blue = fe.add_image(  "blue.png", flx*0.300, fly*0.500, flw*0.400, flh*0.100 );
blue.width = (blue)/(fe.list.size) * (fe.list.index+1);

gives this error: Script Error in C:\AMarcade\layouts/bar/layout.nut - arith op / on between 'instance' and 'integer'

You have to change "blue" in the last line with the actual size of the full bar, otherwise you're comparing an istance (blue) with a number (blue.width). And you have to put the update routine in the on_transmission function. Try something like this:

Code: [Select]
local back = fe.add_image(  "black.png", 0, 0, 500, 50 );
local front = fe.add_image(  "white.png", 0, 0, 500, 50 );

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {
   front.width = (back.width)/(fe.list.size) * (fe.list.index+1)
}
Title: Re: help with game indicator bar....
Post by: jedione on September 28, 2018, 07:06:48 PM
just want to say a big thank you!   :D

here it is working...

https://youtu.be/NpXHcEdUX1s

looking forward to releasing the donut zip file that will help others and me
to make themes with "code" snips 

case closed,  and simple just what i wanted,   

ps your theme is amazing thanks for helping the small guys
Title: Re: help with game indicator bar....
Post by: rand0m on December 07, 2018, 04:40:07 AM
Please do release the donut.zip file when its complete ;D I loved the index/ indicator bar in video can't wait to tweak it a bit when the code snippets are released.
Title: Re: help with game indicator bar....
Post by: gunthermic on December 10, 2018, 10:10:15 PM
Are ya going to release this by chance
Title: Re: help with game indicator bar....
Post by: Neosys on August 14, 2019, 11:04:17 AM
@zpaolo11x

Thank you!!!

Your code works fine for me.

Greetz Neosys