I have a problem with a really easy script :-[...
This is what I have so far, it is to show a location image, fade it in, then fade it out again.
The first error is that it whizzes straight through them without waiting at all, so the player sees nothing. (I tested this by adding p 'test' at the start and finish).
The second error is a strange one. I had to edit out locationsp.dispose as it gets an error with the MACL...
Script MACL line 2762, RGSS error occurred
disposed sprite
Line 2762 is the following:
(What's weird is the error is on a commented out line... isn't the RGSS player supposed to ignore lines commented out? Otherwise what's the point?)
This is what I have so far, it is to show a location image, fade it in, then fade it out again.
Code:
def show_location(location)
@location = location
@locationsp = Sprite.new
@locationsp.bitmap = RPG::Cache.area(location + ".png")
@locationsp.z = 9999
@locationsp.opacity = 0
@locationsp.update
@wait_count = 4
@locationsp.opacity += 50
@locationsp.update
@wait_count = 4
@locationsp.opacity += 50
@locationsp.update
@wait_count = 4
@locationsp.opacity += 50
@locationsp.update
@wait_count = 4
@locationsp.opacity += 50
@locationsp.update
@wait_count = 4
@locationsp.opacity += 55
@locationsp.update
@wait_count = 20
@locationsp.opacity -= 55
@locationsp.update
@wait_count = 4
@locationsp.opacity -= 50
@locationsp.update
@wait_count = 4
@locationsp.opacity -= 50
@locationsp.update
@wait_count = 4
@locationsp.opacity -= 50
@locationsp.update
@wait_count = 4
@locationsp.opacity = 0
@locationsp.update
#@locationsp.dispose
end
The first error is that it whizzes straight through them without waiting at all, so the player sees nothing. (I tested this by adding p 'test' at the start and finish).
The second error is a strange one. I had to edit out locationsp.dispose as it gets an error with the MACL...
Script MACL line 2762, RGSS error occurred
disposed sprite
Line 2762 is the following:
Code:
def draw_trick_function_bar(x, y, width, height, function, current, max,
start = Color.new(0,0,0), finish = Color.new(0,0,0),
back = Color.new(0,0,0))
# Get Change in Colors
chred, chblue = finish.red - start.red, finish.blue - start.blue
chgreen, chalpha = finish.green - start.green, finish.alpha - start.alpha
# Draw Background
radius = height / 2
# Setup Values Array
values = []
# Draw Rectangle Center
fill_rect(x + radius, y, width - height, height, back)
# Draws Ends
(radius + 1).times do |x1|
# Get Parameter
t = radius - x1
# Get Y
y1 = function.call(radius, t).round
# Get Height
h = 2 * y1
# Draw Line of Back Color at Left Edge
fill_rect(x + x1, y - y1 + radius, 1, h, back)
# Draw Line of Back Color at Right Edge
fill_rect(x + width - x1, y - y1 + radius, 1, h, back)
end
# Get Percentage
percentage = current / max.to_f
# Return if not a finite number
return if not percentage.finite?
# Decrease Width and Height increase x and y
width -= 4
height -= 4
x += 2
y += 2
# Get new Radius
radius = height / 2
# Get Bar Width
barwidth = width * percentage
# Draws Left End
(radius + 1).times do |x1|
# Stop if Past Width
break if x1 > barwidth
# Get T (Parameter)
t = radius - x1
# Get Width Change
chwidth = x1
# Get Colors
red = start.red + chred * chwidth / width
green = start.green + chgreen * chwidth / width
blue = start.blue + chblue * chwidth / width
alpha = start.alpha + chalpha * chwidth / width
# Get Y
y1 = function.call(radius, t).round
# Push onto Values
values << y1
# Get Height
h = 2 * y1
# Get Color
color = Color.new(red, green, blue, alpha) if alpha != 255
color = Color.new(red, green, blue) if alpha == 255
# Draw Line
fill_rect(x + x1, y - y1 + radius, 1, h, color)
end
# Run From Radius upto Rectangles End
(width - height + 1).times do |t|
------->>># Get X1<<<<<<--------------------------------------------- THIS LINE
x1 = t + radius
# Break if Past Width
break if x1 > barwidth
# Get Width Change
chwidth = x1
# Get Colors
red = start.red + chred * chwidth / width
green = start.green + chgreen * chwidth / width
blue = start.blue + chblue * chwidth / width
alpha = start.alpha + chalpha * chwidth / width
# Get Color
color = Color.new(red, green, blue, alpha) if alpha != 255
color = Color.new(red, green, blue) if alpha == 255
# Draw Line
fill_rect(x + x1, y, 1, height, color)
end
# Draws Right End
radius.times do |t|
# Get X
x1 = width - radius + t
# Stop if Past Width
break if x1 > barwidth
# Get Width Change
chwidth = x1
# Get Colors
red = start.red + chred * chwidth / width
green = start.green + chgreen * chwidth / width
blue = start.blue + chblue * chwidth / width
alpha = start.alpha + chalpha * chwidth / width
# Get Y
y1 = values[radius-t]
# Get Height
h = 2 * y1
# Get Color
color = Color.new(red, green, blue, alpha) if alpha != 255
color = Color.new(red, green, blue) if alpha == 255
# Draw Line
fill_rect(x + x1, y - y1 + radius, 1, h, color)
end
end
(What's weird is the error is on a commented out line... isn't the RGSS player supposed to ignore lines commented out? Otherwise what's the point?)