RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Advanced Command Windows

0 Members and 1 Guest are viewing this topic.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
This was lost, unfortunately, during many of the transitions this forum has had, so I'm gonna repost it.




 
This is a script which allows you to make vertical or horizontal command windows with or without icons as well as have changing text and or text color depending on what's selected. You can also disable the cursor easily.
Keep in mind all of the original command windows in all of the scenes will still work correctly.
 
Replace Window_Command with this -
 
Spoiler for Code:
Code: [Select]
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
attr_accessor :disabled
#--------------------------------------------------------------------------
# * Object Initialization
#  width : window width
#  commands : command text string array
#--------------------------------------------------------------------------
def initialize(width,a,type=nil,align = nil,b = nil,color = nil,icons = nil)
if type.nil?
@type = 0
elsif !type.nil?
@type = type
end
# Compute window dimentions
case @type
when 0
super(0, 0, width, a.size * 32 + 32)
@item_max = a.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
when 1
super(0, 0,width,80)
@item_max = a.size
@column_max = a.size
self.contents = Bitmap.new(width - 32,height - 32)
end
@commands_a = a
@disabled = []
@cursor_status = true
for i in 0..@item_max
@disabled[i] = false
end
if align.nil?
@alignment = 0
elsif !align.nil?
@alignment = align
end
if b.nil?
@commands_b = []
for i in 0..@commands_a.size
@commands_b[i] = @commands_a[i]
end
else !b.nil?
@commands_b = b
end 
if color.nil?
@selected_color = normal_color
elsif !color.nil?
@selected_color = color
end
if icons.nil?
@icon_status = false
elsif !icons.nil?
@icons = icons
@icon_status = true
end
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @icon_status == true
case @type
when 0
for i in 0..(@icons.size - 1)
y = ((i * 32) + ((i + 1) * 4))
draw_icon(@icons[i],4,y)
end
when 1
command_width = (self.contents.width / @item_max)
for i in 0..(@icons.size - 1)
x = ((i * command_width) + ((i + 1) * 4))
y = ((self.contents.height - 24) / 2)
draw_icon(@icons[i],x,y)
end
end
end
for i in 0...@item_max
if self.index == i and @disabled[i] != true
draw_item(i, @selected_color,1,@alignment)
elsif @disabled[i] == true and self.index != i
draw_item(i, disabled_color,0,@alignment)
elsif @disabled[i] == true and self.index == i
draw_item(i, disabled_color,1,@alignment)
elsif @index != i and @disabled[i] != true
draw_item(i, normal_color,0,@alignment)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
#  index : item number
#  color : text color
#--------------------------------------------------------------------------
def draw_item(index, color,type,alignment)
case @type
when 0
if @icon_status == true
x = 8 + 24
elsif @icon_status == false
x = 4
end
rect = Rect.new(x, 32 * index, self.contents.width - 36, 32)
self.contents.font.color = color
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case type
when 0
self.contents.draw_text(rect, @commands_a[index],alignment)
when 1
self.contents.draw_text(rect, @commands_b[index],alignment)
end
when 1
y = ((self.contents.height - 32) / 2)
if @icon_status == true
command_width = ((self.contents.width / @column_max) - 24 - 8)
x = ((index * command_width) + ((index + 1) * (24 + 8)))
rect = Rect.new(x,y,command_width - 24 - 8,32)
elsif @icon_status == false
command_width = ((self.contents.width / @column_max) - 4)
x = ((index * command_width) + (index * 4))
rect = Rect.new(x,y,command_width - 4,32)
end
self.contents.font.color = color
self.contents.fill_rect(rect,Color.new(0,0,0,0))
case type
when 0
self.contents.draw_text(rect,@commands_a[index],alignment)
when 1
self.contents.draw_text(rect,@commands_b[index],alignment)
end
end
end
#--------------------------------------------------------------------------
# * Disable Item
#  index : item number
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh
super
end
#--------------------------------------------------------------------------
# * Disable Cursor
#--------------------------------------------------------------------------
def disable_cursor
@cursor_status = false
end
#--------------------------------------------------------------------------
# * Update Cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @cursor_status == false
self.cursor_rect.empty
return
end
if @type == 0
super
else
command_width = (self.contents.width / @item_max)
x = @index * command_width
y = ((self.contents.height - 32) / 2)
self.cursor_rect.set(x, y, command_width, 32)
end
end
#--------------------------------------------------------------------------
# * Draw Icon
#--------------------------------------------------------------------------
def draw_icon(name,x,y)
if name == ''
return
else
bitmap = RPG::Cache.icon(name)
w = 24
h = 24
src_rect = Rect.new(0, 0, w, h)
self.contents.blt(x, y , bitmap, src_rect)
end
end
end

You can make Command_Windows as normal, however if you wish to make an advanced command_window, ALWAYS use the following format to make things easier on yourself.
 
Code: [Select]
a = 200 #Width - REQUIRED
b = ['Command','Command','Command'] #Commands - REQUIRED
c = nil #Type (0 = Vertical, 1 = Horizontal) - OPTIONAL
d = nil #Text Alignment (0 = Left, 1 = Center, 2 = Right) - OPTIONAL
e = nil #Commands When Selected (EX: N E W  G A M E) - OPTIONAL
f = nil #Color of Selected Command - OPTIONAL
g = nil #Icon names (EX: ['Icon1','Icon2','Icon3'] - OPTIONAL
@command_window = Window_Command.new(a,b,c,d,e,f,g)
The things that are required must obviously be filled out. The things that are optional you can leave as nil and it will work fine.
 
To disable the cursor, use -
 
Code: [Select]
@command_window.disable_cursor

Screen Shots - (cropped - only a couple combinations are used in example)
 

 

 
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

**
Rep:
Level 86
Rastel Maskil Magister~
this is great Tsunokiette-senpai~!! :tpg:

thank you for this... I'm sure to use it.. ummm can i ask you for sometthing tho if you don't mind (if you do mind I'll ask anyways XP)...

is there a way to have this Command window to delay it's apperance?, I mean... have the player stare at the intro screen for a bit before giving the command (e.g Start game, etc) kinda like the was Thousand Arms for the play station did.... it was like it said the tittle and then after the title kinda got toghether you could THEN actually start the game.

I dunno is just a thing that I wasn't sure if it was possible.. any help of course is beforehand very much apreciated~ xD

 ;8

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
You could mess around with conditional statements, returns, and whatnot in the update method of Scene_Title to keep the command window from appearing before you want it to. Be sure to have the branch function BEFORE any method in "update" is called that can accept button presses like Enter for C and what not.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
That is a pretty neat script. Nice job.

**
Rep: +0/-0Level 85
online portfolio at http://denzelsoto.com
how do you use this???
were to put this
Quote
a = 200 #Width - REQUIRED
b = ['Command','Command','Command'] #Commands - REQUIRED
c = nil #Type (0 = Vertical, 1 = Horizontal) - OPTIONAL
d = nil #Text Alignment (0 = Left, 1 = Center, 2 = Right) - OPTIONAL
e = nil #Commands When Selected (EX: N E W  G A M E) - OPTIONAL
f = nil #Color of Selected Command - OPTIONAL
g = nil #Icon names (EX: ['Icon1','Icon2','Icon3'] - OPTIONAL
@command_window = Window_Command.new(a,b,c,d,e,f,g)

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
You put it in the same place you would normally initialize a command window. Just look at Scene_Menu to understand. It's exactly the same.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
Rep: +0/-0Level 10
RMRK Junior
If lrc.rrtg.rmrk.net.toa.ba neurologist, stump inhibits abana pills betapace discount betapace ciprofloxacin 500mg cheapest ashwagandha generic cialis canada radicals, midwives <a href="http://cgodirek.com/abana/">abana</a> <a href="http://agoabusinesswinds.com/betapace/">betapace online</a> <a href="http://wellnowuc.com/cipro/">cipro canine</a> <a href="http://outdooradvertisingusa.com/ashwagandha/">ashwagandha without a prescription</a> <a href="http://ivapelocal.com/tadalafil-20-mg/">cialis</a> signals, http://cgodirek.com/abana/ abana online http://agoabusinesswinds.com/betapace/ buy betapace http://wellnowuc.com/cipro/ cipro http://outdooradvertisingusa.com/ashwagandha/ ashwagandha for sale http://ivapelocal.com/tadalafil-20-mg/ buy free cialis establishing saintliness.