Author Topic: Ultimarc ServoStik Plugin  (Read 691 times)

TomCoder

  • Newbie
  • *
  • Posts: 1
    • View Profile
Ultimarc ServoStik Plugin
« on: September 22, 2017, 04:57:11 PM »
A while back there was a question posted as to whether a plugin exists for the Ultimarc ServoStik.
http://forum.attractmode.org/index.php?topic=855.msg7485#msg7485
I recently installed a ServoStik and needed that very thing, so I created one.
It executes the Ultimarc ServoStik Joytray application to set the ServoStik to 4-way before the game is loaded and back to 8-way when the game is ended. Control information must be present in the romlist file. Switching to 4-way occurs when the "Control" information for the rom in the romlist is equal to "4-Way Joystick".

protocolgeorge

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Ultimarc ServoStik Plugin
« Reply #1 on: November 28, 2017, 08:34:52 PM »
Awesome idea...Thank you.  However I seem to having trouble getting the plugin to work.  I placed the .nut file in the "plugins" folder and I see it in attract mode, but I can only enable or disable it.  There does not seem be any additional configuration possible and it does not seem to work.  Any advice would be greatly appreciated.  Thanks again.

skeeboe

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Ultimarc ServoStik Plugin
« Reply #2 on: December 30, 2017, 12:28:04 PM »
I've tried everything I can think of to make this nut work.

I'm using Windows 10, and MAME and MsPacman as a test.

I've tried changing the trigger, different paths, verified the config, etc etc. I've even removed the "if" portion so it should just trigger on every game 4-way in, 8-way out. No joy.

The stick switching works when I use command prompt, or any other method. Not sure what's different between OPs implementation in AM and mine.

If anyone wants to post their fully-functional nut file, configured with their own directories etc, please do!

Arcadefan1

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: Ultimarc ServoStik Plugin
« Reply #3 on: December 31, 2017, 03:15:58 AM »
Hi skeeboe,
Here is mine. It works for my setup. I think you need to check what your "(fe.game_info( Info.Control )" actually contains in your setup. That's what I needed to change to get it working here...

I also added the option to switch it to 4-way when it's actually a 2-way stick game.
And I only set it when entering a game. When leaving a game I don't switch at all, because in my Layout it doesn't matter if it's 4-way or 8-way.


Code: [Select]
///////////////////////////////////////////////////
//
// Attract-Mode Frontend - JoyTray plugin
//
// For use with the Ultimarc ServoStik
//
///////////////////////////////////////////////////

//
// The UserConfig class identifies plugin settings that can be configured
// from Attract-Mode's configuration menu
//
class UserConfig </ help="Integration plug-in for use with the JoyTray software provided by Ultimarc: http://www.ultimarc.com" /> {

</ label="Command", help="Path to the JoyTray executable", order=1 />
command="C:/Program Files (x86)/JoyTray/JoyTray.exe";
}

local config=fe.get_config(); // get user config settings corresponding to the UserConfig class above

//
// Copy the configured values from uconfig so we can use them
// whenever the transition callback function gets called
//

fe.add_transition_callback( "joytray_plugin_transition" );

function joytray_plugin_transition( ttype, var, ttime ) {

if ( ScreenSaverActive )
return false;

switch ( ttype )
    {
case Transition.ToGame:
if (fe.game_info( Info.Control ) == "joystick (4-way),joystick (4-way)")
fe.plugin_command_bg( config["command"], "-servo joy4way" );
else if (fe.game_info( Info.Control ) == "joystick (2-way),joystick (2-way)")
fe.plugin_command_bg( config["command"], "-servo joy4way" );
else
fe.plugin_command_bg( config["command"], "-servo joy8way" );
break;

// case Transition.FromGame:
// fe.plugin_command_bg( config["command"], "-servo joy8way" );
// break;
}

return false; // must return false
}

wrybread

  • Full Member
  • ***
  • Posts: 51
    • View Profile
Re: Ultimarc ServoStik Plugin
« Reply #4 on: January 26, 2018, 06:39:57 PM »
Thanks for the above code, I was able to adapt it to make a plugin to control the Servo-Stik from Linux, notes here in case it's useful to anyone:

http://forum.attractmode.org/index.php?topic=2123.msg14494#msg14494
« Last Edit: February 13, 2018, 12:05:19 AM by wrybread »