I'm not sure if this is the right place since this topic is more than 6 years old, but it seems that I have exactly the same problem:
Since I want to turn off the sensor after the rawopint script finishes (using chdkptp rs, so no images are saved to the camera) to reduce the amount of head of the sensor outside of the capturing time, I would like to switch from record mode to playback mode.
I think that in playback mode, the camera has a problem with missing images on the SD card (for example, the counter of images is at 900 images, but there are actually no images on the SD card).
The camera freezes when the camera was in playback mode and the command rec is called. I'm still able to connect and disconnect to the camera but any command I call after this the camera gives the error message "ERROR: a script is already running".
Then when I try to killscript() the script, the camera crashes. I have attached a log file of the crash.
Strangely, this error is inconsistent, it only occurs about 50% of the time, maybe it's due to a timeout issue: if I repeat the sequence in a short period of time, nothing happens, but if there are more hours between one script run and another, it becomes more unstable.
If I manually delete all photos in playback mode via the Canon menu, the imaginary counter of photos stored on the SD card is back to 0 and the camera does not freeze for the next run.
I have read
https://chdk.setepontos.com/index.php?topic=6231.820 and this thread but I am not sure how to solve the problem.
I tried imrm but it doesn't seem to have the same effect as manually deleting all images via the Canon menu.
How can I use the "event procedure named "PT_EraseAllFile"" for the g1x, or is that too complicated?
The sequence is:
rec
exec sys.sleep(2000)
luar set_zoom(28)
luar sleep(2000)
luar set_mf(1) --set focus to manual
luar set_focus(-1) --set focus distance to infinite
luar sleep(1000)
luar set_capture_mode(4) --set to AV mode
luar set_user_av96(416) --set AV value
luar set_ev(-128) --set EV value
luar set_iso_mode(100) --set ISO
luar set_raw_nr(1) --dark frame: 0=Auto 1=OFF, 2=ON
rs "D:/input/" -script=D:/rawopint_rs.lua -shots=10 -int=5
exec sys.sleep(1000)
d A/RAWOPINT.CSV "D:/sunset/"
exec sys.sleep(1000)
play
exec sys.sleep(2000)
exec con:call_function(0xff099f1c)
exec sys.sleep(1000)
imrm
exec sys.sleep(1000)
luar set_lcd_display(0)