RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] Advance Scroll System Error

Started by Lysop, July 03, 2011, 08:51:34 AM

0 Members and 1 Guest are viewing this topic.

Lysop

Hi folks,
I use the script "Advance scroll system" and get an error (picture below) every time when I
try a command (e.g. scroll(RIGHT, 50, 7)) in Parallel Process or Autorun.
In Action Button, for example, it works fine.
The error appears in new projects with no scripts, too.


Game_Interpreter is an original VX-script, but I think you know this already :).

#===============================================================
# ? [VX] ? Advance Scroll System ? ?
# * Scroll with speed like 2.5 or 1.6, and/or in diagonal direction~ *
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 25/05/2008
# ? Version: 1.0
#--------------------------------------------------------------

#==================================================================
# ** HOW TO USE **
#-----------------------------------------------------------------
# To start scroll, call script:
#  scroll(direction, distance, speed)
#
# * direction: Scroll direction
# ** You can use these words for direction:
# ** DOWNLEFT, DOWN, DOWNRIGHT, LEFT, RIGHT, UPLEFT, UP, UPRIGHT
#
# * distance: Scroll Distance (1 for 1 tile)
#
# * speed: Scroll Speed, it can be any positive number (3, 2.3, 4.5, ...)
#
# For example:
#  scroll(UPLEFT, 10, 2.5)
# will scroll in UP-LEFT diretion for 10 tiles, with speed 2.5
#==================================================================

class Game_Map
  def update_scroll
if @scroll_rest > 0 # If scrolling
  distance = 2 ** @scroll_speed # Convert to distance
  case @scroll_direction
  when 1  # Down-Left
scroll_down(distance)
scroll_left(distance)
  when 2  # Down
scroll_down(distance)
  when 3  # Down-Right
scroll_down(distance)
scroll_right(distance)
  when 4  # Left
scroll_left(distance)
  when 6  # Right
scroll_right(distance)
  when 7  # Up-Left
scroll_up(distance)
scroll_left(distance)
  when 8  # Up
scroll_up(distance)
  when 9 # Up-Right
scroll_up(distance)
scroll_right(distance)
  end
  @scroll_rest -= distance   # Subtract scrolled distance
end
  end
end

class Game_Interpreter
  DOWNLEFT = 1
  DOWN = 2
  DOWNRIGHT = 3
  LEFT = 2
  RIGHT = 6
  UPLEFT = 7
  UP = 8
  UPRIGHT = 9
 
  def scroll(direction, distance, speed)
@params[0], @params[1], @params[2] = direction, distance, speed.to_f
command_204
  end
end


I'm happy about every help! ;D

exhydra

Line 1676 through 1689 of the Game_Interpreter code is dealing with parsing of scripts within an event. I can't seem to recreate the error, everything works fine for me. Perhaps copy and paste lines 1676 through 1689 of command_355 in the Game_Interpreter? It might have somehow gotten changed, that's about all I can think of.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

Lysop

With command_355 is everything ok.
I think the problem is when the parallel process reaches the end of the event page.

If you make an event like this (parallel process):

scroll(UPLEFT, 10, 8)
wait: 200

The error appears in my case when 200 frames are over.

exhydra

Perhaps you could upload a project to this thread that you are having the error in? I still can't reproduce the error.

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

Lysop


exhydra

Ok, I'm getting the error now. It looks like when the code within the event is getting eval'd, the returned values are over-writing the script for some reason. I could mess around with it more, but I think it would be better if you just used this script instead of that other one. They do exactly the same thing and this script won't cause any errors  :


#==============================================================================
# Scroll
#==============================================================================
# Author  : OriginalWij
# Version : 1.0
#==============================================================================

#==============================================================================
# To use:
#   call: $game_map.start_scroll(direction, distance, speed)
#     direction: 7 = up-left,   8 = up,   9 = up-right
#                4 = left                 6 = right
#                1 = down-left, 2 = down, 3 = down-right
#     distance:  distance to scroll (in tiles)
#     speed:     speed to scroll (can exceed default limit & can be a decimal)
#==============================================================================

#==============================================================================
# What this does:
#   allows diagonal map scrolling and decimal scrolling speeds
#==============================================================================

#==============================================================================
# Game_Map
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # Update Scroll                                                       [Mod]
  #--------------------------------------------------------------------------
  alias ow_scroll_game_map_update_scroll update_scroll unless $@
  def update_scroll
    ow_scroll_game_map_update_scroll
    if @scroll_rest > 0
      distance = 2 ** @scroll_speed
      case @scroll_direction
      when 1 # Down-Left
        scroll_down(distance)
        scroll_left(distance)
      when 3 # Down-Right
        scroll_down(distance)
        scroll_right(distance)
      when 7 # Up-Left
        scroll_up(distance)
        scroll_left(distance)
      when 9 # Up-Right
        scroll_up(distance)
        scroll_right(distance)
      end
    end
  end
end

UPDATED 05-29-14


IS YOUR PROJECT OPTIMIZED?
UPDATED 07/04/15 - v2.5

RPG MAKER TOOLBOX
UPDATED 07/04/15 - v1.5

Lysop

Oh ok! This script works perfectly! :D
Thank you for your fantastic help. I'm happy with this new script!
It implements that what I want, thanks! ;D

(why didn't I located it?)