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.