Atm you have a for loop for each slider input.
So you change all slider. I‘m not very experienced with c#, but in python I would create a list of integers which should be changed and loop over them. For example:
listToChange = [0,1,5]
for index in listToChange:
Input[index]doSomething
You should not modify values from within a solution. Your RunScript() method is called as part of the solution and if it starts modifying things then you get solutions from within other solutions and that the way of pain.
Changes to the file must be made before or after solutions. For example form within your script you can schedule a solution in the future and provide a callback method. This callback is invoked just before the scheduled solution starts meaning you can make all the changes you like.