Should be this sub here:
sub StandingStill
  namespace push
  namespace local STILL
  
  set !newpos #CHARPOSX , #CHARPOSY , #CHARPOSZ
  if !newpos <> !oldpos || !move_timer = N/A
  {
    set !delay 1 ; adjust this value for more delay
    set !oldpos !newpos
    set !still #FALSE
    set !move_timer #SCNT + !delay
  }
  if #SCNT > !move_timer
  {
    if !oldpos = !newpos
    {
      set !still #TRUE
    }
    else
    {
      set !oldpos !newpos
      set !move_timer #SCNT + !delay
    }
  }
  set #RESULT !still
  namespace pop
return #RESULT
Then you just use it like this:
  gosub StandingStill
  if #RESULT = #TRUE
  {
    ; do your stuff here.
  }
Note you can modify the value of !delay to add more delay.  It's already delaying the least amount (1 second)