Advertisement
Guest User

Untitled

a guest
Feb 13th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1.  -- this needs to be called "Settings" and a global to work
  2.  Settings = {}
  3.  -- -10 to +10 ms jitter
  4.  Settings.Frequency = 10
  5.  -- -15 to +15 jitter
  6.  Settings.Amplitude = 15
  7.  SetSettings(Settings)
  8.  -- anything using Settings needs to use it after "SetSettings"
  9.  
  10.  
  11. for idx, action in ipairs(CurrentScript.actions) do
  12.    -- check if action is selected
  13.    if action.selected then
  14.       action.pos = math.floor(action.pos + math.sin(idx*Settings.Frequency/100.0)*Settings.Amplitude)
  15.      
  16.       -- clamp position between 0 and 100
  17.       action.pos = clamp(action.pos, 0, 100)    
  18.    end
  19.  
  20.    -- update progress bar every 100 actions
  21.    if idx % 100 == 0 then
  22.       -- SetProgress expects a number between 0 and 1
  23.       SetProgress(idx / #CurrentScript.actions)
  24.    end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement