Author Topic: Problem plugin - Random  (Read 1804 times)

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Problem plugin - Random
« 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 ...

AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #1 on: August 30, 2018, 03:48:38 AM »
Any one?
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #2 on: September 04, 2018, 08:05:21 AM »
WTF?! Really no one can help me?
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

keilmillerjr

  • Hero Member
  • *****
  • Posts: 638
    • View Profile
Re: Problem plugin - Random
« Reply #3 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.
« Last Edit: September 04, 2018, 03:06:54 PM by keilmillerjr »

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #4 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
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

keilmillerjr

  • Hero Member
  • *****
  • Posts: 638
    • View Profile
Re: Problem plugin - Random
« Reply #5 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?

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #6 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;
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

keilmillerjr

  • Hero Member
  • *****
  • Posts: 638
    • View Profile
Re: Problem plugin - Random
« Reply #7 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.

jedione

  • Hero Member
  • *****
  • Posts: 565
  • punktoe
    • View Profile
Re: Problem plugin - Random
« Reply #8 on: September 06, 2018, 08:10:08 PM »
silently waiting ,   thanks...
help a friend....

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #9 on: September 06, 2018, 09:03:53 PM »
Thanks for your time.
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)

keilmillerjr

  • Hero Member
  • *****
  • Posts: 638
    • View Profile
Re: Problem plugin - Random
« Reply #10 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.

jedione

  • Hero Member
  • *****
  • Posts: 565
  • punktoe
    • View Profile
Re: Problem plugin - Random
« Reply #11 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.......
« Last Edit: September 07, 2018, 06:21:18 PM by jedione »
help a friend....

keilmillerjr

  • Hero Member
  • *****
  • Posts: 638
    • View Profile
Re: Problem plugin - Random
« Reply #12 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.

jedione

  • Hero Member
  • *****
  • Posts: 565
  • punktoe
    • View Profile
Re: Problem plugin - Random
« Reply #13 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


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

« Last Edit: September 07, 2018, 09:01:06 PM by jedione »
help a friend....

nevincho

  • Full Member
  • ***
  • Posts: 90
    • View Profile
Re: Problem plugin - Random
« Reply #14 on: September 07, 2018, 09:32:53 PM »
Perfect work, thanks again.
AM Version : 2.1.0/2.3.0
Input :  Mouse; Keyboard; USB Joystick, Arcade controls
Cabinet 1 : Groovy Arcade/AM 2.2.1
Cabinet 2 : Windows 7/ AM 2.4.0
Cabinet 3 : Pandora Box 4
OS : Groovy Arcade 2016/Windows 7/ Linux
Emulators : mame, mupen64plus, PSX (mednafen)