Use a button to first store, then recall another widget's value?

Sorry guys, on a bit of a fast track to learn OStageC!

Imagine this:

I have an XY pad.

I want to have a button that will store the current value of it (the XY pad).

And then another button that can later (even an hour later) restore the pad to that stored value.

Is something like that possible?

(i already know about set(“knob_id”, 1), so i guess “get” works the same way, but then how later send that value out again?)

Hi,
it seems that you can store in the local of your browser https://openstagecontrol.ammd.net/docs/widgets/scripting/#storage

hope it helps

Usnig storage as @zoltan pointed out would look like this:

// save in slot "knob_val"
storage.setItem("knob_val", get("knob_1"))

// load from slot "knob_val"
set("knob_1", storage.getItem("knob_val"))
3 Likes

Brilliant, J-E & Zoltan, that works perfect! :pray:

This is very cool!

Question tho - I tried this while session was running on laptop and iPad, pressed “store” button on iPad and I could recall the stored value from laptop. But after restarting laptop, I could restore value from laptop, but not from iPad anymore.
Any thoughts why that might be a case?
Example attached.

@Dazzer in example bellow is another way how to store values, only problem is that they get reset when session is closed. Might come in handy anyways.

store_values.json (13.4 KB)

1 Like

I think the issue here is that the tap buttons are sync’ed across the different clients when the session is loaded and it triggers the script. That’s a behavior I’ll need to rationalize somehow… meanwhile I think the best course of action is to set bypass to true on these button to avoid sync.
Note that in any case, the variables saved in storage are not shared between clients, it may have seemed that way but was only a side effect of widget sync.

I see!

But is there a way how to save those values on server itself? So I can recall them from any client?

That’s possible with a custom module: instead of storing the value, send it and catch the message using the custom module, you’ll be able to do pretty much anything with it (the main drawback being that it requires diving into javascript a bit more)