Help with triggering multiple animations using the crank

I'm having trouble getting a few different animations to play by turning the crank while next to (and facing) a tile which also looks like a crank.

playdate-20230825-205512

The arrow tile represents the player's position and direction. However, I can't even get the initial animation of the crank tile turning to start.

Player:

on crank do
  if event.room=="crank_test" then
    if event.px==2 then
      if event.py==4 then
        if event.dx==-1 then
          acting = 2
          act
          acting = 0
        end
      end
    end
  end
end

Crank tile ("cranking" is 18 frames)

on interact do
  if acting==1 then
    // say something
  elseif acting==2 then
    call "openGate"
    play "cranking" then
      swap "cranked"
    end
  end
end

gateClosed1 through 4 ("gateOpening1 through 4" are 14 frames each)

on openGate do
  wait 4 then
    play "gateOpening#" then
      swap "gateOpen#"
    end
  end
end

The gate opening animation is delayed, because I want the player to turn the crank on the Playdate for a bit before the gate starts to open. Can anyone see what I'm doing wrong here?

I managed to solve this.

Player:

on crank do
  acting = 2
  act
  acting = 0
end

The confirm script I'm using sets acting to 1, then acts, then sets acting back to 0 like the script above. I thought this was interesting because now there's three ways for the player to interact with sprites. Bumping into a sprite will interact if acting is 0, pressing A will interact if acting is 1, and turning the crank will interact if acting is 2. This means you could make an NPC say 3 different things depending on how you interact with them, or objects can behave differently depending on how you interact with them.

Crank Tile:

on interact do
  if acting==1 then
    // say something
  elseif acting==2 then
    ignore
    play "cranking" then
      swap "cranked"
      listen
    end
    tell 1,1 to
      play "gateOpening1" then
        swap "gateOpen1"
      end
    end
    tell 2,1 to
      play "gateOpening2" then
        swap "gateOpen2"
      end
    end
    tell 1,2 to
      play "gateOpening3" then
        swap "white"
      end
    end
    tell 2,2 to
      play "gateOpening4" then
        swap "gateOpen4"
      end
    end
  end
end

Instead of using wait to delay the "gateOpening" animations like I had planned, I decided to add some extra frames to the beginning of the animations so that the gate doesn't start moving right away.

I also added ignore and listen so the player can't move away from the crank tile while the animations are still playing.

However, if possible I'd rather use call to trigger a custom event to make the gate open, so I could move all the code for opening the gate to the "gateClosed" tiles (like in my initial post). I've tried to do this a few times with no success yet.