MakeVibrations Lua Script for OFS

Holy shit. It does. Gotta try this out thanks!

1 Like

Love your scripts @shbek ! Hope this helps :slight_smile:

I’ve updated the post to mention that it takes an amplitude as an input, hopefully no device melting :sweat_smile:

2 Likes

OMG It works like a charm.

I think it will save me at least 30~40% of my time on vibration patterns! Thank you so much!

More scripts incoming!

4 Likes

Glad to hear it! This script was very quick work so if you run into any bugs or find yourself wishing it did something more/else do let me know

1 Like

Does this work with OFS 2.0? I can’t figure out where to put it.

Good question! I can’t look at it today but from a quick look at the release notes for 2.0.0 it sounds like the API has been updated, so it may break all such extensions. I’ll install the new version soon and play around tomorrow probably!

1 Like

Yes two things were removed.
The old extension API and the even older “Custom functions” API (which you’re using in this case) was completely removed.
Sorry for the confusion.

The extension API has a little overhead when creating small functions like this but it’s worth it because once you have you can always extend it further. :wink:
The code should work with little modification as an extension you just have to wrap it in a binding.

More info: How to create an extension
And feel free to ask me questions via pm

If you want I could also add this to the extension I have here 11 Lua Scripts for OpenFunscripter - #28 by gagax123

1 Like

@gagax123 Thanks for the explanation, I think I will update my post just so that it works standalone but if you want to include my code in your extension feel free to add it in :slightly_smiling_face:

@pallokala2 I’ll make an update to the main post to support OFS 2.0 after I finish work in about 5hrs or so hopefully

1 Like

I’ve uploaded an OFS 2.X version of the extension, instructions included in the link hypertext

2 Likes

Haha, if only it worked in reverse!

1 Like

Is going to save me a bunch of time. Currently doing my first script and saved me doing vibrations frame by frame. Legend. one thing I wish though would be for the vibrations not to be cumulative but I don’t know if that’s possible. Once again, thank you.

1 Like

Hey @FootFanatic514 I’m happy to update the extension or provide a modified version, but I’m not sure exactly what you mean by “not be cumulative”, could you elaborate? Maybe with some screenshots of what you mean?

1 Like

To make it rely less on other scripts, you could decide to also enable a way in which it will add points based on a time duration? Having to manualy make the motion, or use a diffirent script for every single action can still be quite a lot of work (or have other issues).

By adding the missing points, you can still have some gaps near the next normal point (either the gap is too short or too long), but this can already be acceptable in most cases. And otherwise you could just decide to snap that point (moving it slightly forward or backward).

I have no idea how difficult that will be code wise. But it can aid into making longer sections a vibration with less effort.


On that, it can happen that vibrations will exceed a certain speed limit. For that i do have an idea on how it could be countered (again, no idea how the scripts go). But in this case it checks if the action will exceed the set treshold (for the handy speeds above 600 units can give issues), if so, it simply will simply cap its point in such way that speed is reached. If the next spot then is going to be very close in position (because this one isnt limited), it will obviously get a very low speed, but as it doesnt exceed limits, it should not cause issues in which the devide movement becomes disrupted by clipping speeds or ignoring positions. With it, during fast movements this ‘wait’ rather than the inverted motion will still do the job for giving a vibration feeling.

I appreciate the feedback on the extension. In terms of your suggestions re. combining with other point generating scripts and not exceeding speed limits;

  1. I personally prefer keeping such functionality clearly split up. If I add in point generating code into my extension, then that might stifle other uses of vibrations if the two are tied together. I think keyboard shortcuts or other limitations to the point generation scripts may be your limiting factor here. At best if I added this in, I would simply be copy-pasting other people’s extensions into mine and adding a toggle to enable them, which wouldn’t be much better than just using one extension before using mine.
  2. I have had a bit of a think about the speed limit issue but I don’t think I’m up to the task of such a change, in principle it sounds somewhat simple, but I’m not overly familiar with the extension framework. When I was creating what we have here, I didn’t find it particularly easy to inspect properties of the points and then manipulate them.

Sorry to shut down both your suggestions in one fell swoop, I do highly encourage you to dive in and make an updated version of my extension if you’d like.

Took me a bit of hassle, but i seem to have a working version now that includes some of my ideas

This now walks through all nodes and adds in frames based on the frequency you set (defaults at 25, but can be any value you want, although too high values might not work on all devides, and it doesnt compensate for amplitude).

The resulting speeds can get excessive if both numbers are too high. For reference, amplitude * frequency is the average units per second it tries to aim for. (but its not accurate at it, 10 amp and 40 framerate means movements averaging at 400 units per second when the line is flat, but in movement it can exceed that)

For misaligned midpoints it shifts them slightly back (this includes the endpoint). For nodes too close to each other it doesnt act.

(i have not added my credits to the script btw as i was still going to look if i can get it to include a speed limiter, and also, the code for injecting points was handcrafted, i dont know if a more optimal method exists as i just used the OFS docs and my own knowledge of lua for it)

1 Like

I have actualy been able to get the limiter to work as well, and also added the capability to turn off the features using checkboxes:

interface

I dont know if you prefer that i upload it here in this thread, or make a new one for it (as the base of the code is still yours, my code is just injected at certain parts). If i should make it into a new thread, you will obviously be credited for that with a link to this thread (and ofcourse, your credits are in the code as original designer).

I also fixed some bugs on the script i posted earlier which contained a basic feature of the following:

Example wave:

And the 2 results:
Amp 10, Frq 25, Limit 600


Amp 10, Frq 60, Limit 600

And yes, you can apply this to an entire script at once (although, you might run into some limits, but i have tested this with a script of 10mins without issues).

2 Likes

Hey nice work on the extension! It looks like you’ve put in a lot of work, I reckon create a new post for it as this is a significant upgrade. You can credit me for the baseline if you really want to but at this point I think you should be the primary credit for it :smile:

Upon seeing your screenshots I understand a lot better what you were going for, great to see you made it a reality!

1 Like

:slight_smile:

1 Like

Sorry for the late response. when I mean cumulative I mean when you vary the intensity of the vibrations you have to press add vibrations and if it is not the correct intensity you have to undo it and try again. the cumulative part is when you press the add vibrations again it adds a vibration to the already make vibration instead of readjusting the one you just made. The way i see it would be better is if it was like the range extender or simplify tool where it live updates. I have seen how difficult this can be to potentially implement so I cannot give much advice, but it would be a feature I’d like to see. Thank you

I did a test for this and actualy managed to get this live updating working. But in my case (because it also includes the point adding making the script significantly heavier, combined with its unoptimization) it is notibly more laggy to use. Still for reference you can see how i achieved it:

For those who look in the script: Note the update function tracking the interface and reacting to updates, which then does use some trick for saving and undoing the changes. It however does still allow CTRL+Z after usage, so on that it seems to behave properly. Maybe someone can optimize the behaviour for this though.

1 Like