How to wrap an input_number when incrementing?

Hello. I want to have a button which cycles a light between a few different colours. I have created an input_number to store an index to the current colour. I have a script which can increment this, but I do not know how to reset the number once it reaches the max.

I have got:

sequence:
  - alias: "Inc"
    service: input_number.increment
    data:
      entity_id: input_number.bedroomlightsettings
  - alias: "Reset"
    service: input_number.set_value
    data:
      entity_id: input_number.bedroomlightsettings
      value: 0
    condition:
      condition: numeric_state
      entity_id: input_number.bedroomlightsettings
      above: 3

This gives me the error:

Message malformed: Unable to determine action @ data[‘sequence’][0]

I don’t really understand these scripts, particularly when to indent and when to use a hyphen.

Any help is appreciated. Thanks.

scripts.yaml

inc_bedroom_light:
  sequence:
    - if:
        condition: numeric_state
        entity_id: input_number.bedroomlightsettings
        above: 2
      then:
        - service: input_number.set_value
          target:
            entity_id: input_number.bedroomlightsettings
          data:
            value: 0
      else:
       - service: input_number.increment
         target:
           entity_id: input_number.bedroomlightsettings

Your script will be called script.inc_bedroom_light

Thanks very much.