Adding Keys for noise strength position controller

Was hoping for a little insight into the syntax of creating keys for noise strength in a position controller.

What happens is I get only two keys the first and last but I can't figure out why I don't get keys for all the intermediary values.

stumped
Lowell.

AttachmentSize
input_keys_for_noise_position_v02.ms2.07 KB
amplitude_envelope_keys.txt17.13 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lucky_lowell's picture

Who's Better Than You!

thank you very much. I understand where I went wrong.

Lowell

Anubis's picture

I edit your script, read the

I edit your script, read the notes inside.
Also I'll add some tips to optimize the code:

-- in while loop you can convert quickly
-- your string to array of strings with filterString() function.
-- For example:
local valArray = filterString (readline files) " "
-- + even more, don't need to replace your commas in csv file,
-- so, if the data is formated as "15,0.002146667,0.002146667,0.002146667"
-- then above expression w'd be just:
local valArray = filterString (readline files) ","
 
-- + even more, ...
-- if you use readValue(), you never need to convert strings ;-)
local data = #()
for i = 1 to 4 do data[i] = (readValue files)
 
-- and next, just...
animate on at time t (...)
 
-- in other words, you can make your "while" loop very shorter:
while not eof files do (
    local data = #()
    for i = 1 to 4 do data[i] = (readValue files)
    animate on at time data[1] (
        applyObj.scale = [data[2],data[3],data[4]]
        applyObj.pos.controller.noise_strength = [data[2],data[3],data[4]]
    )
)
-- cheers
AttachmentSize
input_keys_for_noise_position_anubis.ms 2.36 KB

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.