Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

custom res script bad value error

here is my script for (bluescope's custom rez) custom folder.....

#==============================================================================
# Custom Resolution Script v0.82
#------------------------------------------------------------------------------
# Script by BlueScope
#==============================================================================

module Setup
#--------------------------------------------------------------------------
RESOLUTION = [(1440).to_f, (900).to_f]
#--------------------------------------------------------------------------
def self.x_value
return RESOLUTION[0] / 640
end
#--------------------------------------------------------------------------
def self.y_value
return RESOLUTION[1] / 480
end
#--------------------------------------------------------------------------
def self.c_value
return ((RESOLUTION[0] / 640) + (RESOLUTION[1] / 480)) / 2
end
#--------------------------------------------------------------------------
def self.h_value
return RESOLUTION[0]
end
#--------------------------------------------------------------------------
def self.v_value
return RESOLUTION[1]
end
#--------------------------------------------------------------------------
def self.variance
return (((RESOLUTION[0] / 640) + (RESOLUTION[1] / 480)) / 2) - 1
end
#--------------------------------------------------------------------------
end


module Resolution
#--------------------------------------------------------------------------
# The following method refers to the resolution changing script and has to
# be placed below Selwyn's resolution script in order to work properly
#--------------------------------------------------------------------------
def self.fullscreen
@default_size = size
@set_window_long.call(@window, -16, 0x14000000)
@set_window_pos.call(@window, -1, 0, 0, Setup.h_value, Setup.v_value, 64)
@set_resolution.call(Setup.h_value, Setup.v_value, 4)
@state = "fullscreen"
end
#--------------------------------------------------------------------------
end


class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
attr_accessor :character
#--------------------------------------------------------------------------
alias resolution_update update
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch - (32 * Setup.variance)
end
end
resolution_update
end
#--------------------------------------------------------------------------
end


class Spriteset_Map
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
@viewport1 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
@viewport2 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
@viewport3 = Viewport.new(0, 0, Setup.h_value, Setup.v_value)
resolution_initialize
end
#--------------------------------------------------------------------------
end


class Game_Map
#--------------------------------------------------------------------------
# The following method refers to the Tilemap class and has to be placed
# below SephirothSpawn's Tilemap class rewrite in order to work properly
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
resolution_initialize
@tilemap_tile_width = (32 * Setup.x_value)
@tilemap_tile_height = (32 * Setup.y_value)
end
#--------------------------------------------------------------------------
def scroll_down(distance)
@display_y = [@display_y + distance, (self.height - 15) * (128 * Setup.y_value)].min
end
#--------------------------------------------------------------------------
def scroll_right(distance)
@display_x = [@display_x + distance, (self.width - 20) * (128 * Setup.x_value)].min
end
#--------------------------------------------------------------------------
def start_scroll(direction, distance, speed)
@scroll_direction = direction
@scroll_rest = distance * (128 * Setup.c_value)
@scroll_speed = speed
end
#--------------------------------------------------------------------------
end


class Game_Character
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
resolution_initialize
@move_speed = 4 + (Setup.variance * 2)
end
#--------------------------------------------------------------------------
def moving?
return (@real_x != @x * (128 * Setup.x_value) or @real_y != @y * (128 * Setup.y_value))
end
#--------------------------------------------------------------------------
def moveto(x, y)
@x = x % $game_map.width
@y = y % $game_map.height
@real_x = @x * (128 * Setup.x_value)
@real_y = @y * (128 * Setup.y_value)
@prelock_direction = 0
end
#--------------------------------------------------------------------------
def screen_x
return (@real_x - $game_map.display_x + 3) / 4 + (16 * Setup.x_value)
end
#--------------------------------------------------------------------------
alias resolution_screen_y screen_y
def screen_y
y = (@real_y - $game_map.display_y + 3) / 4 + (32 * Setup.y_value)
resolution_screen_y
end
#--------------------------------------------------------------------------
def screen_z(height = 0)
if @always_on_top
return 999
end
z = (@real_y - $game_map.display_y + 3) / 4 + (32 * Setup.c_value)
if @tile_id > 0
return z + $game_map.priorities[@tile_id] * (32 * Setup.c_value)
else
return z + ((height > 32) ? 31 : 0)
end
end
#--------------------------------------------------------------------------
alias resolution_update update
def update
resolution_update
if @anime_count > 18 - @move_speed * (2 - (Setup.variance * 2))
if not @step_anime and @stop_count > 0
@pattern = @original_pattern
else
@pattern = (@pattern + 1) % 4
end
@anime_count = 0
end
end
#--------------------------------------------------------------------------
def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x * (128 * Setup.x_value)) / (@jump_count + 1)
@real_y = (@real_y * @jump_count + @y * (128 * Setup.y_value)) / (@jump_count + 1)
end
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed
if @y * (128 * Setup.y_value) > @real_y
@real_y = [@real_y + distance, @y * (128 * Setup.y_value)].min
end
if @x * (128 * Setup.x_value) < @real_x
@real_x = [@real_x - distance, @x * (128 * Setup.x_value)].max
end
if @x * (128 * Setup.x_value) > @real_x
@real_x = [@real_x + distance, @x * (128 * Setup.x_value)].min
end
if @y * (128 * Setup.y_value) < @real_y
@real_y = [@real_y - distance, @y * (128 * Setup.y_value)].max
end
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
#--------------------------------------------------------------------------
end


class Game_Player < Game_Character
#--------------------------------------------------------------------------
CENTER_X = ((320 * Setup.x_value) - 8) * 4
CENTER_Y = ((240 * Setup.y_value) - 8) * 4
#--------------------------------------------------------------------------
def center(x, y)
max_x = ($game_map.width - 20) * (128 * Setup.x_value)
max_y = ($game_map.height - 15) * (128 * Setup.y_value)
$game_map.display_x = [0, [x * (128 * Setup.x_value) - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * (128 * Setup.y_value) - CENTER_Y, max_y].min].max
end
#--------------------------------------------------------------------------
end


class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
alias resolution_initialize initialize
def initialize
resolution_initialize
self.x = 80 *- Setup.variance
self.width = 480 *- Setup.variance
self.height = 160 *- Setup.variance
self.contents.font.name = 'Verdana'
self.contents.font.size = Font.default_size * -Setup.variance
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
x = y = 0
@cursor_width = 0
if $game_temp.choice_start == 0
x = 8
end
if $game_temp.message_text != nil
text = $game_temp.message_text
begin
last_text = text.clone
text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until text == last_text
text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
text.gsub!(/\\\\/) { "\000" }
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
text.gsub!(/\\[Gg]/) { "\002" }
while ((c = text.slice!(/./m)) != nil)
if c == "\000"
c = "\\"
end
if c == "\001"
text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
next
end
if c == "\002"
if @gold_window == nil
@gold_window = Window_Gold.new
@gold_window.x = (Setup.h_value * 0.875) - @gold_window.width
if $game_temp.in_battle
@gold_window.y = (Setup.h_value / 10) * 3
else
@gold_window.y = self.y >= (128 * Setup.variance) ?
(32 * Setup.variance) : (384 * Setup.variance)
end
@gold_window.opacity = self.opacity
@gold_window.back_opacity = self.back_opacity
end
next
end
if c == "\n"
if y >= $game_temp.choice_start
@cursor_width = [@cursor_width, x].max
end
y += 1
x = 0
if y >= $game_temp.choice_start
x = 8
end
next
end
draw_y = (26 *- Setup.variance) * y - (24 *- Setup.variance)
self.contents.draw_text(4 *- Setup.variance + x, draw_y, 40, 32, c)
x += self.contents.text_size(c).width
end
end
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active = true
self.index = 0
end
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
end
#--------------------------------------------------------------------------
def reset_window
if $game_temp.in_battle
self.y = (16 * Setup.variance)
else
case $game_system.message_position
when 0
self.y = (16 *- Setup.variance)
when 1
self.y = (160 *- Setup.variance)
when 2
self.y = (304 *- Setup.variance)
end
end
if $game_system.message_frame == 0
self.opacity = 255
else
self.opacity = 0
end
self.back_opacity = 160
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index >= 0
n = $game_temp.choice_start + @index
self.cursor_rect.set(8, n * (24 *- Setup.variance), @cursor_width,
(24 *- Setup.variance))
else
self.cursor_rect.empty
end
end
#--------------------------------------------------------------------------
end


begin
Resolution.initialize
Resolution.fullscreen
$scene = nil
end

...as you can see i changed the resolution up top from the default 320x240, to 1440x900, and at the title screen (on fullscreen) it lines up perfectly.

Then it pops up error message bad value for size on line 237....

So I could only get it to work after I removed the Resolution.initialize from the main script (because selwyn's won't go under 800x600, without displaying that very error message)....

and then it WILL display, only on 320x240 on fullscreen.....

I put 800x600, and I get the same bad value for size on line 237....then it resizes my whole monitor and I have to change it back to 1440x900 to get it back to normal again.

Any suggestions?
 
Bunktown207;323297 said:
...as you can see i changed the resolution up top from the default 320x240, to 1440x900, and at the title screen (on fullscreen) it lines up perfectly.

Then it pops up error message bad value for size on line 237....

So I could only get it to work after I removed the Resolution.initialize from the main script (because selwyn's won't go under 800x600, without displaying that very error message)....

and then it WILL display, only on 320x240 on fullscreen.....

I put 800x600, and I get the same bad value for size on line 237....then it resizes my whole monitor and I have to change it back to 1440x900 to get it back to normal again.

Any suggestions?

Hy friend (I see that you want to even run his project on another resolution! :D), The script of BlueScope not work with resolutions above 640*480 (in the post's main script he said that if someone wants to run your game in a resolution greater than the standard that uses the script of Sewyn), but it can help you more than me, PM try it. :thumb:
 
Heh yeah I was willing to try anything while waiting for you to finish with yours....

It said on his link that it could be whatever size, guess that wasn't the case.

I tried removing the caterpillar script on yours also and still no luck.

.....the search goes on lol.....=P
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top