Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: keilmillerjr on June 09, 2019, 04:47:22 AM

Title: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on June 09, 2019, 04:47:22 AM
Looping of the list can be enabled or disabled. This feature works as intended, but there is some what if scenarios that might have to be covered in future bug fixe releases.

https://github.com/keilmillerjr/shuffle-module/releases/tag/v2.2.0
Title: Re: Shuffle v2.0.0 - major update
Post by: jedione on June 09, 2019, 11:47:50 AM
So with the with the new script
Does this alow one to use a favorits
Script and if so,  could you show how..
Thanks...
Title: Re: Shuffle v2.0.0 - major update
Post by: keilmillerjr on June 09, 2019, 12:01:21 PM
So with the with the new script
Does this alow one to use a favorits
Script and if so,  could you show how..
Thanks...

Yes, you always could. Will modify your theme in the am or tonight if not too tired. If i don't have your latest, be sure to send it to me and ill send you back a copy. On a mission few hours away to get a super cool and rare crt.
Title: Re: Shuffle v2.0.0 - major update
Post by: rand0m on June 09, 2019, 06:29:48 PM
Thanks for the rework Keil, shuffle v2.0 is working as expected after updating the code (as listed in readme). No errors encountered atm. Any chance to get an additional feature since you are updating the code? An option to switch between default behavior (loop) and stop scrolling at end of list (No loop).
Title: Re: Shuffle v2.0.0 - major update
Post by: rand0m on June 09, 2019, 06:49:30 PM
By the way I updated the following codes if anyone is having difficulty, only listing the parts changed:

Old (Shuffle v1.0)
Code: [Select]
// Extend the Shuffle class
class ShuffleList extends Shuffle {
function update() {
base.update();
}

// Overwrite the select function
function select(slot) {
slot.font="TulpenOne-Regular-Caps.ttf";

// Overwrite the deselect function
function deselect(slot) {
slot.font="TulpenOne-Regular-Caps.ttf";

//Shufffle Pow Extend the Shuffle class
class ShufflePow extends Shuffle {
function update() {
base.update();
}

// Overwrite the select function
function select(slot) {
slot.visible = true;
}

// Overwrite the select function
function deselect(slot) {
slot.visible = false;
}
}

// Create an instance of the extended class
local list = ShuffleList(list, "text");
local pow = ShufflePow(pow, "image");

New/ Updated (Shuffle 2.0)
Code: [Select]
// Extend the Shuffle class
class ShuffleList extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.font="TulpenOne-Regular-Caps.ttf";

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.font="TulpenOne-Regular-Caps.ttf";

//Shufffle Pow Extend the Shuffle class
class ShufflePow extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.visible = true;
}

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.visible = false;
}
}

// Create an instance of the extended class
local list = ShuffleList({ slots=list });
local pow = ShufflePow({ slots=pow});
Title: Re: Shuffle v2.0.0 - major update
Post by: keilmillerjr on June 10, 2019, 04:02:59 AM
Thanks for the rework Keil, shuffle v2.0 is working as expected after updating the code (as listed in readme). No errors encountered atm. Any chance to get an additional feature since you are updating the code? An option to switch between default behavior (loop) and stop scrolling at end of list (No loop).

Oh yeah. I had an idea for how to accomplish that. Back to work today, for two more long days. Give me a reminder Wednesday in case I forget.
Title: Re: Shuffle v2.0.0 - major update
Post by: keilmillerjr on June 10, 2019, 06:18:57 AM
v2.0.1
Bug Fix
Resolved issues with favorites signals

https://github.com/keilmillerjr/shuffle-module/releases/tag/v2.0.1
Title: Re: Shuffle v2.0.0 - major update
Post by: jedione on June 10, 2019, 10:55:05 AM
any help..
i get an error on last line, last column

Code: [Select]
C:\auraAM\layouts/bionic/scripts/shuffle-list.nut line = (90) column = (1) : error expression expected
Script Error in C:\auraAM\layouts/bionic/scripts/shuffle-list.nut - expression expected

ohh.. here is the code...
Code: [Select]
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;


fe.load_module("shuffle");

local x = flx*0.054
##        fly*
local w = flw*0.305
local h = flh*0.120

local x1 = flx*0.000
##        fly*
local w1 = flw*0.490
local h1 = flh*0.130

// Extend the Shuffle class
class ShuffleList extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.font="BebasNeue Regular.ttf";

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.font="BebasNeue Regular.ttf";

local list = [];
list.push(fe.add_text("[Title]", x, fly*0.080, w, h));
list.push(fe.add_text("[Title]", x, fly*0.145, w, h));
list.push(fe.add_text("[Title]", x, fly*0.210, w, h));
list.push(fe.add_text("[Title]", x, fly*0.275, w, h));
list.push(fe.add_text("[Title]", x, fly*0.340, w, h));
list.push(fe.add_text("[Title]", x, fly*0.405, w, h));
list.push(fe.add_text("[Title]", x, fly*0.470, w, h));
list.push(fe.add_text("[Title]", x, fly*0.535, w, h));
list.push(fe.add_text("[Title]", x, fly*0.600, w, h));
list.push(fe.add_text("[Title]", x, fly*0.665, w, h));
list.push(fe.add_text("[Title]", x, fly*0.730, w, h));
list.push(fe.add_text("[Title]", x, fly*0.795, w, h));


/////////////////////////////////////////////////////////

//Shufffle Pow Extend the Shuffle class
class ShufflePow extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.visible = true;
}

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.visible = false;
}
}

local pow = [];
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.090, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.156, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.222, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.286, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.352, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.416, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.482, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.546, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.612, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.678, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.744, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.810, w1, h1));



// Create an instance of the extended class
local list = ShuffleList({ slots=list });
local pow = ShufflePow({ slots=pow});
Title: Re: Shuffle v2.0.0 - major update
Post by: keilmillerjr on June 10, 2019, 12:41:33 PM
any help..
i get an error on last line, last column

Code: [Select]
C:\auraAM\layouts/bionic/scripts/shuffle-list.nut line = (90) column = (1) : error expression expected
Script Error in C:\auraAM\layouts/bionic/scripts/shuffle-list.nut - expression expected

ohh.. here is the code...
Code: [Select]
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;


fe.load_module("shuffle");

local x = flx*0.054
##        fly*
local w = flw*0.305
local h = flh*0.120

local x1 = flx*0.000
##        fly*
local w1 = flw*0.490
local h1 = flh*0.130

// Extend the Shuffle class
class ShuffleList extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.font="BebasNeue Regular.ttf";

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.font="BebasNeue Regular.ttf";

local list = [];
list.push(fe.add_text("[Title]", x, fly*0.080, w, h));
list.push(fe.add_text("[Title]", x, fly*0.145, w, h));
list.push(fe.add_text("[Title]", x, fly*0.210, w, h));
list.push(fe.add_text("[Title]", x, fly*0.275, w, h));
list.push(fe.add_text("[Title]", x, fly*0.340, w, h));
list.push(fe.add_text("[Title]", x, fly*0.405, w, h));
list.push(fe.add_text("[Title]", x, fly*0.470, w, h));
list.push(fe.add_text("[Title]", x, fly*0.535, w, h));
list.push(fe.add_text("[Title]", x, fly*0.600, w, h));
list.push(fe.add_text("[Title]", x, fly*0.665, w, h));
list.push(fe.add_text("[Title]", x, fly*0.730, w, h));
list.push(fe.add_text("[Title]", x, fly*0.795, w, h));


/////////////////////////////////////////////////////////

//Shufffle Pow Extend the Shuffle class
class ShufflePow extends Shuffle {
function refresh() {
base.refresh();
}

// Overwrite the _refreshSelected function
function _refreshSelected(slot) {
slot.visible = true;
}

// Overwrite the _refreshDeselected function
function _refreshDeselected(slot) {
slot.visible = false;
}
}

local pow = [];
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.090, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.156, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.222, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.286, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.352, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.416, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.482, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.546, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.612, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.678, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.744, w1, h1));
pow.push(fe.add_image("artwork/favourite-off.png", x1, fly*0.810, w1, h1));



// Create an instance of the extended class
local list = ShuffleList({ slots=list });
local pow = ShufflePow({ slots=pow});

I don’t know. You only posted 85 lines and the error is on line 90.

I have your theme working almost 100%. I cleaned up a lot of the code too. There is one last bug with shuffle that I need to squash. Ran out of time and will have to go back to it tomorrow after work.
Title: Re: Shuffle v2.0.0 - major update
Post by: jedione on June 10, 2019, 02:08:04 PM
ok thanks,,,  ill wait for it,, not shure why i cant get it...seem strait up...
hmm not shure...but i look forward to using it and learning,,,,

thanks again...
Title: Re: Shuffle v2.0.0 - major update
Post by: rand0m on June 13, 2019, 04:32:54 AM
Thanks for the rework Keil, shuffle v2.0 is working as expected after updating the code (as listed in readme). No errors encountered atm. Any chance to get an additional feature since you are updating the code? An option to switch between default behavior (loop) and stop scrolling at end of list (No loop).

Oh yeah. I had an idea for how to accomplish that. Back to work today, for two more long days. Give me a reminder Wednesday in case I forget.

Hiya, reminder about loop[ issue :)
Title: Re: Shuffle v2.0.0 - major update
Post by: keilmillerjr on June 13, 2019, 05:58:31 AM
I have a bug that is bothering me. Using latest commit in master repo. When adding a favorite, selected slot and next slot becomes a favorite.

Code: [Select]
class ShuffleIndicator extends Shuffle {
function _refresh() {
base._refresh();

for (local i=0; i<this._slots.len(); i++) {
fe.game_info(Info.Favourite, this._slots[i].index_offset) == "1" ? this._slots[i].file_name = "artwork/favourite-on.png" : this._slots[i].file_name = "artwork/favourite-off.png";fe.game_info(Info.Favourite, this._slots[i].index_offset) == "1" ? this._slots[i].file_name = "artwork/favourite-on.png" : this._slots[i].file_name = "artwork/favourite-off.png";
if (fe.game_info(Info.Favourite, this._slots[i].index_offset) == "1") print("favorite on slot: " + i + "\n");
}
}

function _refreshSelected(slot) { slot.visible = true; }
function _refreshDeselected(slot) { slot.visible = false; }
}

local indicator = ShuffleIndicator({slots=indicator, reset=false});
Title: Re: Shuffle v2.0.0 - major update
Post by: jedione on June 13, 2019, 08:59:41 AM
im shure you will get it soon your pretty savy........

thanks for your efforts......
Title: Re: Shuffle v2.1.0 - Refactoring and bug fixes
Post by: keilmillerjr on June 14, 2019, 06:08:19 AM
Updated the first post with v.2.1.0.

@jedione Here’s the update to your Bionic 2 theme. Be sure to use shuffle v2.1.0.

Code: [Select]
fe.load_module("animate");
fe.load_module("shuffle");

local flw = fe.layout.width;
local flh = fe.layout.height;

local config = {};
config.list <- {
x = flw*0.054,
w = flw*0.305,
h = flh*0.120,
};

config.indicator <- {
x = 0,
w = flw*0.490,
h = flh*0.130,
};

local ss = fe.add_image( "artwork/shade.png", 0, 0, flw, flh );
ss.alpha = 200;

local list = [];
list.push(fe.add_text("[Title]", config.list.x, flh*0.080, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.145, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.210, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.275, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.340, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.405, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.470, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.535, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.600, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.665, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.730, config.list.w, config.list.h));
list.push(fe.add_text("[Title]", config.list.x, flh*0.795, config.list.w, config.list.h));

class ShuffleList extends Shuffle {
function _refreshSelected(slot) {
slot.font="BebasNeue Regular.ttf";
slot.align = Align.Left;
slot.charsize = 36;
slot.set_rgb ( 154, 232, 53 );
}

function _refreshDeselected(slot) {
slot.font="BebasNeue Regular.ttf";
slot.align = Align.Left;
slot.charsize = 36;
slot.set_rgb (119, 183, 34);
}
}
local list = ShuffleList({slots=list, reset=false});

local indicator = [];
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.090, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.156, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.222, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.286, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.352, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.416, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.482, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.546, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.612, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.678, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.744, config.indicator.w, config.indicator.h));
indicator.push(fe.add_image("artwork/favourite-off.png", config.indicator.x, flh*0.810, config.indicator.w, config.indicator.h));

class ShuffleIndicator extends Shuffle {
function _refreshAll(slot) { fe.game_info(Info.Favourite, slot.index_offset) == "1" ? slot.file_name = "artwork/favourite-on.png" : slot.file_name = "artwork/favourite-off.png"; }
function _refreshSelected(slot) { slot.visible = true; }
function _refreshDeselected(slot) { slot.visible = false; }
}
local indicator = ShuffleIndicator({slots=indicator, reset=false});

Title: Re: Shuffle v2.1.0 - Refactoring and bug fixes
Post by: jedione on June 14, 2019, 06:12:53 AM
Keil,   your the best thank you ....
Title: Re: Shuffle v2.1.0 - Refactoring and bug fixes
Post by: keilmillerjr on June 15, 2019, 03:04:44 PM
@Rand0m

I forgot, but I think fe.list.index is position in array, not relative to current. If this be the case, loop=false is definately possible. If the index is zero or the same as the list length minus 1, do no change slot. Some checks will have to be put in place to make sure that your not starting with index 0 or max in the middle of the slots. If list size is less than slots, your layout will have to adjust accordingly. Thats my brainstorming while waiting for work to start. Next day off will try to tackle.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on June 18, 2019, 02:16:12 AM
v.2.2.0 is out. Updated main post. I hope you guys like the addition of the requested feature - loop!
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on June 18, 2019, 04:28:12 AM
v.2.2.0 is out. Updated main post. I hope you guys like the addition of the requested feature - loop!

What a pleasant surprise, thanks a lot Keil! No loop is working great, one small issue is when moving back (say from SNES to Consoles) Console becomes the first item on the list (instead of arcades then computers then consoles). I think I can force it to go to first item (in this case arcades) but if it can retain the position of its parent item, it would be great.

Thanks a lot, this issue had been bugging me for ages. more power to you. I am much grateful!  ;D

If anyone wants to use the no loop, i.e. the items won't be repeated. Then, wrt to example in last page:

Code: [Select]
local list = ShuffleList({ loop=false, slots=list });
local pow = ShufflePow({ loop=false, slots=pow});
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on June 22, 2019, 12:42:07 AM
Working on two things:

Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on July 25, 2019, 10:13:23 AM
Keil, I think that all the versions you have taken out of the Shuffle module do something that I don't like at all. It is not important, it will surely seem good to others.

But if I have a shuffle list of 24 titles, and for example, I change the filter with next_filter(), and the new list has only 5 titles, what the shuffle list does is repeat the names until the 24 slots are filled.

I think it would be better if only those 5 came out. But, or I haven't seen it, or there's no such option in the shuffle module.

This is how you want it to work, or you could set an option to work as i say?

Thank you for your time, and sorry for the inconvenience.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on July 25, 2019, 11:30:06 AM
Keil, I think that all the versions you have taken out of the Shuffle module do something that I don't like at all. It is not important, it will surely seem good to others.

But if I have a shuffle list of 24 titles, and for example, I change the filter with next_filter(), and the new list has only 5 titles, what the shuffle list does is repeat the names until the 24 slots are filled.

I think it would be better if only those 5 came out. But, or I haven't seen it, or there's no such option in the shuffle module.

This is how you want it to work, or you could set an option to work as i say?

Thank you for your time, and sorry for the inconvenience.

Code: [Select]
local list = ShuffleList({ save="Retromania", hide=true, loop=false, slots=list });
local pow = ShufflePow({ save="Retromania", hide=true, loop=false, slots=pow});

Adding hide=true will not repeat items in list.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on July 25, 2019, 01:03:58 PM

Code: [Select]
local list = ShuffleList({ save="Retromania", hide=true, loop=false, slots=list });
local pow = ShufflePow({ save="Retromania", hide=true, loop=false, slots=pow});

Adding hide=true will not repeat items in list.

Thanks, but ... are you sure? Because in the documentation of shuffle 2.2.0 there is nothing about that...
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on July 25, 2019, 03:52:22 PM

Code: [Select]
local list = ShuffleList({ save="Retromania", hide=true, loop=false, slots=list });
local pow = ShufflePow({ save="Retromania", hide=true, loop=false, slots=pow});

Adding hide=true will not repeat items in list.

Thanks, but ... are you sure? Because in the documentation of shuffle 2.2.0 there is nothing about that...

That feature isnt finished, thats why it isnt documented or in a versioned release. You can try it with the latest commit in the master branch. Ive been busy and distracted. Will get back to it at some point.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on July 26, 2019, 02:36:13 AM
This code

Code: [Select]
fe.load_module("shuffle");

// Lista
local flxl = flx*0.0255;
local flyl = fly*0.1656;
local flwl = flw*0.2792;
local flhl = flh*0.0001;
local fhl  = flh*0.0252;
local lineas = 24;

local list = [];
for(local i=0; i<lineas; i++)
{
list.push(fe.add_text("[Title]", flxl, flyl, flwl, flhl));
flyl = flyl + fhl;
}

class ShuffleList extends Shuffle
{
function _refreshSelected(slot)
{
slot.align = Align.Left;
slot.charsize = fuente_selec;
slot.set_rgb(Rd,Gd,Bd);
}

function _refreshDeselected(slot)
{
slot.align = Align.Left;
slot.charsize = fuente_peque;
slot.set_rgb(Rl,Gl,Bl);
}
}

local list = ShuffleList({ save="barrika beach", hide=true, loop=false, slots=list, reset=true });

Display this:
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on July 26, 2019, 04:39:16 AM
iOtero - try the latest commit in the master branch. As for the animation you want, i would use a surface. You need to use ticks to keep track of time and transitions. Understanding the concept can be kind of hard at first. Unless the animation library provides something. Im not sure.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on July 26, 2019, 04:51:09 AM
iOtero - try the latest commit in the master branch. As for the animation you want, i would use a surface. You need to use ticks to keep track of time and transitions. Understanding the concept can be kind of hard at first. Unless the animation library provides something. Im not sure.

Thanks Kiel, I have already solved the animation with a surface. I made a silly mistake when positioning the surface.  :-[

I will try what you tell me with latest commit.

Checked, it works fine whenever loop = false. If I put loop = true, the list goes well, but the pow gets out of control. Thanks.

Error message:

Code: [Select]

AN ERROR HAS OCCURED [indexing integer with string]

CALLSTACK
*FUNCTION [_transitions()] E:\pi\attract\modules\shuffle.nut line [171]

LOCALS
[ttime] 0
[var] 0
[ttype] 7
[this] INSTANCE
Script Error in transition function: _transitions - indexing integer with string

AN ERROR HAS OCCURED [indexing integer with string]

CALLSTACK
*FUNCTION [_transitions()] E:\pi\attract\modules\shuffle.nut line [171]

LOCALS
[ttime] 0
[var] 0
[ttype] 7
[this] INSTANCE
Script Error in transition function: _transitions - indexing integer with string

AN ERROR HAS OCCURED [indexing integer with string]

CALLSTACK
*FUNCTION [_transitions()] E:\pi\attract\modules\shuffle.nut line [171]

LOCALS
[ttime] 0
[var] 0
[ttype] 7
[this] INSTANCE
Script Error in transition function: _transitions - indexing integer with string

Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on September 14, 2019, 10:23:24 AM
Keil, there is a bug that I get using this module, you can see it in the 01:55 minute of this video:

https://www.youtube.com/watch?v=q4Rp2SoTB-o (https://www.youtube.com/watch?v=q4Rp2SoTB-o)

When i change Category, the pointer stays out of the list and does not move if the following list has fewer lines...

The code used is as follows:

Code: [Select]
// Lista
local flxl = flx*0.0155;
local flyl = fly*0.1908;
local flwl = flw*0.2832;
local flhl = flh*0.0001;
local fhl  = flh*0.0305;
local lineas = 20;

local lista = [];

for(local i=0; i<lineas; i++)
{
lista.push(fe.add_text("[Title]", flxl, flyl, flwl, flhl));
flyl = flyl + fhl;
}

class ShuffleList extends Shuffle
{
function _refreshSelected(slot)
{
slot.align = Align.Left;
slot.charsize = fuente_peque;
}

function _refreshDeselected(slot)
{
slot.align = Align.Left;
slot.charsize = fuente_peque;
}
}

local lista = ShuffleList({hide=true, loop=false, slots=lista, reset=false });

// Marcador
local flxp = flx*0.0078;
local flyp = fly*0.1735;
local flwp = flw*0.0125;
local flhp = flh*0.042;

local marcador = [];

for(local i=0; i<lineas; i++)
{
marcador.push(fe.add_image("objs/flecha.png", flxp, flyp, flwp, flhp));
flyp = flyp + fhl;
}

class ShuffleMarcador extends Shuffle
{
function _refreshSelected(slot)
{
slot.visible = true;
}

function _refreshDeselected(slot)
{
slot.visible = false;
}
}

local marcador = ShuffleMarcador({hide=true, loop=false, slots=marcador, reset=false});
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on September 14, 2019, 10:38:10 AM
Good find iOtero. I have logic for new list, but not filters. Currently working on a new project. Transferring everything to gitlab group and started a wiki. Will put this on my list to do afterwards. Thank you!

Wiki is http://arcademvs.org if you want to check it out. Going to have an attract section for setting up filters and displays eventually. I think a few people here could help me with the displays section.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on September 15, 2019, 04:46:08 AM
When i give the link to arcademvs he tells me this:

arcademvs.com
2019 Copyright. All Rights Reserved.
The Sponsored Listings displayed above are served automatically by a third party. Neither the service provider nor the domain owner maintain any relationship with the advertisers. In case of trademark issues please contact the domain owner directly (contact information can be found in whois).
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on September 15, 2019, 05:42:10 AM
When i give the link to arcademvs he tells me this:

arcademvs.com
2019 Copyright. All Rights Reserved.
The Sponsored Listings displayed above are served automatically by a third party. Neither the service provider nor the domain owner maintain any relationship with the advertisers. In case of trademark issues please contact the domain owner directly (contact information can be found in whois).


arcademvs.org - I made a mistake.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on September 30, 2019, 01:14:00 PM
I have visited arcademvs.org, and it will be because of my poor command of the English language, but i have no idea what you intend to do on that site... Sorry  :-[
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on September 30, 2019, 09:52:01 PM
I have visited arcademvs.org, and it will be because of my poor command of the English language, but i have no idea what you intend to do on that site... Sorry  :-[

Guides for creating MAME machines. I have a guide how to fully hide windows 10, how to create a mame setup from scratch on the raspberry pi, unix commands, how to compile mame on different operating systems. These are things a lot of people struggle with or just haven't a clue to do and instead seek “images” and end up in the same position of not knowing how to do something. The namespace also now houses my attract layouts/modules/plugins. Guides might be at a standstill until I fix my flyback transformer.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on October 17, 2019, 10:07:53 PM
Good find iOtero. I have logic for new list, but not filters. Currently working on a new project. Transferring everything to gitlab group and started a wiki. Will put this on my list to do afterwards. Thank you!

Wiki is http://arcademvs.org if you want to check it out. Going to have an attract section for setting up filters and displays eventually. I think a few people here could help me with the displays section.

Hiya Keil, Filter info update on display change has been fixed > https://github.com/mickelson/attract/commit/7dc5c88ca15d756f53ff28e427f8b6be019a1db7
If I understand it correctly jumping from one filter to next should behave similarly to new display as filter array is reloaded
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on October 24, 2019, 05:40:55 AM
Well nothing... To compile Attract-Mode again... thanks for the info Rand0m...
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on October 24, 2019, 10:08:38 AM
Well nothing... To compile Attract-Mode again... thanks for the info Rand0m...

The filter issue still persists, just checked.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on December 10, 2019, 10:00:07 AM
Keil, i know that you are very busy with other things, but are you going to someday end this plugin? It doesn't work properly.
Thanks.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: keilmillerjr on December 11, 2019, 02:48:10 AM
Keil, i know that you are very busy with other things, but are you going to someday end this plugin? It doesn't work properly.
Thanks.

I will try to continue it soon. Latest attract commits will be good for this. However, my financial standing may impact my time with attract for a while.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on December 11, 2019, 06:58:43 AM
Keil, i know that you are very busy with other things, but are you going to someday end this plugin? It doesn't work properly.
Thanks.

I will try to continue it soon. Latest attract commits will be good for this. However, my financial standing may impact my time with attract for a while.

Ok, thanks.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: iOtero on January 03, 2020, 04:37:58 AM
Well, since I needed Shuffle to work correctly when changing filters, I made this modification to your code. I hope it doesn't bother you.
I guess it's not the right modification you would make, but for now it works for me. And it has been easier than I thought, I've only added five lines of code.

Your original code:

Code: [Select]
function _signals(signal_str)
{
switch(signal_str)
{
// ignore signals at start or end of list when looping is false
case "prev_game":

if(this._loop == false && fe.list.index == 0) return true;
break;

case "next_game":

if(this._loop == false && fe.list.index == fe.list.size-1) return true;
break;

// do not update selection for these signals
case "prev_letter":
case "next_letter":
case "random_game":
case "add_favourite":
case "prev_favourite":
case "next_favorite":
this._ignoreNewSelection = true;
break;
}

return false;
}

Modified code:

Code: [Select]
function _signals(signal_str)
{
switch(signal_str)
{
// ignore signals at start or end of list when looping is false
case "prev_game":

if(this._loop == false && fe.list.index == 0) return true;
break;

case "next_game":

if(this._loop == false && fe.list.index == fe.list.size-1) return true;
break;

case "prev_filter":

case "next_filter":
this._selected = 0;
fe.list.index = 0;
break;

// do not update selection for these signals
case "prev_letter":
case "next_letter":
case "random_game":
case "add_favourite":
case "prev_favourite":
case "next_favorite":
this._ignoreNewSelection = true;
break;
}

return false;
}

This fixes the problem with the filter change, but not with the letter change... which is not going well either.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on January 30, 2020, 10:11:47 AM
This fixes the problem with the filter change, but not with the letter change... which is not going well either.

Tested your solution on my layout and it works :D experimented some more and if we change "reset" to true in following part (your might be different):

Code: [Select]
local list = ShuffleList({ save="retrodiction", hide=true, loop=false, reset=true, slots=list });
local pow = ShufflePow({ save="retrodiction", hide=true, loop=false, reset=true, slots=pow});

We won't need additional instructions and original code will work. IMHO "save=layout_name" and "reset=true" operates in most optimal fashion and takes care of anyother function(s) we might use like "search_results" and  "filter_menu" without adding additional instructions for them.

Kudos to Keil, shuffle is working really great now!
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on June 02, 2020, 12:54:36 AM
Keil, i know that you are very busy with other things, but are you going to someday end this plugin? It doesn't work properly.
Thanks.

I will try to continue it soon. Latest attract commits will be good for this. However, my financial standing may impact my time with attract for a while.

Hiya Keil, I want to keep "reset" to off for all functions but search result. If number of search-returned item is lower then position of selector/ selected when search is initiated, it gets stuck. Don't want to  turn of reset because it resets on everything then like after starting/ exiting a game we are at start of list. Is there anyway to create an exception for "reset" so it ignores search results?

"reset" as in following code >
Code: [Select]
local list = ShuffleList({ save="retrodiction", hide=true, loop=false, reset=false, slots=list });
local pow = ShufflePow({ save="retrodiction", hide=true, loop=false, reset=false, slots=pow});
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: rand0m on June 02, 2020, 01:26:40 AM
I am using "custom3" to initiate search. Adding the following code:
Code: [Select]
// update selection for these signals
case "custom3":
this._reset = true;
break;

after "do not update for these selections" part does result in selection being reset to first item on list - BUT this happens on button press (custom3) not on search results. In this case even If there are no search results, that is you don't go to search result list but stay on original list, the selection will reset to item 1 on list.

Looked at all the signals, I don't think there is any signal specifically for search or search_results. Checking now if something like next_display etc can be used.
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: kent79 on April 13, 2021, 12:33:18 AM
Hello keilmillerjr

May I know is it possible to do it with my idea, Thanks.

http://forum.attractmode.org/index.php?topic=3957.0
Title: Re: Shuffle v2.1.0 - Refactoring and bug fixes
Post by: Daniel Arcade on March 09, 2024, 10:10:44 AM

I would like to do something like this with the gender images so that their image appears on each line instead of repeating the same image in all slots as in this attached image
Title: Re: Shuffle v2.2.0 - Loop feature now added
Post by: Daniel Arcade on March 09, 2024, 10:15:26 AM
I would like it to stay like this