elseif ($did($dname,$did).sel == 30) { /lag -c}

Use the bracket checking function in the script editor. The button with the checkmark in the top-right of the editor.

-genius_at_work