MZ Requesting fix/input, Region move commands.

Hi everyone, I've been having trouble trying to get this plugin finalized after many weeks of planning, correspondence with programmers and set backs/turn downs and so i'm pretty much out of options so i've come here to seek assistance.

The purpose of this plugin is to make certain events make specific move routes based on road rules on semi-procedural generated maps by using region IDs as the command guides.
Essentially painting the map pathways in which an event follows move route commands based on the regions making unpredictable pathways based on some conditions to be met like intersecting lanes, merging lanes and eventually reaching map edges removing themselves from the map, with such a mechanic I can spawn numerous vehicles that will determine there own pathways.

For weeks I have been thoroughly testing this by using a script call: this.character(0).regionId() === #
This works quite well except for two noticeable issues such as jittery movement (A product more than likely caused by the event having to refresh it's page commands once and event has concluded it's movement onto a new region) and if diagonal movement is made but interrupted by another event's pathing causing it to stay in place.
These are probably only fixable by some kind of optimization effort within code -something that isn't my forte.

To show some evidence of my efforts I have some visual demonstrations:


This is what I have installed within the event's page to perform the tasks:
Spoiler: Event page.
◆Comment:[size|1|0|0|1|1]
◆Comment:[ CAR IS REVEALED ]
◆Comment:SPAWN ↓
◆If:Script:this.character(0).regionId() === 100
◆Set Movement Route:This Event (Wait)
: :◇1 Step Forward
◆
:End
◆If:Script:this.character(0).regionId() === 102
◆Set Movement Route:This Event (Wait)
: :◇1 Step Forward
◆
:End
◆If:Script:this.character(0).regionId() === 104
◆Set Movement Route:This Event (Wait)
: :◇1 Step Forward
◆
:End
◆If:Script:this.character(0).regionId() === 106
◆Set Movement Route:This Event (Wait)
: :◇1 Step Forward
◆
:End
◆Comment:Deleted
◆If:Script:this.character(0).regionId() === 101
◆Control Variables:#0067 Car Population Cap -= 1
◆Erase Event
◆
:End
◆If:Script:this.character(0).regionId() === 103
◆Control Variables:#0067 Car Population Cap -= 1
◆Erase Event
◆
:End
◆If:Script:this.character(0).regionId() === 105
◆Control Variables:#0067 Car Population Cap -= 1
◆Erase Event
◆
:End
◆If:Script:this.character(0).regionId() === 107
◆Control Variables:#0067 Car Population Cap -= 1
◆Erase Event
◆
:End
◆Comment:↑
◆If:Script:this.character(0).regionId() === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆Comment:→
◆If:Script:this.character(0).regionId() === 13
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆Comment:↓
◆If:Script:this.character(0).regionId() === 25
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆Comment:←
◆If:Script:this.character(0).regionId() === 37
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆Comment:↓ OR ←
◆If:Script:this.character(0).regionId() === 11
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↓ OR →
◆If:Script:this.character(0).regionId() === 23
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:↑ OR ←
◆If:Script:this.character(0).regionId() === 35
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↑ OR →
◆If:Script:this.character(0).regionId() === 47
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:⇖
◆If:Script:this.character(0).regionId() === 8
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆Comment:⇗
◆If:Script:this.character(0).regionId() === 20
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆Comment:⇙
◆If:Script:this.character(0).regionId() === 32
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆Comment:⇘
◆If:Script:this.character(0).regionId() === 44
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆Comment:↓ OR ⇙
◆If:Script:this.character(0).regionId() === 247
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆
:End
◆Comment:↓ OR ⇘
◆If:Script:this.character(0).regionId() === 19
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆
:End
◆Comment:↑ OR ⇖
◆If:Script:this.character(0).regionId() === 31
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆
:End
◆Comment:↑ OR ⇗
◆If:Script:this.character(0).regionId() === 43
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆
:End
◆Comment:← OR ⇙
◆If:Script:this.character(0).regionId() === 6
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆
:End
◆Comment:→ OR ⇘
◆If:Script:this.character(0).regionId() === 18
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆
:End
◆Comment:← OR ⇖
◆If:Script:this.character(0).regionId() === 30
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆
:End
◆Comment:→ OR ⇗
◆If:Script:this.character(0).regionId() === 42
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆
:End
◆Comment:↓ ONLY IF FACING ↓
: :← ONLY IF FACING ←
◆If:Script:this.character(0).regionId() === 9
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↓ ONLY IF FACING ↓
: :→ ONLY IF FACING →
◆If:Script:this.character(0).regionId() === 21
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:↑ ONLY IF FACING ↑
: :← ONLY IF FACING ←
◆If:Script:this.character(0).regionId() === 33
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↑ ONLY IF FACING ↑
: :→ ONLY IF FACING →
◆If:Script:this.character(0).regionId() === 45
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:[Repeat Last]
: :Duplicate Commands but have them on branch commands
: :via Variable that you reduce after made.
◆If:Script:this.character(0).regionId() === 3
◆Set Movement Route:This Event (Wait)
: :◇1 Step Forward
◆
:End
◆Comment:[Greens]
: :Hard to differenciate the difference between the green
: :and the dark blue arrows. Basically controls movement
: :dependant on direction incoming.
◆If:Script:this.character(0).regionId() === 4
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 16
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 28
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 40
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 5
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 17
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 29
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆If:Script:this.character(0).regionId() === 41
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:[TRAFFIC LIGHTS]
: :REGION LOCATIONS SPAWN TRAFFIC LIGHTS, THESE REGIONS
: :ALSO MUST HANDLE DIRECTIONAL RULES FOR MOVEMENT.
◆Comment:↓
◆If:Script:this.character(0).regionId() === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆Comment:←
◆If:Script:this.character(0).regionId() === 26
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆Comment:↑
◆If:Script:this.character(0).regionId() === 50
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆Comment:→
◆If:Script:this.character(0).regionId() === 74
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆Comment:↓ OR ⇘
◆If:Script:this.character(0).regionId() === 14
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆
:End
◆Comment:← OR ⇙
◆If:Script:this.character(0).regionId() === 38
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆
:End
◆Comment:↑ OR ⇖
◆If:Script:this.character(0).regionId() === 62
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆
:End
◆Comment:→ OR ⇗
◆If:Script:this.character(0).regionId() === 86
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆
:End
◆Comment:DIAGONAL RESTRICT
◆Comment:↓ OR ⇙
◆If:Script:this.character(0).regionId() === 22
◆If:This Event is facing Down
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆
:End
◆Comment:← OR ⇖
◆If:Script:this.character(0).regionId() === 34
◆If:This Event is facing Left
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆
:End
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↑ OR ⇗
◆If:Script:this.character(0).regionId() === 46
◆If:This Event is facing Up
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆
:End
◆Comment:→ OR ⇘
◆If:Script:this.character(0).regionId() === 10
◆If:This Event is facing Right
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆
:End
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:DIAGONAL RESTRICT EXTRA
◆Comment:← OR ⇙
◆If:Script:this.character(0).regionId() === 58
◆If:This Event is facing Down
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Left
◆
:End
◆
:End
◆If:This Event is facing Left
◆Set Movement Route:This Event (Wait)
: :◇Move Left
◆
:End
◆
:End
◆Comment:↑ OR ⇖
◆If:Script:this.character(0).regionId() === 70
◆If:This Event is facing Left
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Left
◆
:End
◆
:End
◆If:This Event is facing Up
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆
:End
◆Comment:→ OR ⇗
◆If:Script:this.character(0).regionId() === 82
◆If:This Event is facing Up
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Up
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Upper Right
◆
:End
◆
:End
◆If:This Event is facing Right
◆Set Movement Route:This Event (Wait)
: :◇Move Right
◆
:End
◆
:End
◆Comment:↓ OR ⇘
◆If:Script:this.character(0).regionId() === 94
◆If:This Event is facing Right
◆Script:this._Number = Math.floor(Math.random() * 2) + 1;
◆If:Script:this._Number === 1
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆If:Script:this._Number === 2
◆Set Movement Route:This Event (Wait)
: :◇Move Lower Right
◆
:End
◆
:End
◆If:This Event is facing Down
◆Set Movement Route:This Event (Wait)
: :◇Move Down
◆
:End
◆
:End

After some many weeks of waiting for responses from various JavaScript experts I've been turned down on getting this plugin made for my project. In the meantime i've resorted to chat GPT and after numerous attempts to try and get one created by AI all I've managed to do is get the thing to organize how plugin is setup, but the mechanics itself seem to always fail and I cannot figure out why, console log after console log to narrow down the variables I've noticed the AI tends to keep repeating the same mistakes by taking away features and sometimes just repeating the same updates.
To save time and effort I figured perhaps even someone with java script knowledge would be able to fix what the AI cannot, so i've included the file in this topic, I told the AI to construct it in a matter where the plugin parameters set up a reference ID to call upon that contains the movement commands, region IDs and behaviors, event's simply use a comment to reference the plugin parameters for easier configuration.

If anyone here is able to help, please!

Original thread: https://forums.rpgmakerweb.com/threads/requesting-fix-input-region-move-commands.165902/