This is a link to the books script I am using:
http://www.rmxp.org/forums/showthread.php?t=1640&highlight=book
I have made and installed all of the books properly, and a member on my forum gave me a poem he wrote to use a test literature called "Give Me You". I want several random things like this to be a in a library in my game.
This is the call script I am using, as shown in the tutorial and book writer application:
$scene = Book_Event.new
("GiveMeYou","Book")
I have this set to an action button event, but everytime I use this event I get a syntax error ("SyntaxError occured while running script")
Here is the script I am using for reference so you don't have to download everything:
Any suggestions?
edit: I get this error not only on my game (which has custom scripts such as day/night and cms in) but on a game with no custom scripts at all.
http://www.rmxp.org/forums/showthread.php?t=1640&highlight=book
I have made and installed all of the books properly, and a member on my forum gave me a poem he wrote to use a test literature called "Give Me You". I want several random things like this to be a in a library in my game.
This is the call script I am using, as shown in the tutorial and book writer application:
$scene = Book_Event.new
("GiveMeYou","Book")
I have this set to an action button event, but everytime I use this event I get a syntax error ("SyntaxError occured while running script")
Here is the script I am using for reference so you don't have to download everything:
Code:
class Book_Event
attr_accessor :Open_Book_SE
attr_accessor :Close_Book_SE
attr_accessor :Prev_Page_SE
attr_accessor :Next_Page_SE
attr_accessor :Book_Image_BG
attr_accessor :Next_Page
attr_accessor :Prev_Page
attr_accessor :type
attr_accessor :page_number1
attr_accessor :page_number2
attr_accessor :Book_Font_Opacity
attr_accessor :Book_Overlay_BG
attr_accessor :regexp
attr_accessor :title_screen
attr_accessor :book_name
def initialize(book_name=empty,type=Book",opacity=255,title_screen=0)
$defaultfontsize = 14
$defaultfonttype = "Teletype"
$book_name = book_name
self.Open_Book_SE = "Audio/BGS/Books/Open_Book.wav"
self.Close_Book_SE = "Audio/BGS/Books/Close_Book.wav"
self.Prev_Page_SE = "Audio/BGS/Books/Prev_Page.wav"
self.Next_Page_SE = "Audio/BGS/Books/Next_Page.wav"
if type == "Book"
self.Book_Image_BG = "Book_Cover"
else
self.Book_Image_BG = type
end
self.Next_Page = "Next_Page"
self.Prev_Page = "Prev_Page"
$type = type
self.page_number1 = 1
self.page_number2 = 2
self.regexp = /bi_/
self.title_screen = title_screen
$opacity = opacity
if title_screen == 1
$Book_Font_Name = "FixedsysTTF"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Scroll"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Paper"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 22
else
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 18
end
$Book_Text_New = []
# Open our Book Image
@book_image = Sprite.new
@book_image.bitmap = RPG::Cache.picture("Book_Type/"+self.Book_Image_BG)
@book_image.x = 0
@book_image.y = 0
@book_image.z = 100
fname = "Data/Books/" + book_name + ".book"
if FileTest.exist?(fname)
f = File.open(fname)
$Book_Text = f.readlines
for line in 1...4
$Book_Text_New[line] = $Book_Text[line].chop
end
@True_Line = 5
for line in 5...$Book_Text.size
if line < $Book_Text.size-1
$Image_Text = $Book_Text[line].chop
elsif line == $Book_Text.size-1
$Image_Text1 = $Book_Text[line]
$Image_Text2 = $Image_Text1
$Image_Text2 = $Image_Text2.chop
match1 = self.regexp.match($Image_Text1)
match2 = self.regexp.match($Image_Text2)
if match1
$Image_Text = $Image_Text1
elsif match2
$Image_Text = $Image_Text2
else
$Image_Text = $Book_Text[line]
end
end
$Book_Text_New[@True_Line] = $Image_Text
@True_Line+=1
end
$Book_Text = $Book_Text_New
$pages = ($Book_Text.size/14)
if ($Book_Text.size%14) > 0
$pages+=1
end
if $type == "Scroll"
$start_line = -9
elsif $type == "Paper"
$start_line = -9
else
$start_line = -9
end
else
p "Error! #{fname} Doesn't exist."
end
end
def main
Audio.se_play(self.Open_Book_SE, 100, 100)
@Page1 = Page1.new
if $type == "Scroll"
@Page1.x =80
@Page1.y =90
@Page1.height = 450
@Page1.width = 450
elsif $type == "Paper"
@Page1.x =50
@Page1.y =50
@Page1.height = 450
@Page1.width = 550
else
@Page1.x =40
@Page1.y =20
@Page1.height = 450
@Page1.width = 280
end
@Page1.z = 200
@Page1.opacity = 0
@Page2 = Page2.new
@Page2.x =320
@Page2.y =20
@Page2.height = 450
@Page2.width = 290
@Page2.z = 200
@Page2.opacity = 0
@window4 = Book_Window_Command.new
@window4.x=70
@window4.y=370
@window4.height=64
@window4.width=500
@window4.index = 1
@window4.z = 300
@window4.opacity = 0
@window4.cursor_rect.set(0, 0, 0, 0)
@Page1.update(self.page_number1,self.page_number2,self.regexp)
@Page2.update(self.page_number1,self.page_number2,self.regexp)
#This is what makes the scene update itself constantly
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
# Close the windows afte ESC has been pressed
Graphics.freeze
@Page1.close
@Page1.dispose
@Page2.close
@Page2.dispose
@window4.dispose
@book_image.dispose
if @Book_Overlay
@Book_Overlay.dispose
end
if @book_image_0
@book_image_0.dispose
@book_image_0= nil
end
end
def update
@window4.update
if (self.page_number1 <= 1) && (self.page_number2 >= $pages) && (($type =="Scroll") || ($type == "Paper"))
elsif self.page_number2 >= $pages
if (self.page_number1 >1) && ($type !="Scroll") && ($type != "Paper")
@window4.index = 0
@window4.update
end
elsif self.page_number1 <= 1
if (self.page_number2 < $pages) && ($type !="Scroll") && ($type != "Paper")
@window4.index = 1
@window4.update
end
end
@window4.cursor_rect.set(0, 0, 0, 0)
if Input.repeat?(Input::LEFT)
prev_page
end
if Input.repeat?(Input::RIGHT)
next_page
end
if Input.trigger?(Input::B)
Audio.se_play(self.Close_Book_SE, 100, 100)
if self.title_screen == 0
$scene = Scene_Map.new
$game_map.autoplay
else
$scene = Scene_Title.new
return
end
end
if Input.trigger?(Input::C)
case @window4.index
when 0
prev_page
when 1
next_page
end
end
end
def prev_page
if (self.page_number1 == 1)
if ($type=="Scroll")
self.page_number1=1
self.page_number2=1
$start_line=-9
elsif ($type=="Paper")
self.page_number1=1
self.page_number1=1
$start_line=-9
else
self.page_number1=1
self.page_number2=2
$start_line=-9
end
elsif (self.page_number1 != 1) && ($type=="Scroll")
Audio.se_play(self.Prev_Page_SE, 100, 100)
self.page_number1-=1
self.page_number2-=1
$start_line-=14
elsif (self.page_number1 != 1) && ($type=="Paper")
Audio.se_play(self.Prev_Page_SE, 100, 100)
self.page_number1-=1
self.page_number2-=1
$start_line-=14
else
Audio.se_play(self.Prev_Page_SE, 100, 100)
if (page_number1 == 2)
self.Book_Image_BG = "Book_Cover"
@book_image.bitmap = RPG::Cache.picture("Book_Type/"+self.Book_Image_BG)
self.page_number1-=1
self.page_number2-=1
$start_line-=14
else
self.page_number1-=2
self.page_number2-=2
$start_line-=28
end
end
@Page1.update(self.page_number1,self.page_number2,self.regexp)
@Page2.update(self.page_number1,self.page_number2,self.regexp)
end
def next_page
if (self.page_number2 <= $pages)
if ($type=="Scroll")
Audio.se_play(self.Next_Page_SE, 100, 100)
self.page_number1+=1
self.page_number2+=1
$start_line+=14
elsif ($type == "Paper")
Audio.se_play(self.Next_Page_SE, 100, 100)
self.page_number1+=1
self.page_number2+=1
$start_line+=14
else
Audio.se_play(self.Next_Page_SE, 100, 100)
if (page_number1 == 1)
self.Book_Image_BG = "Book"
@book_image.bitmap = RPG::Cache.picture("Book_Type/"+self.Book_Image_BG)
self.page_number1+=1
self.page_number2+=1
$start_line+=14
else
self.page_number1+=2
self.page_number2+=2
$start_line+=28
end
end
end
@Page1.update(self.page_number1,self.page_number2,self.regexp)
@Page2.update(self.page_number1,self.page_number2,self.regexp)
end
end
#===================================================
# - CLASS Your_Scene Ends
#===================================================
#===================================================
# - CLASS Page1 Begins
#
# This window contains the text for the 2nd page of the book
#===================================================
class Page1 < Window_Base
def initialize
if ($type == "Scroll")
super(0, 0, 450,450)
elsif ($type == "Paper")
super(0,0,550,450)
else
super(0, 0, 280,450)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $Book_Font_Name
self.contents.font.size = $Book_Font_Size
self.contents.font.color = text_color($Book_Font_Color)
self.contents.clear
end
def update(page_number1,page_number2,regexp)
if @book_image_0
@book_image_0.dispose
@book_image_0= nil
end
if @book_image_1
@book_image_1.dispose
@book_image_1= nil
end
if @book_image_2
@book_image_2.dispose
@book_image_2= nil
end
if @book_image_3
@book_image_3.dispose
@book_image_3= nil
end
if @book_image_4
@book_image_4.dispose
@book_image_4= nil
end
if @book_image_5
@book_image_5.dispose
@book_image_5= nil
end
if @book_image_6
@book_image_6.dispose
@book_image_6= nil
end
if @book_image_7
@book_image_7.dispose
@book_image_7= nil
end
if @book_image_8
@book_image_8.dispose
@book_image_8= nil
end
if @book_image_9
@book_image_9.dispose
@book_image_9= nil
end
if @book_image_10
@book_image_10.dispose
@book_image_10= nil
end
if @book_image_11
@book_image_11.dispose
@book_image_11= nil
end
if @book_image_12
@book_image_12.dispose
@book_image_12= nil
end
if @book_image_13
@book_image_13.dispose
@book_image_13= nil
end
if @book_image_14
@book_image_14.dispose
@book_image_14= nil
end
self.contents.clear
if (page_number1 == 1)
if ($type != "Book")
if $type == "Scroll"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Paper"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 22
else
$Book_Font_Color = 9
$Book_Font_Name = "FixedsysTTF"
$Book_Font_Size = 16
end
self.contents.font.size = $Book_Font_Size
self.contents.font.name = $Book_Font_Name
self.contents.font.color = text_color($Book_Font_Color)
mby=0
for line in 1...4
if $Book_Text[line] != nil
$Image_Text = $Book_Text[line]
match = regexp.match($Image_Text)
if match && ($Image_Text != "bi_blank")
@book_image_0 = Sprite.new
@book_image_0.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_0.x = 110
@book_image_0.y = 180
elsif $type == "Paper"
@book_image_0.x = 65
@book_image_0.y = 130
else
@book_image_0.x = 70
@book_image_0.y = 120
end
@book_image_0.opacity = $opacity
@book_image_0.z = 500
elsif ($Image_Text != "bi_blank")
if ($type == "Scroll")
self.contents.draw_text(25, mby+15, 450, mby+30, $Book_Text[line])
elsif ($type == "Paper")
self.contents.draw_text(10, mby+15, 600, mby+30, $Book_Text[line])
else
self.contents.draw_text(5, mby+15, 250, mby+30, $Book_Text[line])
end
end
end
mby+=15
end
end
else
if $type == "Scroll"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Paper"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 22
else
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 18
end
self.contents.font.size = $Book_Font_Size
self.contents.font.name = $Book_Font_Name
self.contents.font.color = text_color($Book_Font_Color)
mby=0
for line in $start_line...$start_line+14
if $Book_Text[line] != nil
$Image_Text = $Book_Text[line]
match = regexp.match($Image_Text)
if match
if not @book_image_1
@book_image_1 = Sprite.new
@book_image_1.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_1.x = 110
@book_image_1.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_1.x = 65
@book_image_1.y = ((mby/15)*23)+65
else
@book_image_1.x = 70
@book_image_1.y = ((mby/15)*22.5)+55
end
@book_image_1.opacity = $opacity
@book_image_1.z = 500
elsif not @book_image_2
@book_image_2 = Sprite.new
@book_image_2.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_2.x = 110
@book_image_2.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_2.x = 65
@book_image_2.y = ((mby/15)*23)+65
else
@book_image_2.x = 70
@book_image_2.y = ((mby/15)*22.5)+55
end
@book_image_2.opacity = $opacity
@book_image_2.z = 500
elsif not @book_image_3
@book_image_3 = Sprite.new
@book_image_3.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_3.x = 110
@book_image_3.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_3.x = 65
@book_image_3.y = ((mby/15)*23)+65
else
@book_image_3.x = 70
@book_image_3.y = ((mby/15)*22.5)+55
end
@book_image_3.opacity = $opacity
@book_image_3.z = 500
elsif not @book_image_4
@book_image_4 = Sprite.new
@book_image_4.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_4.x = 110
@book_image_4.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_4.x = 65
@book_image_4.y = ((mby/15)*23)+65
else
@book_image_4.x = 70
@book_image_4.y = ((mby/15)*22.5)+55
end
@book_image_4.opacity = $opacity
@book_image_4.z = 500
elsif not @book_image_5
@book_image_5 = Sprite.new
@book_image_5.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_5.x = 110
@book_image_5.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_5.x = 65
@book_image_5.y = ((mby/15)*23)+65
else
@book_image_5.x = 70
@book_image_5.y = ((mby/15)*22.5)+55
end
@book_image_5.opacity = $opacity
@book_image_5.z = 500
elsif not @book_image_6
@book_image_6 = Sprite.new
@book_image_6.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_6.x = 110
@book_image_6.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_6.x = 65
@book_image_6.y = ((mby/15)*23)+65
else
@book_image_6.x = 70
@book_image_6.y = ((mby/15)*22.5)+55
end
@book_image_6.opacity = $opacity
@book_image_6.z = 500
elsif not @book_image_7
@book_image_7 = Sprite.new
@book_image_7.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_7.x = 110
@book_image_7.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_7.x = 65
@book_image_7.y = ((mby/15)*23)+65
else
@book_image_7.x = 70
@book_image_7.y = ((mby/15)*22.5)+55
end
@book_image_7.opacity = $opacity
@book_image_7.z = 500
elsif not @book_image_8
@book_image_8 = Sprite.new
@book_image_8.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_8.x = 110
@book_image_8.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_8.x = 65
@book_image_8.y = ((mby/15)*23)+65
else
@book_image_8.x = 70
@book_image_8.y = ((mby/15)*22.5)+55
end
@book_image_8.opacity = $opacity
@book_image_8.z = 500
elsif not @book_image_9
@book_image_9 = Sprite.new
@book_image_9.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_9.x = 110
@book_image_9.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_9.x = 65
@book_image_9.y = ((mby/15)*23)+65
else
@book_image_9.x = 70
@book_image_9.y = ((mby/15)*22.5)+55
end
@book_image_9.opacity = $opacity
@book_image_9.z = 500
elsif not @book_image_10
@book_image_10 = Sprite.new
@book_image_10.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_10.x = 110
@book_image_10.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_10.x = 65
@book_image_10.y = ((mby/15)*23)+65
else
@book_image_10.x = 70
@book_image_10.y = ((mby/15)*22.5)+55
end
@book_image_10.opacity = $opacity
@book_image_10.z = 500
elsif not @book_image_11
@book_image_11 = Sprite.new
@book_image_11.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_11.x = 110
@book_image_11.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_11.x = 65
@book_image_11.y = ((mby/15)*23)+65
else
@book_image_11.x = 70
@book_image_11.y = ((mby/15)*22.5)+55
end
@book_image_11.opacity = $opacity
@book_image_11.z = 500
elsif not @book_image_12
@book_image_12 = Sprite.new
@book_image_12.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_12.x = 110
@book_image_12.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_12.x = 65
@book_image_12.y = ((mby/15)*23)+65
else
@book_image_12.x = 70
@book_image_12.y = ((mby/15)*22.5)+55
end
@book_image_12.opacity = $opacity
@book_image_12.z = 500
elsif not @book_image_13
@book_image_13 = Sprite.new
@book_image_13.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_13.x = 110
@book_image_13.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_13.x = 65
@book_image_13.y = ((mby/15)*23)+65
else
@book_image_13.x = 70
@book_image_13.y = ((mby/15)*22.5)+55
end
@book_image_13.opacity = $opacity
@book_image_13.z = 500
elsif not @book_image_14
@book_image_14 = Sprite.new
@book_image_14.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_14.x = 110
@book_image_14.y = ((mby/15)*23)+100
elsif $type == "Paper"
@book_image_14.x = 65
@book_image_14.y = ((mby/15)*23)+65
else
@book_image_14.x = 70
@book_image_14.y = ((mby/15)*22.5)+55
end
@book_image_14.opacity = $opacity
@book_image_14.z = 500
end
else
$Book_Text_Check=$Book_Text[line]
if not (line == $start_line) && ($Book_Text_Check == "")
if ($type=="Scroll")
self.contents.draw_text(25, mby, 450, mby+15, $Book_Text[line])
elsif ($type == "Paper")
self.contents.draw_text(10, mby, 600, mby+20, $Book_Text[line])
else
self.contents.draw_text(5, mby+15, 240, mby+30, $Book_Text[line])
end
end
end
mby+=15
end
if (line == ($start_line+13)) && ($type != "Scroll") && ($type != "Paper")
temp_page = page_number1 - 1
self.contents.draw_text(90, 240, 140, 255, temp_page.to_s)
end
end
end
end
def close
if @book_image_0
@book_image_0.dispose
@book_image_0= nil
end
if @book_image_1
@book_image_1.dispose
@book_image_1= nil
end
if @book_image_2
@book_image_2.dispose
@book_image_2= nil
end
if @book_image_3
@book_image_3.dispose
@book_image_3= nil
end
if @book_image_4
@book_image_4.dispose
@book_image_4= nil
end
if @book_image_5
@book_image_5.dispose
@book_image_5= nil
end
if @book_image_6
@book_image_6.dispose
@book_image_6= nil
end
if @book_image_7
@book_image_7.dispose
@book_image_7= nil
end
if @book_image_8
@book_image_8.dispose
@book_image_8= nil
end
if @book_image_9
@book_image_9.dispose
@book_image_9= nil
end
if @book_image_10
@book_image_10.dispose
@book_image_10= nil
end
if @book_image_11
@book_image_11.dispose
@book_image_11= nil
end
if @book_image_12
@book_image_12.dispose
@book_image_12= nil
end
if @book_image_13
@book_image_13.dispose
@book_image_13= nil
end
if @book_image_14
@book_image_14.dispose
@book_image_14= nil
end
end
end
#===================================================
# - CLASS Page1 Ends
#===================================================
#===================================================
# - CLASS Page2 Begins
#
# This window contains the text for the 2nd page of the book
#===================================================
class Page2 < Window_Base
def initialize
super(0, 0, 290,450)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $Book_Font_Name
self.contents.font.size = $Book_Font_Size
self.contents.font.color = text_color($Book_Font_Color)
self.contents.clear
end
def update(page_number1,page_number2,regexp)
if @book_image_0
@book_image_0.dispose
@book_image_0 = nil
end
if @book_image_15
@book_image_15.dispose
@book_image_15 = nil
end
if @book_image_16
@book_image_16.dispose
@book_image_16 = nil
end
if @book_image_17
@book_image_17.dispose
@book_image_17 = nil
end
if @book_image_18
@book_image_18.dispose
@book_image_18 = nil
end
if @book_image_19
@book_image_19.dispose
@book_image_19 = nil
end
if @book_image_20
@book_image_20.dispose
@book_image_20 = nil
end
if @book_image_21
@book_image_21.dispose
@book_image_21 = nil
end
if @book_image_22
@book_image_22.dispose
@book_image_22 = nil
end
if @book_image_23
@book_image_23.dispose
@book_image_23 = nil
end
if @book_image_24
@book_image_24.dispose
@book_image_24 = nil
end
if @book_image_25
@book_image_25.dispose
@book_image_25 = nil
end
if @book_image_26
@book_image_26.dispose
@book_image_26 = nil
end
if @book_image_27
@book_image_27.dispose
@book_image_27 = nil
end
if @book_image_28
@book_image_28.dispose
@book_image_28 = nil
end
self.contents.clear
if (page_number1 == 1) && ($type=="Book")
if $type == "Scroll"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Paper"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 22
else
$Book_Font_Color = 9
$Book_Font_Name = "FixedsysTTF"
$Book_Font_Size = 16
end
self.contents.font.size = $Book_Font_Size
self.contents.font.name = $Book_Font_Name
self.contents.font.color = text_color($Book_Font_Color)
mby=0
for line in 1...4
if $Book_Text[line] != nil
$Image_Text = $Book_Text[line]
match = regexp.match($Image_Text)
if match && ($Image_Text != "bi_blank")
@book_image_0 = Sprite.new
@book_image_0.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
if $type == "Scroll"
@book_image_0.x = 110
@book_image_0.y = 180
elsif $type == "Paper"
@book_image_0.x = 65
@book_image_0.y = 130
else
@book_image_0.x = 320
@book_image_0.y = 100
end
@book_image_0.opacity = $opacity
@book_image_0.z = 500
elsif ($Image_Text != "bi_blank")
if ($type == "Scroll")
self.contents.draw_text(25, mby+15, 450, mby+30, $Book_Text[line])
elsif ($type == "Paper")
self.contents.draw_text(10, mby+15, 600, mby+30, $Book_Text[line])
else
self.contents.draw_text(5, mby+15, 250, mby+30, $Book_Text[line])
end
end
end
mby+=15
end
else
if $type == "Scroll"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 16
elsif $type == "Paper"
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Color = 8
$Book_Font_Size = 22
else
$Book_Font_Color = 8
$Book_Font_Name = "Comic Sans MS"
$Book_Font_Size = 22
end
self.contents.font.size = $Book_Font_Size
self.contents.font.name = $Book_Font_Name
self.contents.font.color = text_color($Book_Font_Color)
mby=0
for line in ($start_line+14)...($start_line+28)
if $Book_Text[line] != nil
$Image_Text = $Book_Text[line]
match = regexp.match($Image_Text)
if match && ($type != "Scroll") && ($type != "Paper")
if not @book_image_15
@book_image_15 = Sprite.new
@book_image_15.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_15.x = 350
@book_image_15.y = ((mby/15)*22.5)+55
@book_image_15.opacity = $opacity
@book_image_15.z = 500
elsif not @book_image_16
@book_image_16 = Sprite.new
@book_image_16.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_16.x = 350
@book_image_16.y = ((mby/15)*22.5)+55
@book_image_16.opacity = $opacity
@book_image_16.z = 500
elsif not @book_image_17
@book_image_17 = Sprite.new
@book_image_17.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_17.x = 350
@book_image_17.y = ((mby/15)*22.5)+55
@book_image_17.opacity = $opacity
@book_image_17.z = 500
elsif not @book_image_18
@book_image_18 = Sprite.new
@book_image_18.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_18.x = 350
@book_image_18.y = ((mby/15)*22.5)+55
@book_image_18.opacity = $opacity
@book_image_18.z = 500
elsif not @book_image_19
@book_image_19 = Sprite.new
@book_image_19.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_19.x = 350
@book_image_19.y = ((mby/15)*22.5)+55
@book_image_19.opacity = $opacity
@book_image_19.z = 500
elsif not @book_image_20
@book_image_20 = Sprite.new
@book_image_20.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_20.x = 350
@book_image_20.y = ((mby/15)*22.5)+55
@book_image_20.opacity = $opacity
@book_image_20.z = 500
elsif not @book_image_21
@book_image_21 = Sprite.new
@book_image_21.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_21.x = 350
@book_image_21.y = ((mby/15)*22.5)+55
@book_image_21.opacity = $opacity
@book_image_21.z = 500
elsif not @book_image_22
@book_image_22 = Sprite.new
@book_image_22.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_22.x = 350
@book_image_22.y = ((mby/15)*22.5)+55
@book_image_22.opacity = $opacity
@book_image_22.z = 500
elsif not @book_image_23
@book_image_23 = Sprite.new
@book_image_23.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_23.x = 350
@book_image_23.y = ((mby/15)*22.5)+55
@book_image_23.opacity = $opacity
@book_image_23.z = 500
elsif not @book_image_24
@book_image_24 = Sprite.new
@book_image_24.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_24.x = 350
@book_image_24.y = ((mby/15)*22.5)+55
@book_image_24.opacity = $opacity
@book_image_24.z = 500
elsif not @book_image_25
@book_image_25 = Sprite.new
@book_image_25.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_25.x = 350
@book_image_25.y = ((mby/15)*22.5)+55
@book_image_25.opacity = $opacity
@book_image_25.z = 500
elsif not @book_image_26
@book_image_26 = Sprite.new
@book_image_26.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_26.x = 350
@book_image_26.y = ((mby/15)*22.5)+55
@book_image_26.opacity = $opacity
@book_image_26.z = 500
elsif not @book_image_27
@book_image_27 = Sprite.new
@book_image_27.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_27.x = 350
@book_image_27.y = ((mby/15)*22.5)+55
@book_image_27.opacity = $opacity
@book_image_27.z = 500
elsif not @book_image_28
@book_image_28 = Sprite.new
@book_image_28.bitmap = RPG::Cache.picture("Books/"+$book_name+"/"+$Image_Text)
@book_image_28.x = 350
@book_image_28.y = ((mby/15)*22.5)+55
@book_image_28.opacity = $opacity
@book_image_28.z = 500
end
else
if ($type != "Scroll") && ($type != "Paper")
self.contents.draw_text(5, mby+15, 250, mby+30, $Book_Text[line])
end
end
mby+=15
end
end
if (line == ($start_line+27)) && ($type != "Scroll") && ($type != "Paper")
temp_page = page_number2 - 1
self.contents.draw_text(120, 240, 180, 255, temp_page.to_s)
end
end
end
def close
if @book_image_0
@book_image_0.dispose
@book_image_0= nil
end
if @book_image_15
@book_image_15.dispose
@book_image_15 = nil
end
if @book_image_16
@book_image_16.dispose
@book_image_16 = nil
end
if @book_image_17
@book_image_17.dispose
@book_image_17 = nil
end
if @book_image_18
@book_image_18.dispose
@book_image_18 = nil
end
if @book_image_19
@book_image_19.dispose
@book_image_19 = nil
end
if @book_image_20
@book_image_20.dispose
@book_image_20 = nil
end
if @book_image_21
@book_image_21.dispose
@book_image_21 = nil
end
if @book_image_22
@book_image_22.dispose
@book_image_22 = nil
end
if @book_image_23
@book_image_23.dispose
@book_image_23 = nil
end
if @book_image_24
@book_image_24.dispose
@book_image_24 = nil
end
if @book_image_25
@book_image_25.dispose
@book_image_25 = nil
end
if @book_image_26
@book_image_26.dispose
@book_image_26 = nil
end
if @book_image_27
@book_image_27.dispose
@book_image_27 = nil
end
if @book_image_28
@book_image_28.dispose
@book_image_28 = nil
end
end
end
#===================================================
# - CLASS Page2 Ends
#===================================================
#===================================================
# - CLASS Book_Window_Command Starts
#
# This is a modified section of the original Window_ShopCommand script. It has been
# stripped down and modified to use only the "Prev" and "Next" functions. Even though
# the @commands has items in it, they are not shown. This is not required since this
# script uses pictures to show the selection for page flipping.
#===================================================
class Book_Window_Command < Window_Selectable
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 2
@column_max = 2
@commands = ["Prev", "Next]
self.index = 0
end
end
#===================================================
# - CLASS Book_Window_Command Ends
#===================================================
Any suggestions?
edit: I get this error not only on my game (which has custom scripts such as day/night and cms in) but on a game with no custom scripts at all.