Autonomous Movement Multi Line Script Calls?

I'm not sure if this belongs here or in a scripting section. The question is more involved with the feasibility of the idea than the actual scripting itself (though that would be helpful), but basically I'm trying to set up an NPCs Autonomous Movement in a way that I think will involve multiple script calls and I'm wondering if this is even possible.

To be more precise, I want an event to travel between multiple other events at random. I can have Event 1 travel to Event 2 with a script call, but say I wanted Event 1 to travel between Event 2, Event 3, and Event 4 at random, well then surely I would need to create a variable and then put this variable in where I would normally put an event number. This requires two lines of scripts, one to establish the variable and one for the move route script call to send Event 1 to the random event.

Also, let's say that Event 3 is erased. Well now I want Event 1 to only travel between Event 2 and 4. Though I'm flexible and could settle with a self switch check of other events. Either way, when an event is removed, I don't want my first event to travel to it anymore.

The move route options both seem to only support one line of script. Is what I'm proposing even possible with these limitations or is there a way to work around it?
This requires two lines of scripts, one to establish the variable and one for the move route script call to send Event 1 to the random event.
Clamp it into a method by making your own method. Put this as a new script.
Code:
class Game_Character
  def your_custom_method
    # put your script call here
  end
end
Then in move route script call, you can just write it as
Code:
your_custom_method
I assume you know what to write
I...do not, this was more to check if doing it was even possible, but if I'm understanding the general principle it would be something like this, right?

Code:
class Game_Character
  def special_event_id
    # Gather all events with "Special" commented on top. Maybe store them all in a dynamic array? I'm not sure how that works in Ruby.
    # Pick a random event.
    # Return id of said event
  end
end

And then call it in a way like this?

Code:
move_towards(special_event_id)

EDIT: Oh and add another condition to check if a self switch is on or the event is erased.

Original thread: https://forums.rpgmakerweb.com/threads/autonomous-movement-multi-line-script-calls.111781/