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

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
41
Reaction score
5
First Language
English
Primarily Uses
RMVXA
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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,046
Reaction score
7,132
First Language
Indonesian
Primarily Uses
RMVXA
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?
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
41
Reaction score
5
First Language
English
Primarily Uses
RMVXA
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
 
Last edited:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,593
Reaction score
3,811
First Language
Java's Crypt
Primarily Uses
RMMZ
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
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,891
Reaction score
642
First Language
English
Primarily Uses
RMVXA
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.
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
41
Reaction score
5
First Language
English
Primarily Uses
RMVXA
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!
 
Last edited:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,593
Reaction score
3,811
First Language
Java's Crypt
Primarily Uses
RMMZ
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).
 

Latest Threads

Latest Posts

Latest Profile Posts

The light has gone out of my life.

About time they finally press the kill switch button for older makers.
Sorry everyone, I am here sporadically. After 6 years of delays after delays in my life, I try to do all mat once and that means that I spread thin everywhere because it just is impossible to crunch 6 years in one or even two, but I try! I wish many of that I would already given you and put behind but... well...
I'm looking for an experienced gamer who has played a few games created with RPG Maker, who knows what an alpha build is, who may remember the old days when cliché was the favorite word on Creation Asylum, who, if a reviewer, would ask for my permission before making a review to post on YouTube, or whatever, since I will be messaging you a 10 minute, or so, DEMO based on an alpha build of Effervesce Fallacy™.
No matter how many times I listen to him, I know this is Joker speaking, but my brain can only hear Dagda.

Forum statistics

Threads
108,821
Messages
1,039,824
Members
141,279
Latest member
SawYuuki
Top