Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: nevincho on August 28, 2018, 12:42:41 AM

Title: Problem plugin - Random
Post by: nevincho on August 28, 2018, 12:42:41 AM
Does not record the correct time. At 60 seconds, changes the game list every 10-12 seconds ...

Title: Re: Problem plugin - Random
Post by: nevincho on August 30, 2018, 03:48:38 AM
Any one?
Title: Re: Problem plugin - Random
Post by: nevincho on September 04, 2018, 08:05:21 AM
WTF?! Really no one can help me?
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 04, 2018, 02:39:24 PM
I looked at it quickly on my iPhone. Can’t afford to pay my isp this month, so my help is temporarily limited. Damn.

Default number of seconds is 600. I think you meant to set a default of 60? Prepending variables with m_ gets a tad confusing. You shouldn’t have to set a nv record. Just have transitions or signals update a class variable, and use that to compare with ticks for idle time and if it’s in gameplay.? I did this a long time ago as a screensaver for one of my themes - but ended up just using the default screensaver.

If you need further help, I can definitely do it but have to be patient. I started a new job today really good one and can’t even complete my work because no money for Internet wtf.
Title: Re: Problem plugin - Random
Post by: nevincho on September 04, 2018, 02:52:47 PM
Thank you for answer.

Plugin works, but whatever value I want to set 60, 600, 6000, 9999 changes the names always for about 10-12 sec.

It would be good to be at least about 1 minute for the video snap to show
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 04, 2018, 03:14:01 PM
Is it because m_last_rand = 0 on class instance and then your tick function is triggered at >10000?
Title: Re: Problem plugin - Random
Post by: nevincho on September 04, 2018, 04:19:15 PM
class Random
{
   m_config = null;

   m_last_rand = 0;
   m_rand_ms = 0;

   constructor() {
      m_config = fe.get_config();

      m_rand_ms = 1000 * m_config["rand_s"].tointeger();

      if (!fe.nv.rawin( "Random" ))
         fe.nv.rawset( "Random", false);

      fe.add_ticks_callback( this, "on_tick" );
      fe.add_transition_callback( this, "on_transition" );
   }

   function on_tick( ttime )
   {
      if ( ttime - m_last_rand > 10000 )
      {
         local roll = 1.0 * rand() / RAND_MAX;
         roll = ( roll * fe.displays.len() );
         fe.set_display( roll );

         m_last_rand = ttime;
         fe.nv[ "Random" ] = true;
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 06, 2018, 06:32:46 PM
Turns out my internet wasn’t shut off. Having intermittent isp issues I will resolve later.

Anyways, your code has me a little confused and seems complicated. I created a very small and simple plugin for this feature. It works 100%. Hopefully it has the features you are looking for, and can include it if it does not. Need to get some sleep. Will create docs and push to GitHub tomorrow.
Title: Re: Problem plugin - Random
Post by: jedione on September 06, 2018, 08:10:08 PM
silently waiting ,   thanks...
Title: Re: Problem plugin - Random
Post by: nevincho on September 06, 2018, 09:03:53 PM
Thanks for your time.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 07, 2018, 05:29:25 PM
https://github.com/keilmillerjr/sequencer-plugin

Will add the option of selecting random display as well, but will likely be for another night. Since set_display reloads module/plugin/layout, I understand the need for writing a variable to nv table.
Title: Re: Problem plugin - Random
Post by: jedione on September 07, 2018, 06:19:38 PM
works, great.... :) 

after "time" blinks to new game.

Question..not shere if you have seen this, but i have a great FE pak called "Forgoton worlds"

and it is "retrofe" theme   and is has this feature ,but instead of blinking to new game
it will scroll through the weal or list to the random game looks so cool instead of blinking to new game

Q: is there any way you could make that happen.....?  it is just eye candy but dam it works
thanks alot

if you need i could upload a vid of it for you t see..but i think you know what i mean.......
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 07, 2018, 06:34:02 PM
@jedione I think I know what you are talking about. It’s possible. Send me a video just to be sure.
Title: Re: Problem plugin - Random
Post by: jedione on September 07, 2018, 08:52:46 PM
ok here it is...  showing two or three cycles of the game list by it's self
after not scrolling..

to me this embodies the word "attract mode" when put on a arcade cabinet. 

i think this would be the game changer for AM.

preview =
https://youtu.be/vGXdz2JjWfs (https://youtu.be/vGXdz2JjWfs)


note:  this is what got me in to AM 4 years ago..IE:  i would walk out to get some milk say
2 to 3 in the morning.   and see AM on my arcade cabnet in my living room.
and it was going crazy with..all the difrint games that were of coruse the,, screen saver..
i could not go back to bed... i had to play...... :-* a new game i never saw

Title: Re: Problem plugin - Random
Post by: nevincho on September 07, 2018, 09:32:53 PM
Perfect work, thanks again.
Title: Re: Problem plugin - Random
Post by: calle81 on September 08, 2018, 10:09:24 AM
This is awesome. Thanks!
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 09, 2018, 02:58:55 PM
ok here it is...  showing two or three cycles of the game list by it's self
after not scrolling..

to me this embodies the word "attract mode" when put on a arcade cabinet. 

i think this would be the game changer for AM.

preview =
https://youtu.be/vGXdz2JjWfs (https://youtu.be/vGXdz2JjWfs)


note:  this is what got me in to AM 4 years ago..IE:  i would walk out to get some milk say
2 to 3 in the morning.   and see AM on my arcade cabnet in my living room.
and it was going crazy with..all the difrint games that were of coruse the,, screen saver..
i could not go back to bed... i had to play...... :-* a new game i never saw


It works similar as the first release - waiting for a period of time after the last signal before activating. Plugin then chooses a target for a random game, and sends a next_game signal until the target is reached.

FadeArt will not update until the current playing video is complete, I think.?

https://youtu.be/d5QUhjdtYPs
Title: Re: Problem plugin - Random
Post by: nevincho on September 09, 2018, 09:35:06 PM
Is it possible except by random, to change the list in ascending order: 1,2,3 and so on?
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 10, 2018, 03:54:12 PM
Is it possible except by random, to change the list in ascending order: 1,2,3 and so on?

I am not sure why you would want this. Anyways, fork it on GitHub now before I do an update, and change plugin.nut line 51 to the following:
Code: [Select]
if (ttime >= signalTime + delayTime) fe.filters.reverse_order = true;
Title: Re: Problem plugin - Random
Post by: jedione on September 10, 2018, 06:05:30 PM
thanks for making the rev-2 cant wait till you release it thanks..

did not know you were in to firewood, cool.
Title: Re: Problem plugin - Random
Post by: nevincho on September 10, 2018, 10:02:43 PM
Is it possible except by random, to change the list in ascending order: 1,2,3 and so on?

I am not sure why you would want this. Anyways, fork it on GitHub now before I do an update, and change plugin.nut line 51 to the following:
Code: [Select]
if (ttime >= signalTime + delayTime) fe.filters.reverse_order = true;

Thanks again for your time. I tried and changed the code to line 51 but it does not work
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 11, 2018, 02:15:23 AM
Is it possible except by random, to change the list in ascending order: 1,2,3 and so on?

I am not sure why you would want this. Anyways, fork it on GitHub now before I do an update, and change plugin.nut line 51 to the following:
Code: [Select]
if (ttime >= signalTime + delayTime) fe.filters.reverse_order = true;
Thanks again for your time. I tried and changed the code to line 51 but it does not work

I rechecked the docs. I guess I looked at it too quickly.

Quote
reverse_order - [bool] Will be equal to true if the list order has been reversed.

You need to test reverse_order and switch its boolean value.

Try:

Code: [Select]
if (ttime >= signalTime + delayTime)
  fe.filters.reverse_order ? fe.filters.reverse_order = false : fe.filters.reverse_order = true;
Title: Re: Problem plugin - Random
Post by: keilmillerjr on September 11, 2018, 02:19:20 AM
thanks for making the rev-2 cant wait till you release it thanks..

did not know you were in to firewood, cool.

My father owns a logging company. I just changed careers last week to CNC electro-mechanical technician.

I changed the logic on the signal variable. I think it works correctly now. Give the experimental a try again with latest commit? It compares the distance between index and target, and the list size minus the distance between index and targe, and then selects appropriate direction based on index and target size comparison.
Title: Re: Problem plugin - Random
Post by: nevincho on September 11, 2018, 03:34:17 AM
Is it possible except by random, to change the list in ascending order: 1,2,3 and so on?

I am not sure why you would want this. Anyways, fork it on GitHub now before I do an update, and change plugin.nut line 51 to the following:
Code: [Select]
if (ttime >= signalTime + delayTime) fe.filters.reverse_order = true;
Thanks again for your time. I tried and changed the code to line 51 but it does not work

I rechecked the docs. I guess I looked at it too quickly.

Quote
reverse_order - [bool] Will be equal to true if the list order has been reversed.

You need to test reverse_order and switch its boolean value.

Try:

Code: [Select]
if (ttime >= signalTime + delayTime)
  fe.filters.reverse_order ? fe.filters.reverse_order = false : fe.filters.reverse_order = true;

I tested it with АМ 2.3.0/2.4.0 and it did not work again. No matter how interesting it may be. Thank you again for your attention. It's not important that if one day you have time a look at it. It would be a nice plugin to have two options for alternating games.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 09, 2018, 07:24:27 PM
Updated the experimental branch for sequencer plugin. Sorry it took so long. I just spent two hours with it. I added the ability to jump ahead indexes. It makes the action quicker. Anyone can try it and provide input or fork/pull request. Still hung up on why fe.signal on every consecutive tick does not produce the same result as navigation button press. My frame rate gets low too.
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 11, 2018, 04:29:23 AM
Is there any way to auto pause the script while you’re playing a game? Feels a bit weird to exit a game and have another game selected. (I haven’t tried the experimental version yet, so apologies if it was already added to that).

Amazing work, thank you for making this.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 11, 2018, 08:41:50 AM
Is there any way to auto pause the script while you’re playing a game? Feels a bit weird to exit a game and have another game selected. (I haven’t tried the experimental version yet, so apologies if it was already added to that).

Amazing work, thank you for making this.

No, but I can add that feature. I forgot that the front end doesn’t really pause when focus is taken away. Perhaps this weekend I can work on it.
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 11, 2018, 03:53:55 PM
Is there any way to auto pause the script while you’re playing a game? Feels a bit weird to exit a game and have another game selected. (I haven’t tried the experimental version yet, so apologies if it was already added to that).

Amazing work, thank you for making this.

No, but I can add that feature. I forgot that the front end doesn’t really pause when focus is taken away. Perhaps this weekend I can work on it.

That would be fantastic. I really appreciate your work.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 14, 2018, 07:07:27 PM
Is there any way to auto pause the script while you’re playing a game? Feels a bit weird to exit a game and have another game selected. (I haven’t tried the experimental version yet, so apologies if it was already added to that).

Amazing work, thank you for making this.

No, but I can add that feature. I forgot that the front end doesn’t really pause when focus is taken away. Perhaps this weekend I can work on it.

That would be fantastic. I really appreciate your work.

I did some work to the master branch. Totally revised. I am very pleased with the outcome.



I think I’m at end with the experimental branch unless some one can provide some insight for an approach. Master branch is pretty good in my eyes, and would like feedback as to how well it’s interaction with other themes is.
Title: Re: Problem plugin - Random
Post by: calle81 on October 15, 2018, 11:02:03 AM
I just tried the updated plugin from the master branch and it works perfectly.  Thank you! :)
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 15, 2018, 11:32:10 PM
The updates sound awesome. I’m out of town for a couple days so won’t be able to try it out till I get back, but looking forward to it.
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 17, 2018, 10:09:23 PM
OK finally had a chance to test and the new commit doesn't work at all for me for some reason. Tried with several different layouts with no luck.

Reverted to the commit from Sep 7th and it works fine.

Any idea why?

thanks again.
Title: Re: Problem plugin - Random
Post by: nevincho on October 18, 2018, 12:48:30 AM
OK finally had a chance to test and the new commit doesn't work at all for me for some reason. Tried with several different layouts with no luck.

Reverted to the commit from Sep & and it works fine.

Any idea why?

thanks again.


It dosen't work for me either.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 18, 2018, 02:31:16 AM
@jeffy777 @nevincho It works on my iMac just fine. Besides my own layouts, I also tested with cools and arcade flow. ArcadeFlow doesn’t display artwork on my iMac for some reason, but theme navigated with sequencer fine.

Could you guys let me know what themes you are trying? Possibly disable all other plugins and reenable them one by one if it works? Thank you.

https://youtu.be/G87dRISh_mU
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 18, 2018, 11:17:38 AM
I’m using the Silky theme:
http://forum.attractmode.org/index.php?topic=1517.0

I also tried it with OldRoom. and a few random others.

I disabled all other plugins, still no luck.
Title: Re: Problem plugin - Random
Post by: nevincho on October 18, 2018, 11:37:41 AM
I try with Attract-Man, Basic, Pandora Box 3,4,5, Extreme Box, Blue Ring, Robospin .... not work.

AM versions 2.3.0-2.4.0
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 18, 2018, 08:18:35 PM
@jeffy777 @nevincho I tried every default layout, and they all work. Orbit has an issue where the static effect does not disappear I think because on Transition.ToNewList ttime < spin_ms and spin_ms is 120. This plugin makes it happen on a single tick.

Are you guys using the latest helpers module? Do you have any errors in the terminal?
Title: Re: Problem plugin - Random
Post by: jeffy777 on October 18, 2018, 09:56:18 PM
I did not have the helpers module isntalled at all and that seems to have been the issue. Works perfectly with the Silky theme now. Nice job man!
Title: Re: Problem plugin - Random
Post by: nevincho on October 18, 2018, 10:38:21 PM
Script Error
Title: Re: Problem plugin - Random
Post by: keilmillerjr on October 19, 2018, 02:04:13 AM
@nevincho you need the helpers module. I’m so sorry. I totally forgot to update the readme! It wasn’t required on my first commit, and then was when it became more complex. Will update after work today.
Title: Re: Problem plugin - Random
Post by: nevincho on October 19, 2018, 03:06:33 AM
Perfect :) Thank you again for your work.
Title: Re: Problem plugin - Random
Post by: Malmanian on November 07, 2018, 02:53:32 AM
Greetings and many thanks to Mr. keilmillerjr for this very useful sequencer plug-in. This functionality should indeed be built in with AM.

I wonder if it is possible for this plug-in to detect when the snap-video is finished and start the sequencer when the video is finished instead of a manual timer? (similar to HyperSpin "wait for video" option before Attract wheel-scrolling starts).

Keep up the good work and best regards.

/Edit: Report of some minor issues:

* sequencer plug-in interrupts the built-in AM screensaver functionality. (it would be great to pause the sequencer while screensaver is active). It is a non-issue for me since I just disable the AM screensaver and use this sequencer plug-in instead as a live attract-mode screensaver.

* sequencer plug-in timer starts counting even while a intro video is playing during the start of AM. (this can only be an issue for those that are using longer intro videos.)

Title: Re: Problem plugin - Random
Post by: keilmillerjr on November 08, 2018, 03:13:31 AM
Greetings and many thanks to Mr. keilmillerjr for this very useful sequencer plug-in. This functionality should indeed be built in with AM.

I wonder if it is possible for this plug-in to detect when the snap-video is finished and start the sequencer when the video is finished instead of a manual timer? (similar to HyperSpin "wait for video" option before Attract wheel-scrolling starts).

Keep up the good work and best regards.

/Edit: Report of some minor issues:

* sequencer plug-in interrupts the built-in AM screensaver functionality. (it would be great to pause the sequencer while screensaver is active). It is a non-issue for me since I just disable the AM screensaver and use this sequencer plug-in instead as a live attract-mode screensaver.

* sequencer plug-in timer starts counting even while a intro video is playing during the start of AM. (this can only be an issue for those that are using longer intro videos.)

Thank you for the awesome feedback and bug reporting.

I can easily tackle the bugs when I get some free time.

I’m not sure if your requested feature is possible as a plugin. I’ll investigate. The issue will be calling a variable from a layout. I think they are “sandboxed”. If so, it would have to utilize a module to set a global variable and hopefully plugin would read it after layout. I’ve been trying to keep this a plugin. I could replicate how hyperspin does it 100%, but it would have to be integrated into each theme and not an easy global thing.
Title: Re: Problem plugin - Random
Post by: Malmanian on November 08, 2018, 11:51:09 AM
Thank you for the awesome feedback and bug reporting.

I can easily tackle the bugs when I get some free time.

I’m not sure if your requested feature is possible as a plugin. I’ll investigate. The issue will be calling a variable from a layout. I think they are “sandboxed”. If so, it would have to utilize a module to set a global variable and hopefully plugin would read it after layout. I’ve been trying to keep this a plugin. I could replicate how hyperspin does it 100%, but it would have to be integrated into each theme and not an easy global thing.


Greetings and thanks for investigating this. I didn't know that the variables from layouts were sandboxed in AM, I was assuming that plug-ins could perhaps read the "video_duration" and "video_time" properties directly from the active layout when needed. Hopefully this might be possible with your 'helpers' module without the need to manually modify all layouts until AM perhaps officially supports this functionality. Keep up the good work and best regards.
Title: Re: Problem plugin - Random
Post by: keilmillerjr on December 02, 2018, 02:52:55 PM
Pushed small update. Plugin should wait for intro to finish before activating plugin. Please test and report back if it doesn’t work. I didn’t actually test it.

As is, screensaver will never become active unless screensaver time is less than sequencers delay time (which would be pointless). One option is to not use a screensaver. Harsh, I know. Second option, differentiate between signals from the plugin and actual user plugins. I could then keep track of time the user was away and activate the screensaver manually a signal that you preset in the config to activate the screensaver. Plugin would have to disable when the screensaver is active, and enable when returning. Thoughts?
Title: Re: Problem plugin - Random
Post by: Malmanian on December 06, 2018, 10:07:53 AM
Pushed small update. Plugin should wait for intro to finish before activating plugin. Please test and report back if it doesn’t work. I didn’t actually test it.

As is, screensaver will never become active unless screensaver time is less than sequencers delay time (which would be pointless). One option is to not use a screensaver. Harsh, I know. Second option, differentiate between signals from the plugin and actual user plugins. I could then keep track of time the user was away and activate the screensaver manually a signal that you preset in the config to activate the screensaver. Plugin would have to disable when the screensaver is active, and enable when returning. Thoughts?

Thanks for the update, the sequencer plugin now waits correctly for the intro-video as long as the delay time set in the sequencer settings is not shorter than the intro-video length itself (for example if you set sequencer delay time to 5sec and the intro-video length is 10sec then it will still interrupt the intro-video at 5sec and jump into AM). This is really a non-issue since most of us use ~30sec as sequencer delay time (the normal video length of EmuMovies) and usually don't use long intro-videos (but I know some people love those super long intro videos in their arcade cabinets). Mine is just around 10 sec.

I just wish that AM would have a function that would ignore keyboard/joystick key inputs during the intro-video as an optional option. I use AHK script for that as a workaround until I learn how to do it via the intro.nut file correctly.

PS. This great plug-in has completely removed the need for a screensaver for me, and it works much better as a "Attract-Mode" attention grabber in an Arcade cabinet than the built in AM screensavers.

Keep up the good work and best regards.

/Edit, forgot to quote the post I was replying to
Title: Re: Problem plugin - Random
Post by: keilmillerjr on December 09, 2018, 01:17:11 AM
Pushed small update. Plugin should wait for intro to finish before activating plugin. Please test and report back if it doesn’t work. I didn’t actually test it.

As is, screensaver will never become active unless screensaver time is less than sequencers delay time (which would be pointless). One option is to not use a screensaver. Harsh, I know. Second option, differentiate between signals from the plugin and actual user plugins. I could then keep track of time the user was away and activate the screensaver manually a signal that you preset in the config to activate the screensaver. Plugin would have to disable when the screensaver is active, and enable when returning. Thoughts?

Thanks for the update, the sequencer plugin now waits correctly for the intro-video as long as the delay time set in the sequencer settings is not shorter than the intro-video length itself (for example if you set sequencer delay time to 5sec and the intro-video length is 10sec then it will still interrupt the intro-video at 5sec and jump into AM). This is really a non-issue since most of us use ~30sec as sequencer delay time (the normal video length of EmuMovies) and usually don't use long intro-videos (but I know some people love those super long intro videos in their arcade cabinets). Mine is just around 10 sec.

I just wish that AM would have a function that would ignore keyboard/joystick key inputs during the intro-video as an optional option. I use AHK script for that as a workaround until I learn how to do it via the intro.nut file correctly.

PS. This great plug-in has completely removed the need for a screensaver for me, and it works much better as a "Attract-Mode" attention grabber in an Arcade cabinet than the built in AM screensavers.

Keep up the good work and best regards.

/Edit, forgot to quote the post I was replying to

Thank you for trying it out and your detailed review! Resolved the issue with the intro. Sorry about that. Fully tested now. Pushed update to GitHub.

I can disable signals when the intro is active, but this would best be handled by the intro script because the plugin would not know the length of the video object and it would be stuck on a never ending loop. You would have to add a signal handler and return true unless video is done playing.
Title: Re: Problem plugin - Random
Post by: tommiegunz on March 03, 2022, 12:16:46 PM
hey guys do these plugins still work with updated AM versions i can't seem to get these working at all
Title: Re: Problem plugin - Random
Post by: jclampy69 on March 18, 2022, 09:16:01 AM
Well, I tried the plugin with the latest AM. All you need to do is make sure you also have the 'helpers' module installed as stated in the readme.

I noticed one weird thing though. After a few cycles the displayed 'snap video' will randomly become either an index offset -1 or +1 from what it is suppose to be.
Boxart, Cartart, Logo, and all metadata, overview, etc remain correct. Only the video is having the problem.

Otherwise, this would be a perfect plugin for my needs.

EDIT:
Trying this plugin again with a new layout I am creating. I only have videosnap and wheel setup at moment and I let this sequencer plugin run for about 3 minutes on a 5 second interval. Everything worked perfectly. Cheers.
Title: Re: Problem plugin - Random
Post by: MagNeatoh on March 05, 2023, 05:58:14 PM
Tried this plugin with a couple different emulator lists and themes and I always get the same result.


The plugin is useful as a screensaver, but not much more in this state. Anyone else have this experience?

Using Attract-Mode 2.6.2