Assistance with class editor script (newbie question)

Hello Drafts community,

I am trying to modify the move by previous and next word actions that come shipped with Drafts so they return previous and next sentences. I am very new at writing scripts, and, for this reason, I’m finding it difficult to understand what I’m reading. Unfortunately for me, simply replacing a few lines of script didn’t result in the outcome I was looking for…

I want to write a script that returns the previous/next sentence indexes because I’m a screen reader user—and I want speech output to read the entire expression returned, similar to the way whole syntaxes are returned when you run the previous and next marker. Otherwise I’d just continue using the simple action that searched for previous and next character—e.g., “,”, “.”, “?”. “?”, “!”.

Here’s the source I’m trying to make my way through. And yes, I’ve also taken a look at the editor section in the Drafts manual. Any insights that would help guide my reading would be much appreciated! Thanks in advance!