Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Elyssia on September 02, 2010, 11:15:44 am

Title: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 02, 2010, 11:15:44 am
I wonder if it's possible to add a text to the Right bottom side of the Title Screen(Main Menu) which shows the current version of the application. (Not the version of RPGXPOnline but just as custom add)
If yes, i would appreciate a script of making this possible. :D
A friend of mine asked me on a IRC Network if i knew how to make this possible, so i planned to ask it in here in hope on someone knowing how to make this possible.
Thanks in advance ^^
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ShadowPierce on September 02, 2010, 12:56:38 pm
->May I ask why you'd rather have it scripted than editing the title pic itself? :^_^':


Title: Re: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 02, 2010, 01:25:14 pm
That doesn't look professional ;)
Scripted does look much better than editing the titlescreen :P
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Valdred on September 02, 2010, 01:37:34 pm
put this in the bottom of the initialize method of Scene_Title

@sprite.bitmap.draw_text(x, y, width, heigth, text, allignment)

exchange x with x cordinate of text, y with y cordinate, and so on. Allignment is 1 by default.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 02, 2010, 05:25:34 pm
thanks :D
gotta try it, when i have the time tomorrow!
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 03, 2010, 03:51:58 am
Hm... me and my friend get's both a different error.
I am trying to add this into the online system and my friend into the official Script database.
The error i get is: Script '(RMX-OS) Script' line 3496: NoMethodError occurred. undefined method `bitmap' for nil:NilClass

And my friend get's: Script'scene_title' Line 87: Name Error occured. uninitialized constant scene_title:: Version.


Any ideas? :s
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Blizzard on September 03, 2010, 05:53:08 am
Your friend didn't add all parts of the script or he didn't add them in the right order.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Valdred on September 03, 2010, 08:37:00 am
The first error. (The one you got) is because of some script you are using that changes the Scene_Title class. The second one is not caused by my script.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ForeverZer0 on September 03, 2010, 12:19:25 pm
The first error is that @sprite is not defined. You may have a script that uses a different name than this. If not, you may being trying to alter the bitmap of the sprite before it is defined. Find the line that looks something like this:
@sprite = Sprite.new

Soon after that the bitmap should be defined. Right after that is where you should add the edit.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Valdred on September 03, 2010, 02:15:50 pm
Yeah, but putting it in the end of initialize would work as I'm pretty sure @sprite is created in that method.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ForeverZer0 on September 03, 2010, 02:59:38 pm
It may be, I haven't even looked.  :wacko:
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 03, 2010, 03:03:47 pm
Still no good :/
Might be doing something wrong or import this in the wrong script order/file.
I do use the online system, so i might made a type mistake somewhere...
This is what i have:

@sprite = Sprite.new
@sprite.bitmap.draw_text(100, 100, 100, 100, 'TEST', 1)


But the question, is if this is correct as a test. And where i have import the script to?
I guess this should be added in '(RMX-OS) Script' somewhere...
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ForeverZer0 on September 03, 2010, 04:21:27 pm
You need to add it after the sprite's bitmap is defined. There will be a line that reads @sprite.bitmap = WHATEVER.
Place it after that line.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Elyssia on September 04, 2010, 06:12:05 pm
I think i'll give this up.
After several attempts it still keeps failing to load the scripts because of an 'Undefined method' error.
( a Small step by Step tutorial would be nice?)
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Valdred on September 05, 2010, 06:27:26 am
You need to put it after

@sprite.bitmap = Bitmap.new(....some stuff...)
put the line here
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Calintz on September 05, 2010, 12:04:02 pm
Just go to www.dafonts.com and find a professional looking font that has free usage permits, or free personal usage permits. Add it to the title screen with a photo editing program. It doesn't need to be written in code to look professional. *sigh*
Title: Re: [Request][XP] Version number in Title Screen?
Post by: stripe103 on September 05, 2010, 02:12:06 pm
No but with code, any error can be fixed easily without having to remake the background. Errors such as change in placement and color.
Try with this. Just add it in a new script section below Scene_Title.

# Type in the version number.
VERSION = "1.0"

class Window_Version < Window_Base
  def initialize
    super(445, 0, 640, 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  def refresh
    self.contens.clear
    self.contents.font.size = 28
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 640, 32, VERSION, 2)
  end
end

class Scene_Title
  alias :ori_main :main
  alias :ori_refresh :refresh
  def main
    @window_version = Window_Version.new
    ori_main
    @window_version.dispose
  end
  def refresh
    @window_version.refresh
    ori_refresh
  end
end


I have tried almost the same code in a project, but not this exact one, so if you find any errors with it, please tell me.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Taiine on September 08, 2010, 08:26:21 am
Quote from: stripe103 on September 05, 2010, 02:12:06 pm
No but with code, any error can be fixed easily without having to remake the background. Errors such as change in placement and color.
Try with this. Just add it in a new script section below Scene_Title.


I have tried almost the same code in a project, but not this exact one, so if you find any errors with it, please tell me.


I tried it cause well.. was curious.. and yeah error.
Line 21
undefined method 'refresh' for class "Scene_Title"

Quoteclass Scene_Title
  alias :ori_main :main
  alias :ori_refresh :refresh
  def main
    @window_version = Window_Version.new
    ori_main
    @window_version.dispose
  end
  def refresh
    @window_version.refresh
    ori_refresh
  end
end
Title: Re: [Request][XP] Version number in Title Screen?
Post by: stripe103 on September 08, 2010, 09:38:55 am
I've got that error out of the way but now it says that the method "windowskin_name" is undefined and I can't find anything related to that.
This is the current code. If anyone can find the problem please tell because I can't.
class Window_TitleVersion < Window_Base
  def initialize
    super(445, 0, 640, 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.size = 28
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, -10, 200, 45, "1.0", 2)
  end
end


class Scene_Title
  alias :ori_main :main
  def main
    @window_version = Window_TitleVersion.new
    ori_main
    @window_version.dispose
  end
end
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ForeverZer0 on September 08, 2010, 12:11:46 pm
Probably because $game_system has not been initialized yet, and that is where the name of the windowskin is stored. So when you try to create the window, Window_Base, the super class, attempts to read from a class that does not yet exist for the windowskin name. Try adding this line something like $game_system = Game_System.new to the top of your aliased method and see if that helps.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: stripe103 on September 08, 2010, 01:57:28 pm
Yea you were right. It was $game_system and $data_system that were not initsiated.
Here is the working code.
PLACEMENT = ([456, 436])
#           || X || Y ||
# Preset to the lower right corner.

# BACKGROUND COLOR
COLOR = ([0, 0, 0, 200])
# (RED, GREEN, BLUE, OPACITY)

# Text to be shown
TEXT = "1.0"

class Window_TitleVersion < Window_Base
  def initialize
    super(PLACEMENT[0], PLACEMENT[1], 200, 60)
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    self.opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.fill_rect(0, 0, self.width, self.height, Color.new(COLOR[0],COLOR[1],COLOR[2],COLOR[3]))
    self.contents.font.size = 28
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, -20, 168, 68, TEXT, 2)
  end
end

class Scene_Title
  alias :ori_main :main
  def main
    $data_system = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @window_version = Window_TitleVersion.new
    ori_main
    @window_version.dispose
  end
end
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Taiine on September 09, 2010, 01:55:16 am
Real nice, works very well. I thought of poking it in my game but sadly guess cause using MogHunters 'Animated Title Celia' it don't do a darn thing. Shame, be nice to not have to change it on each image. But meh.
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Dweller on September 09, 2010, 03:04:39 am
I usually work with a project on 3 different computers. This script help me a lot with that project cause sometimes I forget what version is on each computer  :).
Title: Re: [Request][XP] Version number in Title Screen?
Post by: ForeverZer0 on September 09, 2010, 12:14:21 pm
Quote from: Taiine on September 09, 2010, 01:55:16 am
Real nice, works very well. I thought of poking it in my game but sadly guess cause using MogHunters 'Animated Title Celia' it don't do a darn thing. Shame, be nice to not have to change it on each image. But meh.


You don't need to change it on all th images. Just create a new sprite. Not familiar with the script you are talking about with the Title, but in it somewhere you will find where the sprite is created for the background. AFTER that, put something like this:

@version_number = Sprite.new
@version_number.x, @version_number.y = X, Y # You will have to define X and Y
bitmap = Bitmap.new(WIDTH, HEIGHT) # You must define width and height
bitmap.draw_text(0, 0, WIDTH, HEIGHT, "WHATEVER VERSION NUMBER IS", 1)
@version_number.bitmap = bitmap


You are gonna have to add this after the loop as well
@version_number.dispose
Title: Re: [Request][XP] Version number in Title Screen?
Post by: Blizzard on September 09, 2010, 12:31:42 pm
Good values for WIDTH and HEIGHT are 128 and 32.