How to convert this line of code from ace to MV?

Hi guys I am struggling with a certain part I wanted to convert Rhyme Smooth Scrolling from Ace for my OWN use in my game (and obviously all the credit would be gave )


but at a point I am struggling with some part....I just don't know how to properly convert the line for work in MV...since MV is the same but in same time Nope not the same....


so I would be really happy if you guys can help me.

Code:
  alias initialize_rhyme initialize
  def initialize
    initialize_rhyme
    @t_display_x = @display_x
    @t_display_y = @display_y
  end
  #--------------------------------------------------------------------------
  # ● Set Display Position
  #--------------------------------------------------------------------------
  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?
    @t_display_x = @display_x = (x + width) % width
    @t_display_y = @display_y = (y + height) % height
    @parallax_x = x
    @parallax_y = y
  end
  #----



the JS version :

Code:
// FROM THE ORIGINAL JS FILE
Game_Map.prototype.setDisplayPos = function(x, y) {
    if (this.isLoopHorizontal()) {
        this._displayX = x.mod(this.width());
        this._parallaxX = x;
    } else {
        var endX = this.width() - this.screenTileX();
        this._displayX = endX < 0 ? endX / 2 : x.clamp(0, endX);
        this._parallaxX = this._displayX;
    }
    if (this.isLoopVertical()) {
        this._displayY = y.mod(this.height());
        this._parallaxY = y;
    } else {
        var endY = this.height() - this.screenTileY();
        this._displayY = endY < 0 ? endY / 2 : y.clamp(0, endY);
        this._parallaxY = this._displayY;
    }
};
Code:
    x = [0, [x, width - screen_tile_x].min].max unless loop_horizontal?
    y = [0, [y, height - screen_tile_y].min].max unless loop_vertical?
    @t_display_x = @display_x = (x + width) % width
    @t_display_y = @display_y = (y + height) % height
    @parallax_x = x
    @parallax_y = y



if (!this.isLoopHorizontal()) x = x.clamp(0, this.width() - this.screenTileX());
if (!this.isLoopVertical()) y = y.clamp(0, this.height() - this.screenTileY());
this._displayX = (x + this.width()) % this.width();
this._displayY = (y + this.height()) % this.height();
this._tDisplayX = this._displayX;
this._tDisplayY = this._displayY;
this._parallaxX = x;
this._parallaxY = x;


"this._tDisplayX" is equivalent to "@t_display_x"
@Victor Sant thanks victor! 


I was unsure if actually the method was actually working in MV because how they changed the method '^'"


but I will see if this works thanks!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-convert-this-line-of-code-from-ace-to-mv.57369/