View Single Post
Old 04-10-2020, 04:58 PM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by lexaproductions View Post
Hi guys,
I have Script A which changes the pitch of items and save the amount in a ProjExtState

Then Script B Shows that ProjExtState in a GUI.
It works great but the problem is if I undo Script A, then the ProjExtState is not undone which leads to Script B not showing the right value.

How can I include my ProjExtState change in the undo cycle? It's already in the undo loop in my code.

Script A is a deferred script? How do you undo? Using Reaper's undo (CTRL+Z) or an undo button in your script?


You could save the previous value along with the new one in Script A and add an Undo button on your Script B that resets to the previous value. It's up to you how many undo states you want to save.
Code:
pseudocode for 3 undos for example


Script A
if  undoextstate2 then undoextstate3 = undoextstate2 end
if  undoextstate1 then undoextstate2 = undoextstate1 end
current_value = undoexstate1
set current_value
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote