Hi, I'm new to scripting but have been picking up a few things here and there. I am trying to modify game_guy's quest log system just by moving a couple window spaces around and making it so I can add longer quest names without them being all crunched up on the left side.
I pretty much don't know what I'm doing beyond having found the correct variable to change the window width, but now it conflicts with the larger menu when you open the quest description. If somebody could help with maybe a way to make the text wrap when you open the full quest description, so you can have the longer quest name at full length when you call the quest screen, but then when you choose the specific quest, the text wraps to fit into that left 1/3 of the screen?
If you see where I changed the window variable from 160 I think it was to 320. That's all I modified of the original script besides adding the first quest in with this picture [spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fwww.theneonheart.com%2Fimages%2Fzencover1.jpg&hash=5064abf8dbe99fc1030bb831dde3cea48e2bf939)[/spoiler]. Any help would be appreciated. Especially if you can explain how you did it. I'm trying to learn more about coding, any little piece at a time.
#===============================================================================
# Quest Log System
# Author game_guy
# Version 3.0
#-------------------------------------------------------------------------------
# Intro:
# A script that keeps track of quests you obtain and complete.
#
# Features:
# Marks quest names with a yellow color if they're completed
# Easy to setup one quest
# Be able to use a fairly long description
# Be able to display a picture
# Easy to add and complete a quest
# More compatible than earlier versions
#
# Instructions:
# Scroll down a bit until you see # Being Config. Follow the instructions there.
# Scroll below that and you'll see Begin Quest Setup. Follow the steps there.
#
# Script Calls:
# Quest.add(id) ~ Adds the quest(id) to the parties quests.
# Quest.take(id) ~ Takes the quest(id) from the party.
# Quest.complete(id) ~ Makes the quest(id) completed.
# Quest.completed?(id) ~ Returns true if the quest(id) is completed.
# Quest.has?(id) ~ Returns true if the party has quest(id).
#
# Credits:
# game_guy ~ for making it
# Beta Testers ~ Sally and Landith
# Blizzard ~ Small piece of code I borrowed from his bestiary
#===============================================================================
module GameGuy
#==================================================
# Begin Config
# UsePicture ~ true means it'll show pictures in
# the quests, false it wont.
#==================================================
UsePicture = true
def self.qreward(id)
case id
#==================================================
# Quest Reward
# Use when x then return "Reward"
# x = id, Reward = reward in quotes
#==================================================
when 1 then return "Wisdom about Technology from Biker"
when 2 then return "3 Potions"
when 3 then return "Strength Ring"
end
return "????"
end
def self.qpicture(id)
case id
#==================================================
# Quest Picture
# Use when x then return "picture"
# x = id, picture = picture name in quotes
#==================================================
when 1 then return ""
end
return nil
end
def self.qname(id)
case id
#==================================================
# Quest Name
# Use when x then return "name"
# x = id, name = quest name in quotes
#==================================================
when 1 then return "Zen and the Art of Motorcycle Maintainance"
when 2 then return "Pay Tab"
when 3 then return "Hunting Knife"
end
return ""
end
def self.qlocation(id)
case id
#==================================================
# Quest Location
# Use when x then return "location"
# x = id, location = location in quotes
#==================================================
when 1 then return "Streets of Lawrence"
when 2 then return "Eeka"
when 3 then return "Eeka"
end
return "????"
end
def self.qdescription(id)
case id
#==================================================
# Quest Description
# Use when x then return "description"
# x = id, description = quest description in quotes
#==================================================
when 1 then return "Find copy of 'Zen' book."
when 2 then return "Bring gold to Jarns Defense to pay her tab."
when 3 then return "Go get Kip a hunting knife from Eeka."
end
return ""
end
end
module Quest
def self.add(id)
$game_party.add_quest(id)
end
def self.take(id)
$game_party.take_quest(id)
end
def self.complete(id)
$game_party.complete(id)
end
def self.completed?(id)
return $game_party.completed?(id)
end
def self.has?(id)
return $game_party.has_quest?(id)
end
end
class Game_Party
attr_accessor :quests
attr_accessor :completed
alias gg_quests_lat initialize
def initialize
@quests = []
@completed = []
gg_quests_lat
end
def add_quest(id)
unless @quests.include?(id)
@quests.push(id)
end
end
def completed?(id)
return @completed.include?(id)
end
def complete(id)
unless @completed.include?(id)
if @quests.include?(id)
@completed.push(id)
end
end
end
def has_quest?(id)
return @quests.include?(id)
end
def take_quest(id)
@quests.delete(id)
@completed.delete(id)
end
end
class Scene_Quest
def main
@quests = []
for i in $game_party.quests
@quests.push(GameGuy.qname(i))
end
@map = Spriteset_Map.new
@quests2 = []
for i in $game_party.quests
@quests2.push(i)
end
@quests.push("No Quests") if @quests.size < 1
@quests_window = Window_Command.new(320, @quests)
@quests_window.height = 480
@quests_window.back_opacity = 110
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@quests_window.dispose
@quest_info.dispose if @quest_info != nil
@map.dispose
end
def update
@quests_window.update
if @quests_window.active
update_quests
return
end
if @quest_info != nil
update_info
return
end
end
def update_quests
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@quest_info = Window_QuestInfo.new(@quests2[@quests_window.index])
@quest_info.back_opacity = 110
@quests_window.active = false
return
end
end
def update_info
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@quests_window.active = true
@quest_info.dispose
@quest_info = nil
return
end
end
end
class Window_QuestInfo < Window_Base
def initialize(quest)
super(160, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@quest = quest
refresh
end
def refresh
self.contents.clear
if GameGuy::UsePicture
pic = GameGuy.qpicture(@quest)
bitmap = RPG::Cache.picture(GameGuy.qpicture(@quest)) if pic != nil
rect = Rect.new(0, 0, bitmap.width, bitmap.height) if pic != nil
self.contents.blt(480-bitmap.width-32, 0, bitmap, rect) if pic != nil
end
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 480, 32, "Quest:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32, 480, 32, GameGuy.qname(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 64, 480, 32, "Reward:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 96, 480, 32, GameGuy.qreward(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 128, 480, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 160, 480, 32, GameGuy.qlocation(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 192, 480, 32, "Completion:")
self.contents.font.color = normal_color
if $game_party.completed.include?(@quest)
self.contents.font.color = crisis_color
self.contents.draw_text(0, 224, 480, 32, "Completed")
else
self.contents.font.color = normal_color
self.contents.draw_text(0, 224, 480, 32, "In Progress")
end
self.contents.font.color = system_color
self.contents.draw_text(0, 256, 480, 32, "Description:")
self.contents.font.color = normal_color
text = self.contents.slice_text(GameGuy.qdescription(@quest), 480)
text.each_index {|i|
self.contents.draw_text(0, 288 + i*32, 480, 32, text[i])}
end
end
class Bitmap
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
I am not using XP, but if you'd post a screenshot it could maybe get me a clearer vision of what's going on here ???
So far all I've changed is this line, where I've changed it to read 320 instead of what it used to read, 160: @quests_window = Window_Command.new(320, @quests)
and thus when you open the quest window it looks like this, taking up half the screen rather than 1/4:
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fwww.theneonheart.com%2Fimages%2Fquests1.png&hash=bd9dd3f099e21837caa56cb32336711bd138416d)[/spoiler]
which conflicts when you open the specific quest by overlapping like so:
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fwww.theneonheart.com%2Fimages%2Fquests2.png&hash=94ae573084b9561a049ce81f27200340e28e8da6)[/spoiler]
and I wanted to fix the second part when you open the specific quest by maybe wrapping the longer text so it fits back in the 160 allotted portion of the screen. But then it would have to wrap all the quests that would gather in that side of the window the same as you get a couple of quests stacked up in there.
Does this explain it better?
Ah, that's much more preferable :) I'm gonna modify this right away in VX and get back here as quick as I can.
Alright, so this was slightly a bit more inconvenient than I thought it'd be :/, most of all because when I got it to work in VX and went to look up some RMXP documents on the web, I had to redefine almost everything, lol :P *facepalm*
Anyways, here's the whole thing. Hopefully it'll resolve the problem you're having, wrapping up the text and display it where you want it to, aswell as resizing the window's width as necessary;
** EDITED **
#===============================================================================
# Quest Log System
# Author game_guy
# Version 3.0
#~
# Modified by Mangomight
# 2012-11-08
#-------------------------------------------------------------------------------
# Intro:
# A script that keeps track of quests you obtain and complete.
#
# Features:
# Marks quest names with a yellow color if they're completed
# Easy to setup one quest
# Be able to use a fairly long description
# Be able to display a picture
# Easy to add and complete a quest
# More compatible than earlier versions
#
# Instructions:
# Scroll down a bit until you see # Being Config. Follow the instructions there.
# Scroll below that and you'll see Begin Quest Setup. Follow the steps there.
#
# Script Calls:
# Quest.add(id) ~ Adds the quest(id) to the parties quests.
# Quest.take(id) ~ Takes the quest(id) from the party.
# Quest.complete(id) ~ Makes the quest(id) completed.
# Quest.completed?(id) ~ Returns true if the quest(id) is completed.
# Quest.has?(id) ~ Returns true if the party has quest(id).
#
# Credits:
# game_guy ~ for making it
# Beta Testers ~ Sally and Landith
# Blizzard ~ Small piece of code I borrowed from his bestiary
#===============================================================================
module GameGuy
#==================================================
# Begin Config
# UsePicture ~ true means it'll show pictures in
# the quests, false it wont.
#==================================================
UsePicture = true
def self.qreward(id)
case id
#==================================================
# Quest Reward
# Use when x then return "Reward"
# x = id, Reward = reward in quotes
#==================================================
when 1 then return "Wisdom about Technology from Biker"
when 2 then return "3 Potions"
when 3 then return "Strength Ring"
end
return "????"
end
def self.qpicture(id)
case id
#==================================================
# Quest Picture
# Use when x then return "picture"
# x = id, picture = picture name in quotes
#==================================================
when 1 then return ""
end
return nil
end
def self.qname(id)
case id
#==================================================
# Quest Name
# Use when x then return "name"
# x = id, name = quest name in quotes
#==================================================
when 1 then return "Zen and the Art of Motorcycle Maintainance"
when 2 then return "Pay Tab"
when 3 then return "Hunting Knife"
end
return ""
end
def self.qlocation(id)
case id
#==================================================
# Quest Location
# Use when x then return "location"
# x = id, location = location in quotes
#==================================================
when 1 then return "Streets of Lawrence"
when 2 then return "Eeka"
when 3 then return "Eeka"
end
return "????"
end
def self.qdescription(id)
case id
#==================================================
# Quest Description
# Use when x then return "description"
# x = id, description = quest description in quotes
#==================================================
when 1 then return "Find copy of 'Zen' book."
when 2 then return "Bring gold to Jarns Defense to pay her tab"
when 3 then return "Go get Kip a hunting knife from Eeka."
end
return ""
end
end
module Quest
def self.add(id)
$game_party.add_quest(id)
end
def self.take(id)
$game_party.take_quest(id)
end
def self.complete(id)
$game_party.complete(id)
end
def self.completed?(id)
return $game_party.completed?(id)
end
def self.has?(id)
return $game_party.has_quest?(id)
end
end
class Game_Party
attr_accessor :quests
attr_accessor :completed
alias gg_quests_lat initialize
def initialize
@quests = []
@completed = []
gg_quests_lat
end
def add_quest(id)
unless @quests.include?(id)
@quests.push(id)
end
end
def completed?(id)
return @completed.include?(id)
end
def complete(id)
unless @completed.include?(id)
if @quests.include?(id)
@completed.push(id)
end
end
end
def has_quest?(id)
return @quests.include?(id)
end
def take_quest(id)
@quests.delete(id)
@completed.delete(id)
end
end
#==============================================================================
# ** Scene_Quest
#------------------------------------------------------------------------------
# This class performs Quest screen processing.
#==============================================================================
class Scene_Quest
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Main Processing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def main
@quests = []
@text = []
for i in $game_party.quests
@quests.push(GameGuy.qname(i))
end
@map = Spriteset_Map.new
@quests2 = []
for i in $game_party.quests
@quests2.push(i)
end
@quests.push("No Quests") if @quests.size < 1
@quests_window = Window_Command.new(320, @quests)
@quests_window.height = 480
@quests_window.back_opacity = 110
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@quests_window.dispose
@quest_info.dispose if @quest_info
@map.dispose
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Resize Window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def resize_window(width = 160)
# Can create this window only once
return if @window_exist
@text.clear
@quests_window.dispose
bmp = Bitmap.new(width, 32)
@quests.each { |i| @text.push (bmp.slice_text(i, width)) }
@quests_window = Window_Command.new(width, @text)
@quests_window.height = 480
@window_exist = true
bmp.dispose
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Frame Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update
@quests_window.update
if !@text.empty?
@quests_window.cursor_height = @text[@quests_window.index].size
@quests_window.last_index = @text[@quests_window.index-1].size
end
if @quests_window.active
update_quests
return
end
if @quest_info != nil
update_info
return
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Quests
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_quests
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
@quest_info = Window_QuestInfo.new(@quests2[@quests_window.index])
@quest_info.back_opacity = 110
@quests_window.active = false
resize_window
return
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Cache Window
# array : holds the cached window
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def cache_window(items)
@array = [] if @array == nil
return @quest_info if @array.include?(items)
@quest_info.dispose if @quest_info != nil
@array.replace([items])
return Window_QuestInfo.new(items)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Info
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_info
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
@quests_window.active = true
@quest_info.dispose
@quest_info = nil
return
end
end
end
#==============================================================================
# ** Window_QuestInfo
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays information about quests.
#==============================================================================
class Window_QuestInfo < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initializiation
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(quest)
super(160, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@quest = quest
refresh
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh
self.contents.clear
if GameGuy::UsePicture
pic = GameGuy.qpicture(@quest)
bitmap = RPG::Cache.picture(GameGuy.qpicture(@quest)) if pic != nil
rect = Rect.new(0, 0, bitmap.width, bitmap.height) if pic != nil
self.contents.blt(480-bitmap.width-32, 0, bitmap, rect) if pic != nil
end
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 480, 32, "Quest:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32, 480, 32, GameGuy.qname(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 64, 480, 32, "Reward:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 96, 480, 32, GameGuy.qreward(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 128, 480, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 160, 480, 32, GameGuy.qlocation(@quest))
self.contents.font.color = system_color
self.contents.draw_text(0, 192, 480, 32, "Completion:")
self.contents.font.color = normal_color
if $game_party.completed.include?(@quest)
self.contents.font.color = crisis_color
self.contents.draw_text(0, 224, 480, 32, "Completed")
else
self.contents.font.color = normal_color
self.contents.draw_text(0, 224, 480, 32, "In Progress")
end
self.contents.font.color = system_color
self.contents.draw_text(0, 256, 480, 32, "Description:")
self.contents.font.color = normal_color
text = self.contents.slice_text(GameGuy.qdescription(@quest), 480)
text.each_index {|i|
self.contents.draw_text(0, 288 + i*32, 480, 32, text[i])}
end
end
#==============================================================================
# ** Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :cursor_height
attr_accessor :last_index
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initializiation
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mango301_qst_log_wndw_init017 initialize
def initialize (*args)
mango301_qst_log_wndw_init017 (*args)
@cursor_height = 1
@last_index = 1
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Top Row
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def top_row
return self.oy / (@cursor_height * 32)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Top Row
# row : row shown on top
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def top_row=(row)
row = 0 if row < 0
self.oy = row * (@cursor_height * 32)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Number of Rows Displayable on 1 Page
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def page_row_max
return (self.height - 32) / (@cursor_height * 32)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Item Rect
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def item_rect(index)
rect = Rect.new(4, 0, contents.width - 8, 0)
for j in 0...(index / @column_max)
rect.y += @cursor_height
end
rect.y *= (@last_index * 32)
rect.height = (@cursor_height * 32)
return rect
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Cursor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mango_updte_curs124 update_cursor_rect
def update_cursor_rect
mango_updte_curs124
if @index < 0 # If the cursor position is less than 0
self.cursor_rect.empty # Empty cursor
else # If the cursor position is 0 or more
rect = item_rect(@index) # Get rectangle of selected item
rect.y -= self.oy # Match rectangle to scroll position
rect.y /= @cursor_height
self.cursor_rect = rect # Refresh cursor rectangle
end
end
end
#==============================================================================
# ** Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window deals with general command choices.
#==============================================================================
class Window_Command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initializiation
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize(width, commands)
super(0, 0, width, commands.size * 32 + 32)
# size = the total amount of elements inside the array
size = commands.dup.flatten! ? commands.flatten.size : 1
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * (size*32))
refresh
self.index = 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Refresh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def refresh
self.contents.clear
if @commands.dup.flatten! != nil
@last_val = 0
@commands.each do |i|
for j in 0...i.size
draw_item(j, normal_color, i)
@last_val += 1
end
@last_item = true
end
else
for i in 0...@item_max
draw_item(i, normal_color)
end
end
@item_max = @commands.size
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Draw Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def draw_item(index, color, item = nil)
self.contents.font.color = color
val = item && @last_item ? index + @last_val : index
rect = item_rect(val)
item = @commands unless item
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, item[index])
end
end
#==============================================================================
# ** Bitmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The bitmap class. Bitmaps are expressions of so-called graphics.
#==============================================================================
class Bitmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Slice Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def slice_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
Hey, sorry it took me a while to try this out, I was having some computer issues and was switching antivirus programs. I plugged in the modified script and got an error right away, something about the last lines where it says 'end' twice... the program didn't like something about the way it was set up. I don't know what it was, but I added an extra 'end' in there, not sure if that was right, I was just basing it on how another script looked, but then it didn't return the same error, but I got this error, saying something about
undefined method 'update cursor' for scene:quest window:selectable
and pointed me to this line, 397:
alias mango_updte_curs124 update_cursor
let me know what you think.
Quoteundefined method 'update cursor' for scene:quest window:selectable
Well, there was a couple of really crooked up things in that code I gave you :S including that undefined method for 'update_cursor' which should have been 'update_cursor_rect'. I'll edit my old post with those syntaxes fixed, and a few new methods you might need aswell.
Hi. I've been working on an updated version of game_guy's quest log over in this thread here:
http://rmrk.net/index.php/topic,47221.msg536943.html#msg536943 (http://rmrk.net/index.php/topic,47221.msg536943.html#msg536943)
I don't have long names for the initial command menu, but it does have a completely reworked format for the actual quest window and a lot of new features. I added separate longer quest names for the quest titles in the main page but left the titles in the command menu short so that they don't take up too much room. The demo I have doesn't have the latest version of the script but you can just paste in the latest one in the first post in the above thread, which is version 4.6.
If you need help with it then please let me know. I'm not an expert scripter by any means, but I can probably help if you need it. :D
I also made a demo with some different examples of how to use the script. Here's a screen of some of the changes I made:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimageshack.us%2Fa%2Fimg708%2F4854%2Fscreenshotrpgs004.th.png&hash=2676aeb26aa962db4eeb12679eac59e43e2df3ea) (http://imageshack.us/photo/my-images/708/screenshotrpgs004.png/)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimageshack.us%2Fa%2Fimg856%2F9986%2Fscreenshotrpgs003.th.png&hash=272aa19d0a4023bd90834e6861c40513de2f9ca0) (http://imageshack.us/photo/my-images/856/screenshotrpgs003.png/)
арт лайф
цетразин (http://artlife.com.ua/store/cetrazin/)