1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Download Package Now!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

Tutorial How to write an Axis Assignments (Math) Plugin for SimTools 2.0 - API documentation

Discussion in 'Tutorials and Tips by the Developer' started by yobuddy, Mar 9, 2016.

  1. SeatTime

    SeatTime Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    2,367
    Location:
    Newcastle Australia
    Balance:
    27,136Coins
    Ratings:
    +2,668 / 32 / -0
    My Motion Simulator:
    DC motor, Motion platform, 6DOF
    Just another question.- will you still be able to use the standard filters as normal when this plug-in is loaded? Not a big deal if you cannot - I will just add what I want into the math :).
  2. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,683
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    30,192Coins
    Ratings:
    +3,727 / 10 / -0
    There is no filtering in the example, things start to get a bit messier when you start adding all of that stuff too.
    I needed a place to help get people started, I didn't want to loose them out of the gate.
    take care,
    yobuddy
  3. SeatTime

    SeatTime Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    2,367
    Location:
    Newcastle Australia
    Balance:
    27,136Coins
    Ratings:
    +2,668 / 32 / -0
    My Motion Simulator:
    DC motor, Motion platform, 6DOF
    Understand - I don't use allot of filtering nowadays anyway. There is already plenty of scope there to meet my needs.
  4. Z FOX

    Z FOX New Member

    Joined:
    May 8, 2018
    Messages:
    6
    Location:
    USA
    Balance:
    77Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    @yobuddy Thanks for posting this! This looks great.

    I created my plugin and the PluginValidator says it's a valid plugin. Now do I send those files created from the build into zipped folder before dropping into the "SimTools PluginUpdator"? It won't let me drop there so maybe it's the wrong spot?

    I'll keep looking around.
  5. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,683
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    30,192Coins
    Ratings:
    +3,727 / 10 / -0
    You can drop it in the SimTools PluginUpdater either zipped, or just as it is. (as a .dll file)
    I just testing it and it seems to work.
    Once installed it will be a axis type option for the axis assignments.

    I would check that the naming convention is correct if your having problems buddy.
    take care,
    yobuddy
    • Informative Informative x 1
  6. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    159
    Balance:
    1,146Coins
    Ratings:
    +48 / 0 / -0
    My Motion Simulator:
    2DOF
    Im trying to figure out how i can stop my Gseat sway to do anything below 0 without using clipping and this seems like the most likely place to go for setting up an axis control for + and one for - Would that work at all or do i just limit it so its not allowed below 0 somewhere?

    Another thing. I see you keep referring to the example plugin for better understanding but there's nothing actually in the files other than

    Code:
        '///////////////////////////////////////////////////////////////////////////////
        '///                     Edit these 5 Subroutines Below                      ///
        '///////////////////////////////////////////////////////////////////////////////
        'Used by GameEngine when the plugin gets loaded.
        Public Sub StartUp()
            'When the Plugin gets Loaded
        End Sub
        'Used by GameEngine when the plugin gets un-loaded.
        Public Sub ShutDown() Implements IPlugin_AxisAssignments.ShutDown
            'When the Plugin gets Un-Loaded
            Output_Calculations_Running = False
        End Sub
        ''Used by GameEngine when a Game Starts
        Public Sub GameStart()
            'Game Started, Start your engine here.
            StartupSelected()
        End Sub
        'Used by GameEngine when the Game Stops
        Public Sub GameStop()
            'Game Ended, Stop your engine here.
            Output_Calculations_Running = False
        End Sub
        'Reset any need vars here - gets called after 'GameStop()'
        Private Sub ResetValues()
            'Reset anything else needed here.
        End Sub
    
  7. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,683
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    30,192Coins
    Ratings:
    +3,727 / 10 / -0
    @Trigen
    There is allot more that that in the example plugin buddy.
    Check out the "PLACE EXTRA NEEDED CODE/FUNCTIONS HERE " section of the plugin.
    There is a GUI there also.

    the easiest way would be to edit the Min/Max for the game you are playing.
    Let's say you talking about Surge, if you don't want the Gseat to do anything with negative surge, set Surges min value to 0 and it will turned off in that direction.

    Take care man!
    yobuddy
  8. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    159
    Balance:
    1,146Coins
    Ratings:
    +48 / 0 / -0
    My Motion Simulator:
    2DOF
    Thanks! Been a bit tired today so i completely missed those expand boxes

    Fantastic! Just what i need!
  9. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,683
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    30,192Coins
    Ratings:
    +3,727 / 10 / -0
    @Trigen,
    Make sure you are running v2.4 buddy.
    Take care,
    Dustin
  10. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    159
    Balance:
    1,146Coins
    Ratings:
    +48 / 0 / -0
    My Motion Simulator:
    2DOF
    Ive been playing with the api for a bit and i cant for the life of me get this to work.

    I want to have a button that makes the flap react to either negative or positive numbers but not pass 0. Ive confirmed the button works with "Axis1_Value1_Out = Axis1_Value1_Out * -1" and that my if statement works but if i put the if statement into the checkbox True/False nothing happens. How would i write this. Guessing there's a clever way

    Dont forget im an idiot :p examples are great!

    I suppose everything is hard when you dont have a clue but i solved it like this (not working quite right yet) . Perhaps it can be optimized?

    Code:
    If ._Axis1_roll_flip = False And Axis1_Value1_Out < 0 Then
                                Axis1_Value1_Out = Axis1_Value1_Out * 0
                            End If
                            If ._Axis1_roll_flip = True And Axis1_Value1_Out > 0 Then
                                Axis1_Value1_Out = Axis1_Value1_Out * 0
                            End If
     
    
    Last edited: Aug 31, 2019
  11. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    159
    Balance:
    1,146Coins
    Ratings:
    +48 / 0 / -0
    My Motion Simulator:
    2DOF
    I have one more question

    In the example plugin you get 3 dofs where you can select the force you want. I see its a string and you have cases with the name. Im wondering how i can just write this in my code without using any selection boxes. Ill add a on off checkbox for combined forces later but i suppose knowing one will let me know the other.

    I tried
    Code:
    _AxisAssignments._Axis1DOF1 = "heave" 
    and i looked at startup but i dont understand how it knows how many dofs to start. Is it just to add another Or FORCE then

    Where do i write it
    How do i set the % ill be using a box for that.

    I will have to turn these on too

    Pointers would be great!
    Last edited: Aug 31, 2019
  12. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,683
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    30,192Coins
    Ratings:
    +3,727 / 10 / -0
    I'll post the gseat plugin code when we get it done buddy.
    Then you can look over it and see how we did it!
    Take care,
    yobuddy
    • Useful Useful x 1
  13. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    159
    Balance:
    1,146Coins
    Ratings:
    +48 / 0 / -0
    My Motion Simulator:
    2DOF
    Cheers! It will be well worth the wait