If I get another person to say that keeping the order is more important, i'll chuck it into the actual snippet. Should be obvious which part to substitute for the following code.
;If the delete channel button is clicked, delete the current channel in the combo box from the Settings.ini file
if ($did == 52) {
if ($did($dname, 45) != $null) {
set %channels $rs(%tab.scd01, Channels)
set %n $did($dname, 45).sel
dec %n
$rms(%tab.scd01, Room $+ %n)
did -d scd01 45 $did($dname, 45).sel
dec %channels
set %s %n
while (%n < %channels) {
inc %s
writeini Settings.ini Server $+ %tab.scd01 Room $+ %n $rs(%tab.scd01, Room $+ %s)
inc %n
}
$rms(%tab.scd01, Room $+ %n)
unset %s
writeini Settings.ini Server $+ %tab.scd01 Channels %channels
unset %channels
unset %n
}
}