Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - wrybread

Pages: [1] 2 3 4
1
Scripting / Re: Possible to execute some command when an emulator closes?
« on: September 27, 2018, 12:56:29 PM »
I couldn't figure out a way to have Attract execute a command when a specific emulator closes so I just added some extra lines to my close action to tidy things up.

On a side note, using Python as a scripting language for Attract Mode emulators works great! And if you're looking to get more experience with Python, it's a fun project for it. I don't check this forum that often and I think email notification isn't working, but if you're having trouble with Python and Attract feel free to email me, my username at gmail.

2
Scripting / Re: Possible to execute some command when an emulator closes?
« on: September 26, 2018, 10:55:58 PM »
I'm on Linux. My "emulator" is a Python script that launches a few processes, and I'm trying to kill off the sub-processes.

I could do something like have a watcher script that kills the sub processes if the main process no longer exists, but I'm hoping to be a bit more tidy than that.

3
Scripting / Possible to execute some command when an emulator closes?
« on: September 26, 2018, 08:04:32 PM »
I'm wondering if I can run some script when an emulator closes? In other words, if I start GameA from a Layout using EmulatorX, can a script run automatically when GameA exits?

I need to clean up a couple of extra windows that I'm running with my emulator, and trying to figure out a method.

4
There might be an easier way, but here's how I do it:

Step 1) Make an Attract Mode plugin

Save this as "CustomCommand.nut" or whatever, in Attract Mode's /plugins folder:

Code: [Select]
local cmd = "$HOME/.attract/screensaver/mame_screensaver.py";

fe.add_signal_handler( "custom_signal" )
function custom_signal( signal )
{
if ( signal == "custom5" ) // HARD CODED TO CUSTOM5!
{
print ("Running my script!!!!");
system( cmd );
}
}

Edit the "cmd" above to the path for your script. Also edit the "custom5" for whatever command you're using in Step 3 below.

Step 2) Enable the plugin

In Attract Mode, go to Plugins and find your newly created plugin (called "CustomCommand" in the example above) and enable it.

Step 3) Map a button to it

In Attract Mode, go to Controls and scroll down to the "custom" controls and click it to set whatever button you want to run it. In the example above you'd scroll down to Custom5 and then associate whatever button with it.

Now pressing that button should execute that AM plugin, which will launch your script.




5
General / Re: How to install Attract-mode in Ubuntu 18.04 lts?
« on: May 01, 2018, 07:06:37 PM »
It's been awhile, but I think I installed it using good ol apt-get.

sudo apt-get install attract1

That installed version 2.2 which, looking at the Attract Mode homepage, isn't the latest version (2.3 is). But the .deb available on the site is 2.2 also, so maybe 2.3 isn't available for Linux yet.

Anyway, version 2.2 is working beautifully on both Lubuntu machines I have it installed on.

One thing to note is that it installs to a hidden folder for some reason (~/.attract).

Feel free to post if you have any issues or questions.


6
Well with a whole lot of duct tape I got everything working. My cabinet swaps to a random game every 5 minutes if no one is playing it, which has officially gotten us out of our rut of playing the same few games over and over. And it makes our MAME cabinet a lot more interesting in general, since every time I walk past there's some new oddball artifact of the 80s or 90s playing on it. If you don't mind a heinous pun, it's a game changer (oof, sorry about that).

It would be so nice if this was natively possible in Attract Mode! Unfortunately I don't where to start for adding the functionality there though. If any AM devs are interested, I'm glad to help however I can though.


An outline of how I got it working:

- I made an Attract Mode screensaver.nut that simply launches my Python script after X minutes of inactivity

- my Python script then launches a new game after every 5 minutes (configurable) of inactivity, and is smart enough to reset it's inactivity counter even during game play (something that Attract Mode currently can't do, as far as I can tell). So it keeps launching random games whenever no one is using the cabinet. And someone can start playing that game any time. But if someone presses the exit button, they're returned to Attract Mode so they can choose specific games manually.

- and the cycle repeats: Attract Mode will then relaunch my script after X minutes of inactivity.


A couple of nice features:

- the script starts either via a screensaver.nut after X minutes, or manually via a "Random" button on my cabinet (the Random button executes an AM plugin that launches the script)

- currently it picks a random ROM from the roms directory, but it could easily be adapted to choose a random entry from a specific Attract Mode romlist.

- it detects when a ROM doesn't launch properly and adds it to a list of bad ROMs that it won't use in the future. Also handy for finding and fixing bad ROMs.

- the script can run independently of Attract Mode, but it's nice to also give the user the ability to choose their own games manually, which Attract Mode does so beautifully. So the user is returned to Attract Mode when they press the Exit button on the cabinet.

- it works with my ServoStik to change the joystick between 4 and 8 way as needed



The duct tape part:

- when my Python script launches it has to kill Attract Mode, or AM will keep responding to keystokes in the background. That's a big issue since for example when exiting a game from my script AM will simultaneously launch a game, which is a pretty big conflict. Solved by simply killing AM.

- when my Python script exits, it then relaunches Attract Mode, so the player can manually choose games again.


I'm glad to share it if there's interest, but I made it for Linux so I'd have to make a few mods if someone wanted to use it on Windows.

And if any Attract Mode devs have interest in implementing this natively in AM, I'd be glad to help. I think this is what would be required:

- have AM listen for keystrokes and/or joystick action while a ROM is playing. Possibly solvable by a secondary script that sends an activity notice to AM whenever there's activity (maybe by sending dummy keypresses to the AM interface?).

- or if AM was remote controllable, an external script could simply tell Attract Mode to launch new games at will. For example if I could run "attract_mode_cli mame/dkong" or maybe send a command through a webserver or a network socket, then an external script could handle the screensaver part but still play nice with AM.


7
I'll try this:

> fe.signal( "random_game" );

One problem though is that with a keystroke, when I press the "random game" key, it simply chooses a random game, highlighting it, but not entering it.

Another issue is that that will, I think, at best launch a random game after X timeout from Attract Mode, but not continue to launch games after more inactivity, since Attract Mode can't (I think) detect inactivity when in a game. In other words, it's "tick" function isn't triggered by presses when you're actually in a game.

At best this random game rotation would:

1- launch a game after X minutes of inactivity

2- continue listening for inactivity even while displaying the MAME game

3- launch another game after X minutes of inactivity

I think the fe.signal( "random_game" ) will only achieve step 1.



8
> Configure - Controls - Random Game

I don't see how I can use that to automatically choose random games after a timeout?


9
Well I made a Python script that works well and should work on every platform, but the problem is that it conflicts with Attract Mode.

My script launches ROMs directly, since I don't see a way to remote control Attract Mode. However, while playing the game Attract Mode is still listening reacting to keypresses.

The flow:

- Attract Mode is running

- timeout is reached (say, 5 minutes of no activity)

- for this example, lets say Ms. Pacman is highlighted in the Attract Mode Display

- the screensaver launches Dig Dug for example

- As I play Dig Dug, Attract Mode will still be reacting to my keystrokes.  On my system I use the same button to enter and exit a game, so when I exit out of Dig Dug in this example, Attract Mode will simultaneously launch Ms. Pacman. Not good. What *should* happen when the user presses Exit is that the user is returned to Attract Mode to select the next game manually.

It's confusing I know, so let me know if that isn't clear.

Can anyone see a way around this? A few general solutions occur to me, not that I have any idea how to achieve them:

- some way to launch the ROM through Attract Mode from an external script? I think that would be the ideal method, but I haven't figured out a way to do that. Maybe make Attract Mode listen for commands on a socket? Or make it check for the existence of a text file that it reads commands from? Maybe some clever plugin solution? Maybe via a web server?

- some way to tell Attract Mode not to listen for keypresses? (In my case joystick presses but same idea)

- maybe make Attract Mode reset it's screensaver timer even while a ROM is open? That would make it so the whole screensaver is run in Attract Mode directly.

- or?

My other problem is that if a ROM has a warning screen it will hang there, since MAME apparently ignores simulated keystrokes (so I can't just send a key after a pause to skip it if present) and there's no way to disable the warning screens (ugh). Edited: solved by recompiling with the nag screen turned off, let me know if anyone wants that build (MAME v0.175 for Ubuntu 64 bit). Could also solve that by using a list of ROMs that don't have warning screens.

And let me know if anyone would like to try my screensaver script. I'm using it on Linux but it *should* work on Windows and Mac since it just uses Python standard libraries.


10
Interestingly, this exists as a program:

http://tomspeirs.com/mamescreensaver/

Won't work for me since it's Windows only, but interesting to note.

11
Well shoot, it looks like the timer for screensaver.nut doesn't get reset when in a game, only when in Attract Mode. In other words it can't tell if someone is playing a game, only if there's activity in AM. Reasonable enough I guess, but it means that (I think) the screensaver I have in mind would need to be an external script.

12
The feature makes lots of sense to me. My cabinet sits in my living room running mostly the same few games. Sometimes I launch a game using a random hotkey, but in general it's pretty consistent and it gets a little monotonous. Would be great to inject some automated variety. I'm thinking changing the game every 10 minutes or so, after an hour of inactivity, that kind of thing. And the reason I prefer it over videos is that if the game looks interesting to someone they can simply start playing it.

AHK isn't an option for me as I'm on Linux, but good idea.

I guess I could script something using Python, but I was hoping to use Attract Mode scripting natively for various reasons, including the ability to enable and disable it directly from AM.

> You would also have to save and load states past the boot screen of each game for it to seem presentable.

Not sure what you mean by that? But I use the -autosave MAME option anyway (aka "save state"), so I *think* things should be pretty smooth. Unless it gets caught on a MAME warning screen, which I still haven't figured out how to bypass. But I guess I could either send keystrokes just in case, or recompile MAME to skip it. But this isn't really an eye candy type screensaver, so it doesn't matter if there's a rough transition here and there.

Does anyone know if there's a way to remote control AM, short of sending keystrokes? Something like "start game", and "exit game", etc?

13
I'd like to make a screensaver that cycles through games, as opposed to videos of games. And when a user presses a button, no need to exit the cycling, just stay in that game and let the user play it.

Would this be possible?

Any advice for a starting point?

Or maybe something already exists?

14
General / Re: Trackball with extended hdd
« on: March 14, 2018, 02:55:36 PM »
Cool setup! What trackball is that?

And what is that dual button thing that looks like a Simon game?

And ha on the box!

15
Scripting / Re: How to insert Emulator text story
« on: March 14, 2018, 01:07:39 PM »
Where are you getting your text stories from? Is there some archive of them out there?

Pages: [1] 2 3 4