Based on your last version of the script:
#BEGIN DOWNTOWN
- type: DOWNTOWNURBAN
commands:
- type: resize #We need 60x60x8
size: [6, 6, 8]
- type: addBlock #Add Rail Station
size: 2
blocks: 8
executionChances: 75
#Position 0,0 - 0,4
- type: checkBlock #Check Railstation
label: 10
size: 2
blocks: 8
rects:
- [0, 0, 1, 6]
- type: fillArea #Place Rails
conditionals: 10
groups: 13
rects:
- [0, 0, 1, 6]
#Position 1,0 - 1,4
- type: checkBlock #Check Railstation
label: 11
conditionals: -10
size: 2
blocks: 8
rects:
- [1, 0, 1, 6]
- type: fillArea #Place Rails
conditionals: 11
groups: 13
rects:
- [1, 0, 1, 6]
#Position 2,0 - 2,4
- type: checkBlock #Check Railstation
label: 12
conditionals: [-10, -11]
size: 2
blocks: 8
rects:
- [2, 0, 1, 6]
- type: fillArea #Place Rails
conditionals: 12
groups: 13
rects:
- [2, 0, 1, 6]
#Position 3,0 - 3,4
- type: checkBlock #Check Railstation
label: 13
conditionals: [-10, -11, -12]
size: 2
blocks: 8
rects:
- [3, 0, 1, 6]
- type: fillArea #Place Rails
conditionals: 13
groups: 13
rects:
- [3, 0, 1, 6]
#Position 4,0 - 4,4
- type: checkBlock #Check Railstation
label: 14
conditionals: [-10, -11, -12,-13]
size: 2
blocks: 8
rects:
- [4, 0, 1, 6]
- type: fillArea #Place Rails
conditionals: 14
groups: 13
rects:
- [4, 0, 1, 6]
#End Position Checks
# This command will detect vertical railroads (group 13) and place the railroad crossing (group 14) that intersect with the road
- type: addLine #Add EW Roads
direction: horizontal
executionChances: 75
verticalGroup: 13 # Railroads N-S
crossingGroup: 14 # Railroad Crossing
- type: addUFO
- type: addCraft
- type: addLine
direction: vertical
executionChances: 75
- type: addBlock
size: 2
executions: 6
blocks: [1, 6, 14, 15]
freqs: [3, 2, 2, 3]
maxUses: [3, 3, 3, 3]
- type: fillArea
blocks: [2, 3, 5, 7, 16, 17]
freqs: [3, 2, 3, 3, 3, 3]
maxUses: [3, 3, 3, 3, 3, 3]
#END DOWNTOWN
HOWEVER, for this version to work the following terrain mapBlocks need to be updated and assigned to either group 13 (N-S) or 14 (crossing). I picked those numbers so it's easier to visualize which group is which if you're familiar with default road groups (2 E-W, 3 N-S, 4 crossing), so you can change them to what you consider best for your style.
- name: DOWNTOWNURBAN09
width: 10
length: 10
groups: 13 # Railroads N-S
- name: DOWNTOWNURBAN12
width: 10
length: 10
groups: 14 # Railroad Crossing
- name: DOWNTOWNURBAN21
width: 10
length: 10
groups: 13 # Railroads N-S
These changes will make it so you don't have to script the railroad crossing replacement as the addline command does it for you when you specify the correct verticalGroup and crossingGroup. The command just has to be executed AFTER the railroads are placed.