Name Box Module [RGSS Script/RMXP]
Okee dokee, here' my first actual RGSS Tutorial ^^
- What is a Name Box?
o.o A name box is usually a box or a graphic which would show a person's Name.
- What does this script do?
It creates a simple name box to insert character's name in ^^
Or, you oculd use it to identify the box, if it's a Sign, you show "Sign"
First of all, replace your Main with this piece of code:
That would make no font errors appear, oh, and you could change "Trebuchet MS" and "24" to your desired font faces/sizes
Now, onto the actual code ^^
1 - Go to Your Script Editor
2 - Right Click on the Script List
3 - Click on Insert
4 - Insert the below Script
As instructed, in a Call Script to make a name box, you type in "MSG.name("NAME")", and to dispose the name box, just, in another call script "MSG.remove"
*UPDATE*
Added Actor Calling Definiton :)
Now, you can call actor's names :)
Use this syntax: MSG.nameActor(Actor ID)
0 = First Actor
1 = Second
2 = third
and, so on.
No errors were found. If there are any sorts of errors, do please post.
Here are some screenies ^_^
>. In action
>. Basic Insertion Code
And, enjoy ;)
Okee dokee, here' my first actual RGSS Tutorial ^^
- What is a Name Box?
o.o A name box is usually a box or a graphic which would show a person's Name.
- What does this script do?
It creates a simple name box to insert character's name in ^^
Or, you oculd use it to identify the box, if it's a Sign, you show "Sign"
First of all, replace your Main with this piece of code:
Code:
#==============================================================================
# ? Main
#------------------------------------------------------------------------------
# ??????????????????????????????
#==============================================================================
begin
# Change the $fontface variable to change the font style
$fontface = $fonttype = $fontname = $defaultfonttype = $defaultfontface = "Trebuchet MS"
# Change the $fontsize variable to change the font size
$fontsize = $defaultfontsize = 24
Graphics.freeze
$scene = Scene_Title.new
while $scene != nil
$scene.main
end
Graphics.transition(20)
rescue Errno::ENOENT
filename = $!.message.sub("No such file or directory - ", "")
print("File #{filename} was not found.")
end
Now, onto the actual code ^^
1 - Go to Your Script Editor
2 - Right Click on the Script List
3 - Click on Insert
4 - Insert the below Script
Code:
#========================================
# ? Module MSG
#------------------------------------------------------------------------------
# This module allows you to create name boxes.
# This would be good for a harvest Moon Game
# This works for custom names, and actors.
# By Peekimon
#
# # INSTRUCTIONS #
# Name Box [Custom Names]
# Simply call this in a Call Script : MSG.name("NAME")
#
# Name Box [Actor Names]
# Simply call this in a Call Script : MSG.nameActor(Actor ID)
#
# Disposing the whole Box:
# Call Script : MSG.remove
#========================================
module MSG
#--------------------------------------------------------------------------
# o Properties of the Name Box
#--------------------------------------------------------------------------
# o X Coordinate of the Name Box
$Window_X = 0
# o Y Coordinate of the Name Box
$Window_Y = 0
# o Height of the Name Box
$Window_H = 100
# o Width of the Name Box
$Window_W = 100
# o Opacity of the Name Box
$Window_Opacity = 160
# o Font Type of the Name Box
$Window_Font = "Arial"
# o Font Size of the Name Box
$Window_Size= 34
# o Font Color of the Name Box
$BoxColor = Color.new(0,0,0,255)
# No Further Editing required
#--------------------------------------------------------------------------
# o Define Custom Names Box
#--------------------------------------------------------------------------
def self.name(n)
$NameWind = true
@Name = Window_Base.new($Window_X,$Window_Y,$Window_W,$Window_H)
@Name.contents = Bitmap.new(@Name.width - 32, @Name.height - 32)
@Name.opacity = $Window_Opacity
@Name.contents.font.name = $Window_Font
@Name.contents.font.size = $Window_Size
@Name.contents.font.color = $BoxColor
@Name.contents.draw_text(0, 0, 1000, 32, n)
end
#--------------------------------------------------------------------------
# o Defines Actor Names Box
#--------------------------------------------------------------------------
def self.nameActor(nA)
$ActorWind = true
@NameActor = Window_Base.new($Window_X,$Window_Y,$Window_W,$Window_H)
@NameActor.contents = Bitmap.new(@NameActor.width - 32, @NameActor.height - 32)
@NameActor.opacity = $Window_Opacity
@NameActor.contents.font.name = $Window_Font
@NameActor.contents.font.size = $Window_Size
@NameActor.contents.font.color = $BoxColor
actor = $game_party.actors[nA]
@NameActor.contents.draw_text(0, 0, 1000, 32, actor.name)
end
#--------------------------------------------------------------------------
# o Remove Definition
#--------------------------------------------------------------------------
def self.remove
if $NameWind == true
@Name.dispose
end
if $ActorWind == true
@NameActor.dispose
end
end
end
As instructed, in a Call Script to make a name box, you type in "MSG.name("NAME")", and to dispose the name box, just, in another call script "MSG.remove"
*UPDATE*
Added Actor Calling Definiton :)
Now, you can call actor's names :)
Use this syntax: MSG.nameActor(Actor ID)
0 = First Actor
1 = Second
2 = third
and, so on.
No errors were found. If there are any sorts of errors, do please post.
Here are some screenies ^_^
>. In action
![[PokeCommunity.com] Name Box Module [RGSS Script/RMXP] [PokeCommunity.com] Name Box Module [RGSS Script/RMXP]](https://img.photobucket.com/albums/v677/peekimon_gall/name_module_screenie2.gif)
>. Basic Insertion Code
![[PokeCommunity.com] Name Box Module [RGSS Script/RMXP] [PokeCommunity.com] Name Box Module [RGSS Script/RMXP]](https://img.photobucket.com/albums/v677/peekimon_gall/name_module_screenie1.gif)
And, enjoy ;)
Last edited: