How to clear a certain parameter

I want an integer slider for difficulty, and in the callback function I use parameter.clear(), because in one difficulty level, there are extra parameters. However, this clears all parameters, including the difficulty slider. I was hoping there was a way to clear only a few certain parameters.

Nope. The easiest may be to put the creation of parameters into functions, one for each different set, and clear them and run the appropriate function, when the difficulty changes.

Removed comment. Miss read the question.

Comment removed

@SkyTheCoder Apparently I mis-read the question. After reading it again, I guess he wants to remove a parameter, not reset it to a certain value. I’m watching football, so my mind isn’t fully on the forum.

I thought you could do slider = parameter.integer() parameter.remove(slider) Guess I was wrong. Would be a nice feature

I’ve got this:

function changeDifficulty(v)
    if v == 1 then
        parameter.clear()
        parameter.integer("Diffuculty", 1, 3, v, changeDifficulty)
    end
    if v == 2 then
        parameter.clear()
        parameter.integer("Diffuculty", 1, 3, v, changeDifficulty)
        parameter.text("X", 0, changeX)
        parameter.text("Y", 0, changeY)
    end
    if v == 3 then
        parameter.clear()
        parameter.integer("Diffuculty", 1, 3,  v, changeDifficulty)
    end
end

so far, where the parameter.integer is the difficulty slider and the function is changeDifficulty, the callback for the slider. This gives me a stack overflow, though.

@LaserGate_coder -There’s a gotcha with callback functions in parameters, that when you declare the parameter, the callback gets called. This is causing an infinite loop.

If you wrap the callback in a function, it avoids the problem, so try this

parameter.integer("Diffuculty", 1, 2, v, function() changeDifficulty() end)