Author Topic: Shuffle v2.2.0 - Loop feature now added  (Read 2954 times)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Shuffle v2.2.0 - Loop feature now added
« 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

jedione

  • Hero Member
  • *****
  • Posts: 803
  • punktoe
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #1 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...
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #2 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.

rand0m

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #3 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).

rand0m

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #4 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});

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #5 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.


jedione

  • Hero Member
  • *****
  • Posts: 803
  • punktoe
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #7 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});
« Last Edit: June 10, 2019, 10:59:12 AM by jedione »
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #8 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.

jedione

  • Hero Member
  • *****
  • Posts: 803
  • punktoe
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #9 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...
help a friend....

rand0m

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #10 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 :)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #11 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});

jedione

  • Hero Member
  • *****
  • Posts: 803
  • punktoe
    • View Profile
Re: Shuffle v2.0.0 - major update
« Reply #12 on: June 13, 2019, 08:59:41 AM »
im shure you will get it soon your pretty savy........

thanks for your efforts......
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1000
    • View Profile
Re: Shuffle v2.1.0 - Refactoring and bug fixes
« Reply #13 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});


jedione

  • Hero Member
  • *****
  • Posts: 803
  • punktoe
    • View Profile
Re: Shuffle v2.1.0 - Refactoring and bug fixes
« Reply #14 on: June 14, 2019, 06:12:53 AM »
Keil,   your the best thank you ....
help a friend....