Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: keilmillerjr on January 01, 2019, 07:51:20 PM

Title: shuffle-module: First official release
Post by: keilmillerjr on January 01, 2019, 07:51:20 PM
Quote from: https://github.com/keilmillerjr/shuffle-module/releases/tag/v1.0.0
This is Shuffle’s first official release. Shuffle will now used versioned releases. Please update your layouts to the latest release and make note of the version used to prevent the breaking of your layouts.

I know some people are using my shuffle module. The latest commit will break existing layouts. I am sorry. Please either update your layout, or link in your readme to a previous specific commit. I am now using versioning, and it should prevent issues like this in the future.

Expect to see versioning in use slowly as I update other modules/plugins/layouts. I accomplished some attract coding on my holiday break. Still need to polish a few items, update readme, and push to GitHub. Might be a few days for other releases like an updated shader module. We will see how my new work schedule of 12hr nights works out. Good news is I will have random days off during the week with a 2 on / 3 off / 3 on / 2 off schedule. Not excited.
Title: Re: shuffle-module: First official release
Post by: iOtero on January 02, 2019, 04:12:15 AM
Well, I have been using this shuffle module for a long time and it has not given me any problems...  8)


But hey, I'll try the new one ...  ::)
Title: Re: shuffle-module: First official release
Post by: rand0m on January 02, 2019, 12:53:26 PM
Successfully updated the layout with shuffle 1.0 after including the magic token as you suggested. Thank you!
Title: Re: shuffle-module: First official release
Post by: iOtero on January 03, 2019, 10:32:54 AM
Well, i will continue using the old module, at least until i see a complete practical example. I do not intend to waste my time doing tests until i find the correct way to apply the new module... Besides, i am one of those who think that something works, the best thing is not to touch it... :D


Now if someone translates this to the new module, then i will be grateful:

Code: [Select]
local flxl = flx*0.4805;
local flwl = flw*0.5016;
local flhl = flh*0.0315;
local bfy  = 0.1825;
local rows =20;

local list = Shuffle(rows, "text", "[Title]");

for(local i=0; i<rows; i++)
{
list.slots[i].set_pos(flxl, fly*bfy, flwl, flhl);
bfy = bfy + 0.0252;
}

class ShufflePow extends Shuffle
{
function select(slot)
{
slot.visible = true;
}

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

local flxp = flx*0.4705;
local flwp = flw*0.5313;
local flhp = flh*0.0495;
local pfy = 0.177;

local pow = ShufflePow(rows, "image", "objs/sys/selector.png");

for(local i=0; i<rows; i++)
{
pow.slots[i].set_pos(flxp, fly*pfy, flwp, flhp);
pfy = pfy + 0.0252;
}

function fade_transitions(ttype, var, ttime)
{
switch(ttype)
{
case Transition.ToNewSelection:
case Transition.ToNewList:

local Wheelclick = fe.add_sound("objs/sys/clic.mp3");
Wheelclick.playing=true;

break;
}
return false;
}

fe.add_transition_callback("fade_transitions");
Title: Re: shuffle-module: First official release
Post by: jedione on January 06, 2019, 10:06:55 AM

so dose the new module.. work better than the original?

their must be a reason. for the change.

it does not list support for animation ,  the original works with animation for me.

Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 06, 2019, 10:14:41 AM

so dose the new module.. work better than the original?

their must be a reason. for the change.

it does not list support for animation ,  the original works with animation for me.

Quote from: https://github.com/keilmillerjr/shuffle-module/commit/ce4a7d9ab28e788fe2f99359057c4ee6f7cde5ec
Shuffle no longer creates objects. Object array must be passed to class. Supports preserve-art module. Update now called by transitions instead of signals, resolving some issues. Updated mvscomplete image and readme. This commit will break existing usage of the module, and layouts must be updated.

It works no better than before. Objects are now created outside the class. I think it produces cleaner code. Additionally, it now supports the preserve-art module. Animations and effects can be added just like before by extending the class. I hope to add the ability that some requested, optionally no looping of indexes. Versioned releases will make this easier for people using this module.
Title: Re: shuffle-module: First official release
Post by: iOtero on January 07, 2019, 04:52:21 AM
I do not see the improvements anywhere and the code will be clearer for some... not for me, besides you say it yourself: "It works no better than before." ;D

I will continue using the old one, which works very well, allows objects and animations...  8)

That something works, the best thing is not to touch it... :D
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 07, 2019, 05:18:47 AM
I do not see the improvements anywhere and the code will be clearer for some... not for me, besides you say it yourself: "It works no better than before." ;D

I will continue using the old one, which works very well, allows objects and animations...  8)

That something works, the best thing is not to touch it... :D

There is improvement in functionality. New version supports preserve-art module. Good thing about GitHub is your free to view/use at any point in history.
Title: Re: shuffle-module: First official release
Post by: iOtero on January 07, 2019, 06:13:55 PM
There is improvement in functionality. New version supports preserve-art module. Good thing about GitHub is your free to view/use at any point in history.

I find it very good, but I do not find it useful to preserve art module. I do not need it.  8)
Title: Re: shuffle-module: First official release
Post by: FrizzleFried on January 11, 2019, 08:06:32 AM
What does the module do?
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 11, 2019, 08:15:02 AM
What does the module do?

Check out the readme. It describes it well and provides two animated gif examples.

https://github.com/keilmillerjr/shuffle-module/blob/v1.0.0/readme.md
Title: Re: shuffle-module: First official release
Post by: rand0m on January 17, 2019, 09:02:36 PM
It works no better than before. Objects are now created outside the class. I think it produces cleaner code. Additionally, it now supports the preserve-art module. Animations and effects can be added just like before by extending the class. I hope to add the ability that some requested, optionally no looping of indexes. Versioned releases will make this easier for people using this module.

The "no looping of indexes" part would be great :D. I have some small queries regarding the use of (current version) shuffle.

a) Lets say we have a list of 5 items A,B,C,D & E, with A being the first item in list and E being the last. A is given the spot 100, 100, B 100, 200 till E 100, 500. While we scroll downwards from A and reach E, scrolling down further will move the list to item A but will the same spot (E, 100, 500). It this the intended behavior? Or is the selection area is supposed to move to A (100, 100)? With no looping of indexes will the list stop moving downward from E (100, 500) or jump back to A (100, 100)?

b) I am currently using shuffle in displaymenu with only 5 items. It seems that AM function of pressing down for quick scrolling is not being applied, is my list too short for application or shuffle doesn't support that?

c) What about really long lists like e.g. mame romlist. Currently I have to enter manually 5 items in shuffle with their locations, how would that work with 100+ items lists? Is there any other way of applying shuffle in a vertical list with numerous items where we don't have to manually position each row/ slot?
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 18, 2019, 12:30:21 AM
a) Lets say we have a list of 5 items A,B,C,D & E, with A being the first item in list and E being the last. A is given the spot 100, 100, B 100, 200 till E 100, 500. While we scroll downwards from A and reach E, scrolling down further will move the list to item A but will the same spot (E, 100, 500). It this the intended behavior? Or is the selection area is supposed to move to A (100, 100)? With no looping of indexes will the list stop moving downward from E (100, 500) or jump back to A (100, 100)?

Correct. That is the intended behavior. I had intentions of using it with romlist which would be higher than the array of objects. It does seem weird if your index length is the same as your objects... or less!

b) I am currently using shuffle in displaymenu with only 5 items. It seems that AM function of pressing down for quick scrolling is not being applied, is my list too short for application or shuffle doesn't support that?

Excited for this comment! I wasn't sure if the issue only occurred for myself or others. I think the only way to get around this is to not use attract-mode's signals. I just had a quick look at the conveyor class. I might have to implement something like that to simulate attract-mode's natural indexing. I wanted to stay away from it because other things can receive signals. Manually indexing means I could implement a no loop feature. Will investigate further in two days. Thank you for bringing this to my attention!

c) What about really long lists like e.g. mame romlist. Currently I have to enter manually 5 items in shuffle with their locations, how would that work with 100+ items lists? Is there any other way of applying shuffle in a vertical list with numerous items where we don't have to manually position each row/ slot?

I would hope you wouldn't be showing 100 items in a list at the same time. However, you can create a for loop that creates the object and step things sequentially.
Title: Re: shuffle-module: First official release
Post by: rand0m on January 18, 2019, 12:51:31 AM

Correct. That is the intended behavior. I had intentions of using it with romlist which would be higher than the array of objects. It does seem weird if your index length is the same as your objects... or less!

Excited for this comment! I wasn't sure if the issue only occurred for myself or others. I think the only way to get around this is to not use attract-mode's signals. I just had a quick look at the conveyor class. I might have to implement something like that to simulate attract-mode's natural indexing. I wanted to stay away from it because other things can receive signals. Manually indexing means I could implement a no loop feature. Will investigate further in two days. Thank you for bringing this to my attention!

I would hope you wouldn't be showing 100 items in a list at the same time. However, you can create a for loop that creates the object and step things sequentially.

I don't want to be showing hundreds of items at the same time but the ability to browse through hundreds of items in a vertical list (plain text) where a dozen or so are visible on screen at any time. Similar behavior to that of AM default.

Is retrorama2 theme (.gif in Shuffle's main github dir) utilizing the said loop? I am stuck on the idea that one slot equals one row so a list, of say 100 roms, will require 100 different slots each with its own placement (manual) instruction. In retrorama2 gif it seems there is a single slot and user can vertically browse through the roms listed in that single slot.

I am sorry for so many Q's but slots/ arrays/ rows all get mixed together for me as I don't have a programming background :D.
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 18, 2019, 01:07:35 AM
I chose the name for the module because it “shuffles” indexes through objects. Create an array. Push the objects to the array. For instance, you want 12 text objects on the screen, push 12 objects. You can do this manually, or create a loop for count of 12 to do it. Style the objects. Pass the array to the shuffle class.

If you can’t get it, I’ll provide an example for you on Saturday.
Title: Re: shuffle-module: First official release
Post by: rand0m on January 18, 2019, 02:34:18 AM
I chose the name for the module because it “shuffles” indexes through objects. Create an array. Push the objects to the array. For instance, you want 12 text objects on the screen, push 12 objects. You can do this manually, or create a loop for count of 12 to do it. Style the objects. Pass the array to the shuffle class.

If you can’t get it, I’ll provide an example for you on Saturday.

Please do, I can work my way through trial and error with an example. I have looked into previous themes utilizing the shuffle module but the code is obsolete with regards to current version.
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 18, 2019, 03:45:12 AM
Taken from the readme is an example with three text objects. They are passed as an array to the class constructor. The index of these objects is handled by the class. You place or style the objects however.

You could create 12 text objects with Title as a magic string. Position them in a visually stacked manner. Extend the class select function to make object bold. Now you can see which object is selected. It should operate similar to attract’s built in listbox object, but allows for much more freedom.

Quote from: https://github.com/keilmillerjr/shuffle-module/blob/master/readme.md
// Load the Shuffle module
fe.load_module("shuffle");

// Create your objects
local list = [];
   list.push(fe.add_text("Title", -1, -1, 1, 1));
   list.push(fe.add_text("Title", -1, -1, 1, 1));
   list.push(fe.add_text("Title", -1, -1, 1, 1));

// Create an instance of the Shuffle class
// Shuffle(slots, type, reset=true)
local list = Shuffle(list, "text");

Best I can do on iPhone until Saturday. Feel free to hit me up on discord if you need to.
Title: Re: shuffle-module: First official release
Post by: rand0m on January 18, 2019, 06:18:16 AM
Taken from the readme is an example with three text objects. They are passed as an array to the class constructor. The index of these objects is handled by the class. You place or style the objects however.

You could create 12 text objects with Title as a magic string. Position them in a visually stacked manner. Extend the class select function to make object bold. Now you can see which object is selected. It should operate similar to attract’s built in listbox object, but allows for much more freedom.

Best I can do on iPhone until Saturday. Feel free to hit me up on discord if you need to.

Thanks a lot Keil, I finally got both the text and images working with the new version (1.0) of shuffle :D. I will now try my luck shuffle on larger lists following your suggestions.

I think fast browsing is working in shuffle, though my list (of 5 items) seems to be too short for the fast browsing option of AM to be truly noticeable as it reaches the end too fast and (like AM) stops at the last item before looping. I've uploaded a small video of my current shuffle setup (displaymenu only) and you can check the fast browsing part near the end (around 08 secs).

Video Link: https://youtu.be/rb4ttP4QKq4

PS: A shout out to @jedione too, it was his theme which helped a lot in figuring out the image part!
Title: Re: shuffle-module: First official release
Post by: jedione on January 18, 2019, 09:54:29 AM
word..that looks so clean....bro
Title: Re: shuffle-module: First official release
Post by: keilmillerjr on January 18, 2019, 07:29:01 PM
Taken from the readme is an example with three text objects. They are passed as an array to the class constructor. The index of these objects is handled by the class. You place or style the objects however.

You could create 12 text objects with Title as a magic string. Position them in a visually stacked manner. Extend the class select function to make object bold. Now you can see which object is selected. It should operate similar to attract’s built in listbox object, but allows for much more freedom.

Best I can do on iPhone until Saturday. Feel free to hit me up on discord if you need to.

Thanks a lot Keil, I finally got both the text and images working with the new version (1.0) of shuffle :D. I will now try my luck shuffle on larger lists following your suggestions.

I think fast browsing is working in shuffle, though my list (of 5 items) seems to be too short for the fast browsing option of AM to be truly noticeable as it reaches the end too fast and (like AM) stops at the last item before looping. I've uploaded a small video of my current shuffle setup (displaymenu only) and you can check the fast browsing part near the end (around 08 secs).

Video Link: https://youtu.be/rb4ttP4QKq4

PS: A shout out to @jedione too, it was his theme which helped a lot in figuring out the image part!

Looks very nice! I noticed that your indexing seems very quick. If you hold down the next game control, does it continue to index until the end of the list?
Title: Re: shuffle-module: First official release
Post by: rand0m on January 18, 2019, 09:50:25 PM
word..that looks so clean....bro

Thanks man, I am trying to follow file manager (tree) organizational setup with systems opening and closing like folders and moving in similar hierarchy.

Looks very nice! I noticed that your indexing seems very quick. If you hold down the next game control, does it continue to index until the end of the list?

Thanks Keil, yes the indexing is quick and overall experience has improved quite a bit by using mipmap. I've tried the shuffle plugin on a large list 200+ and AM quick browsing does work as intended. Indexing also continue to index till the end of list and stops there, I have to press down again to continue the indexing (which starts from 1st item of list).

I'll upload another video of shuffle in a large list in a couple of hours.
Title: Re: shuffle-module: First official release
Post by: rand0m on January 19, 2019, 06:35:38 AM
Looks very nice! I noticed that your indexing seems very quick. If you hold down the next game control, does it continue to index until the end of the list?

Here is a much longer video showing shuffle in 200+ list > https://youtu.be/cEAhZQLsCho

Shuffle is working brilliantly but two instances where I am facing some trouble:

1) Feels a tad bit slower then AM default, it might very well be videos which I have to re-encode or my awful coding skills :D.
2) Some romsets have fewer then 10 roms, on a shuffle setup with 10+ objects rom titles are repeated (repetition not in loop but on the same screen).

word..that looks so clean....bro

Check it out now bro, not in its full glory since its very much a WIP but still.