OpenFunscripter - another scripting tool - 1.1.9 release

New release

1 Like

Okay. Too bad. But okay. But nice work for your current Software. I really like it!

Hey the curves definitely look cool. But is there any physical difference in the movement of the device between the curved lines and straight ones?

No it’s purely visual. It’s supposed to emulate what the script may look like in JoyFunPlayer with it’s “Spline” mode.

Got it! Like the new updates. Appreciate the work your doing!!

Is anybody familliar with Lua?
:thinking:

The reason I’m asking is because OFS gets scripting support :upside_down_face:.

Anybody with a little bit of programming knowledge is going to be able to extend OFS’s functionality.
I added this yesterday and it’s already such a cool addition.
I’ve added two neat scripts which serve as examples.
add_jitter_to_selection.lua does what the name says.
add_easing_to_selection.lua: adds points between points to get a less linear motion.

Here’s a screenshot for the easing before


and after.

funscript.lua contains the current API that these scripts use & depend on.
The scripts are intentionally heavily commented so that people can learn how write these scripts.
Basically in the “Special functions” window in the dropdown there’s now “Custom functions”.
Custom functions
The UI is probably not final.
By adding lua files to the script directory they’ll appear as buttons and can be executed on the currently active script.

I’m sure there are a lot of people who won’t know what to do with this.
Still I hope I won’t be the only one playing with this. :slightly_smiling_face:

1 Like

This looks like what the Spline mode. Are you saying that this adds new functionality?

If so is all I need to do is add the " add_easing_to_selection.lua" to script directory & OFS recognizes the function?

Or is there more to be done?

This isn’t part of the current 1.1.2 release.
These two scripts are going to be part of future releases.
“Spline mode” is just a visual rendering thing, the add_easing_to_selection.lua script actually adds actions to the funscript and is not just visual.

2 Likes

LUA opens the door for a whole ton of new applications - just off the top of my head, I can think of LUA that adjusts (or adds or removes) points based on the intended device. Not all devices can handle certain rates of change of position, or parse position commands in quick succession.

You can now LUA your way into, or out of, that situation for any given device.

For instance, if you have a Launch that flips out if you feed it too many commands in quick succession, AND can only move up and down so fast, a solid LaunchFixer.lua can easily ‘fix’ a downloaded script to make sure that there aren’t too many commands too quickly in succession AND raise the bottom/lower the top until the script is within the limits of what the Launch can actually manage to handle.

Yes. That’s a perfect example for functionality that I would never want to implement in C++ mainly because this is a problem with multiple solutions. By having it as a script in a directory you can just tweak it with a regular text editor.

btw the person/people behind Lua don’t like it to be written in all caps :sweat_smile:

Please do not write it as “LUA”, which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write “Lua” right!

Source

Awww, too bad. Is it a technological limitation, or just something that would be a pain to implement?

Lua support looks very cool, even if I’m not a fan of the language itself. I can imagine a lot of nice things for my particular style that could be done with this. Got a few questions though.

-Is there a function to get the next or previous point from a given time without having to iterate the script yourself?

-Is there a way to communicate data between different scripts?

-Any chance of a way to assign a hotkey to a custom function?

Well key repeats are controlled by your OS. It wouldn’t be more boring than hard to implement I would just ignore OS repeats and create my own key repeats inside of OFS, in fact that’s what I’m doing for controller button repeats already.
Still all in all it would probably take like 2 hours atleast and I just don’t think it’s a good use my time.

You can write a function which does that. That’s the whole idea behind this system.
That being said in this case I’ll probably add those functions to funscript.lua.

Those are all valid ideas but I want to keep it simple for now.
Right now if you have two scripts you can ctrl+c copy one script into the “clipboard” and then in lua script1 would be in the “CurrentScript” variable and script2 in the “Clipboard” variable.

I’m going to prepare another release because I want to get this out without waiting a week. :grin:

Linux is fucked. :fire:
Basically what I think is happening the mpv package from ubuntu is built with lua support and when I link my own lua version with the application the whole thing blows up and the video player stops working.
This is going to be fun to try and fix that. :sob:

Windows is fine though.

Controller repeats was actually what matter for my use case, but I didn’t realize they’d be separate things. It’d still be nice to be able to adjust the rate for the controller even if it’s all-or-nothing; things are a little too fast sometimes right now.

Yeah, I was just wondering if there might be an API function available for it already, since I thought I’d seen a utility function for that in the code before. (And because the way lua does iterators hurts my brain.)

I’m not sure I understand what you mean here.

The use case I’m seeing is being able to mark multiple points with one script, and then act on them with another. Selections would handle some cases of that type, but not all.

Well if it’s just the contoller repeats. Making them configurable is easy. I think it’s hardcoded with 300ms delay and 50ms repeat rate so I can see how that may be too fast.

I have no intention of exposing my C++ Funscript class in Lua that would take it a little too far I think. I did add two functions which return actions either before or after a given timestamp.

It’s workaround but I don’t how to explain it.

I want to look into other language alternatives so if you have a favorite let me now.
Python & C# are too heavy no chance I’ll ever get those added to my build system.

What does this mean? Is there no longer a backup directory?

Honestly I think you’ve got the right choice already. Lua is practically made for this kind of application. If it’s popular enough I imagine you’ll see more requests to add things to the API, but I’m not aware of any language that would do the job better. (Well, other than the issue with breaking linux builds, but another language would probably just introduce it’s own problems.)

It’s just a language with syntax that I personally find confusing. But I’ll get by, with some examples to work from.

btw the person/people behind Lua don’t like it to be written in all caps.

Yeah, but they pronounce it ‘jiff’, too, I bet. :joy_cat:

It’s not an acronym. Why would you -want- to write it in all caps?

I aggree with all of that but I had my eyes on https://duktape.org/ and I’m curious if that would be viable alternative.
While I’m not a fan of JavaScript it has atleast a more widely known common syntax.

I would be discarding a lot of work that I already put in but that’s fine.