Something like this ? (Cobbled together quickly from several other scripts).
--[[ Manual Shooting Intervalometer
@title Manual v1.0
@chdk_version 1.3
@param a Interval (sec)
@default a 15
@range a 2 30000
@param t Tv exposure (secs)
@default t 25
@range t 1 3600
@param e ISO
@default e 2
@values e 80 100 200 400 800 1250 1600 3200 6400
@param x ND filter
@default x 0
@values x Out In
--]]
-- switch to record mode if necessary
if ( get_mode() == false ) then
sleep(1000)
set_record(1)
while ( get_mode() == false) do
sleep(100)
end
end
-- turn seconds into tv96 values and get sv and av setpoints
tv96 =seconds_to_tv96(t,1)
local sv_table = { 381, 411, 507, 603, 699, 761, 795, 891, 987 }
sv96 = sv_table[e+1]
repeat
start = get_tick_count()
set_sv96(sv96)
set_tv96_direct(tv96)
if(x == 1) then -- ND filter requested ?
set_nd_filter(1) -- activate the ND filter
else
set_nd_filter(2) -- deactiveate the ND filter
end
press("shoot_half") -- half shoot and wait for auto exposure
repeat
sleep(10)
until get_shooting() == true
press("shoot_full") -- take the photo
sleep(50)
release("shoot_full_only")
sleep(50)
release("shoot_half")
repeat
sleep(20)
until get_shooting() ~= true
sleep(a*1000 - (get_tick_count() - start))
until ( false )
Note : you can't just set the shutter speed - you need to override the ISO and ND filter too. If your camera had an adjustable aperture (it doesn't) then you would need to override that too.