Map Scroll Glitch Fix immediately crashes game, says there's an unexpected "."

Hi, I am trying to use this script (https://rpgmaker.net/scripts/238/code/; what happened to the bbcode editor, btw?) to fix a screen bug related to having the resolution at 640x360, to where when you are at the bottom of the map, the top of the map shows at the bottom. It's really weird, but apparently this script fixes that.
I say "apparently" because the script crashes on startup, saying that there is a unexpected "." at .min on line 21. I've tried removing that line altogether, tried removing the dot, tried to just put the y resolution there in its place (which fixes the crash but makes the script act crazy), tried all sorts of stuff, but I haven't been successful in fixing it. What would be the fix to this?
Thank you very much for any help.
this line
Code:
x = [0, .min].max unless loop_horizontal?
y = [0, .min].max unless loop_vertical?
should be
Code:
x = [0, x].min].max unless loop_horizontal?
y = [0, y].min].max unless loop_vertical?
crashes on startup
And so it should. there a parts missing.
should be
that still gives an error.
The original code has parts that this script is missing. Specifically the parts inside the []

I'd attach the original code but I don't seem to have the option to
that still gives an error.
You're right
Code:
x = [[0, x].min].max unless loop_horizontal?
y = [[0, y].min].max unless loop_vertical?
I'd attach the original code but I don't seem to have the option to
Just copy inside the [ code ] tag
And so it should. there a parts missing.

that still gives an error.
The original code has parts that this script is missing. Specifically the parts inside the []

I'd attach the original code but I don't seem to have the option to
The link I gave is the code that was provided by the original script author on rpgmaker.net (https://rpgmaker.net/scripts/238/).

@TheoAllen, the game doesn't crash now but the script doesn't seem to do anything. EDIT: I'm stupid, I had the script disabled. The game still crashes. But @Hudell 's script seems to work, although the bottom portion of the screen is now cut off, but I can live with that. Thanks guys
The original fix I wrote is available on this thread:

Here's a copy, but I recommend reading the thread above anyway:

Code:
class Game_Map  
  def width    
    if Graphics.width % 32 == 0      
      @map.width    
    else      
      @map.width - 1    
    end  
  end    
 
  def height    
    if Graphics.height % 32 == 0      
      @map.height    
    else      
      @map.height - 1    
    end  
  end  
end 

class Game_Player < Game_Character  
  def center_x    
    ((Graphics.width / 32).floor - 1) / 2.0  
  end  
 
  def center_y    
    ((Graphics.height / 32).floor - 1) / 2.0  
  end
end
still no good. the original code in the scripts is this
Code:
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height
      @parallax_y += distance if @parallax_loop_y
    else
      last_y = @display_y
      @display_y = [@display_y + distance, height - screen_tile_y].min
      @parallax_y += @display_y - last_y
    end
  end
  def set_display_pos(x, y)
    x = [0, [x, width - screen_tile_x].min].max unless loop_horizontal?
    y = [0, [y, height - screen_tile_y].min].max unless loop_vertical?
    @display_x = (x + width) % width
    @display_y = (y + height) % height
    @parallax_x = x
    @parallax_y = y
  end
original fix I wrote
This does indeed fix the problem, but isn't the original script asked about.
Since your method works perfectly, we should probable just drop that other script.
I've found another problem: now my character cannot walk on the tiles on the bottom of the screen, not even when I hold the CTRL key. Can this be fixed?
EDIT: trying the code @Roninator2 provided.
EDIT 2: It doesn't work :/ I can work with Hudell's script but I'd like to be able to go to the very bottom of the map because I have transfer events there. I suppose I can move them up though but I don't think it looks as good but if it cannot be fixed then I understand.

EDIT 3:
I was able to fix it by changing line 14 to
Code:
@map.height - 0.25
This is solved for me. Thank you!
The idea behind my fix is that you would add one more row and column of tiles to the map, to render those instead of the glitched tiles.

Back then there was no know fix for it but if the other script can fix it without needing an extra row, it's probably best to use that (if you can get it to work).

Original thread: https://forums.rpgmakerweb.com/threads/map-scroll-glitch-fix-immediately-crashes-game-says-theres-an-unexpected.132488/