UPDATED 07-07-11
There were multiple stickies created over the course of time while the standardization was taking place, and ideas being discussed. This has all been implemented now. I have put all information into this one sticky. This helps clean up the forums, and puts all the information in one place.
There is example source code in the "C:\Program Files\RideRunner\RRExtension Plugin Examples". There are examples for VB6, .net and C# to get you started on creating a plugin for RideRunner.
Ride Runner now will automatically load any plugins that are located in the "../Ride Runner/Plugins/" folder. This means that you no longer need the X,PluginName in your menu skins, or in an include file. So to use a plugin, simply copy the files into the Plugins folder, and ensure that the Dll(s) are registered. This also means that you do not have to set up individual skins to use plugins, as they are all loaded and available to any skin when RR starts.
When creating a plugin, the following guidelines need to be followed:
- No plugin should use hard coded paths IN ANY WAY! to where it is located (For reading and writing to custom .ini's for instance) Many paths are available as variables that you can use in your plugins (PLUGINSPATH, RRPATH, SKINPATH) Say your plugin has a settings file named "MyPlugin.ini" to access the path, it's DYNAMIC path would be $RRPLUGINS$MyPlugin\MyPlugin.ini for reading and writing to it from your plugin.
- A set of example skin files needs to be provided, preferably in either BMV2 or Carwings in the release thread (bmv2 PSD's are available in MP3car downloads section, Carwings PSD's are available in the Carwings thread)
- Plugins should be put together as an installer.exe. This will copy the files to the correct locations, as well as register the .dll's automatically for the end user. The installer also needs to be aware of UAC rules. (Not saving to "Program Files" but rather "My Documents" folder.
- All plugin labels, buttons, sliders and indicators should be prefixed with the plugin name (to avoid conflicting with other plugins EA: MyPluginLabel1)
- A text file containing a list of button, labels, indicator a slider codes should be included in the zip file (call it skincommands.txt)
- An indicator is not needed in your plugin for the plugin itself to be able to tell if it is loaded or not, that is handled by RideRunner now when the plugins load.
(This section was written by Mitch)
CHANGES TO EXISTING PLUGINS WILL NEED TO BE MADE
GUINO has fixed the Indicator code for plugins, to do that a change had to be made in the main code to allow a non processed Indicator...
The solution was adding of the ReturnIndicatorEx which depreciates ReturnIndicator
change your code to the default return of "" instead of "False" in all of your plugins.
Example:
Code:
Public Function ReturnIndicator(IND As String) As String
'Default (No Action)
'ONLY return "True" or "False" IF AND ONLY IF you process that code
'else return ""
ReturnIndicator = ""
Select Case LCase(IND)
Case "myindicator"
ReturnIndicatorEx = "True"
End Select
End Function
also... TO MOVE FORWARD change ReturnIndicator to ReturnIndicatorEx
ReturnIndicatorEx:
Code:
'*****************************************************************
'* This Function will be called with requested indicator code
'* specified at the skin file. Simply return "True" or "False" to
'* displayed the respective ON or OFF layer of the skin images.
'* alternatively you can specify a path to a file to be displayed
'* as the indicator specified. Return "False" to erase the image.
'* ONLY return something else IF AND ONLY IF you process that code
'*****************************************************************
Public Function ReturnIndicatorEx(IND As String) As String
'Default (No Action)
' DO NOT RETURN "False" for unprocess indicators, return ""
ReturnIndicatorEx = ""
Select Case LCase(IND)
Case "myindicator"
'This example show ON for even seconds and OFF otherwise
ReturnIndicatorEx = IIf(Val(Format(Time, "SS")) Mod 2 = 0, "C:\VBStuff\Road Runner\XMArt\1.gif", "False")
'Specify whatever and whichever indicators you wish to create
'You can add as many as you'd like, and you can process complex indicators as long
'as you parse them yourself (i.e. "mycomplexindicator;parameter")
'Case "myindicator2"
'Insert Code here to return "True", "False" or Path name
End Select
End Function
.
Bookmarks