clear all;

for num_sequences=1:100

seq_name = sprintf('seq_mimofb_range_%d.txt',num_sequences);

header{1} = '#';
header{2} = '# Description: $description';
header{3} = '# Author: Sequencer Library';
header{4} = '# Date: 2020/02/13';
header{5} = '#';
header{6} = sprintf('# This sequence set the mimofb actuator ranges ScalingFactor times actuator rm kicks');
header{7} = '#';

cnt = 0;
% reset executed flag
for seq=1:num_sequences
    cnt = cnt + 1;
    blk{cnt} = sprintf('step%d;(write($devfb/ActuatorRangesValues[%d]) = abs(read($devfb/ActuatorRMKickValues[%d]) * read(this/ScalingFactor))) && goto(%d);Setting $devfb actuator %d range;Error setting $devfb actuator %d range;-1',cnt,seq,seq,cnt+1,seq,seq);
end    

% dynamic attributes
cnt = 0;
cnt = cnt + 1;
footer{cnt} = 'attr;ScalingFactor;double;0';


fileID = fopen(seq_name,'w');
for i=1:size(header,2)
    fprintf(fileID,'%s\n',header{i});
end
for i=1:size(blk,2)
    fprintf(fileID,'%s\n',blk{i});
end
for i=1:size(footer,2)
    fprintf(fileID,'%s\n',footer{i});
end

fclose(fileID);

end

% Dynamic R/W attributes
%
% attr;ScalingFactor;long;0

% Wildcards
% $description=
% $devfb=
% $actuator_idx_1$=
% $actuator_idx_2$=
% $actuator_idx_3$=
% ........



