Character Drop Down Menu
Authors: Nathmatt
Version: 1.15
Type: Misc System
Key Term: Custom Menu System
Introductioncreates a drop down menu for the character you right click on
Requires RMX-OS & Mouse Controller by Blizzard
Features
- Add Buddy & trade always
- Kick & Ban if you have any mod status
- Guild Invite if your a guild leader
- Add Party if Blizz-ABS Controller is being used
Screenshots(http://img36.imageshack.us/img36/653/screenshotovj.png)
DemoNo Demo
Script#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Character Drop Down Menu by Nathmatt
# Version: 1.15
# Type: Misc System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Character_Drop_Down_Menu
def initialize
username = ''
@mini_list_array = ['Add Buddy','Trade']
@mini_list_array.insert(1,'Add Party') if $blizzabs_rmxos != nil
if $network.guildleader == $network.username
@mini_list_array.insert(0,'Guild Invite')
end
@mini_list_array.push('Kick','Ban') if $network.usergroup > 0
@confirm_window = Window_Confirm.new
@mini_list = Window_Mini_List.new(@mini_list_array)
@mini_list.visible = false
@wait = 0
end
def update
@wait -= 1 if @wait > 0
if Input.trigger?(Input::Key['Mouse Right'])
return if @wait != 0
@mx,@my = $mouse.pos
@sx,@sy = $mouse.position
@player_username = $network.check_player(@mx,@my)
@players_info = $network.get_player(@mx,@my)
if @player_username != nil
@mini_list.visible = true
@mini_list.active = true
@mini_list.x = @sx
@mini_list.y = @sy
$MCES.disabled = true
end
@wait = 5
end
if @mini_list.active
@mini_list.update
if Input.trigger?(Input::Key['Mouse Left'])
return if @wait != 0
if @mini_list.index >= 0
@confirm_window.set_commands(@mini_list.item,@player_username)
end
@mini_list.visible = false
@mini_list.active = false
@wait = 5
end
end
if @confirm_window.active
@confirm_window.update
if Input.trigger?(Input::Key['Mouse Left'])
return if @wait != 0
case @confirm_window.index
when 0
case @mini_list.item
when 'Add Buddy'
$network.command_buddy_add(@player_username)
when 'Trade'
$network.command_trade_request(@player_username)
when 'Guild Invite'
$network.command_guild_invite(@player_username)
when 'Kick'
$network.command_kick_player(@player_username)
when 'Ban'
$network.command_ban_player(@player_username)
when 'Add Party'
$network.command_party_invite(@player_username)
end
@confirm_window.visible = false
@confirm_window.active = false
else
@confirm_window.visible = false
@confirm_window.active = false
end
$MCES.disabled = false
$MCES.wait = 5
@wait = 5
end
end
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias character_drop_down_menu_main main
def main
@mini_menu = Character_Drop_Down_Menu.new
character_drop_down_menu_main
end
alias character_drop_down_menu_update update
def update
@mini_menu.update
character_drop_down_menu_update
end
end
#==============================================================================
# Mouse
#==============================================================================
class Mouse
attr_accessor :cursor
def pos
x, y = self.position
x = ( x + $game_map.display_x / 4) / 32
y = ( y + $game_map.display_y / 4) / 32
return x, y
end
end
#==============================================================================
# Window_list
#==============================================================================
class Window_Mini_List < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(list)
super(476, 175, 104, 300)
@list = list
@column_max = 1
refresh
self.index = 0
self.opacity = 0
self.active = false
self.z = 10000
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index] if self.index >= 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@list.each {|i| @data.push(i)}
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.fill_rect(0,0,width,height,Color.new(0, 0, 0, 160))
@data.each_index {|i| draw_item(i)}
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = index % 1 * (288 + 32)
y = index / 1 * 32
self.contents.font.size = 16
self.contents.draw_text(x, y, width - 32, 32, @data[index].to_s, 1)
end
end
#==============================================================================
# Window_Confirm
#==============================================================================
class Window_Confirm < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize
super(100, 100, 300, 150)
@data = ['Yes','No']
@column_max = 2
@command = nil
@user = nil
refresh
self.index = 0
self.opacity = 0
self.active = false
self.visible = false
self.z = 10000
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index] if self.index >= 0
end
#--------------------------------------------------------------------------
# * reset
#--------------------------------------------------------------------------
def set_commands(command,user)
@command = command
@user = user
self.visible = true
self.active = true
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, 20 + row_max * 32)
self.contents.font.size = 16
self.contents.fill_rect(0,0,width,height,Color.new(0, 0, 0, 160))
self.contents.draw_text(0,0,width,20,
'Are you sure you want to '+ @command.to_s + ' ' + @user.to_s)
@data.each_index {|i| draw_item(i)}
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = index * (width - 32) / 2
self.contents.draw_text(x, 20, (width - 32) / 2, 32, @data[index].to_s, 1)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(self.index * (width - 32) / 2, 25,
(width - 32) / 2 , 20)
end
end
end
#============================================================================
# RMXOS::Network
#============================================================================
class RMXOS::Network
def check_player(x,y)
@players.any? {|key, value|
return value.username if value.x == x && value.y == y}
return nil
end
def get_player(x,y)
if $blizzabs_rmxos != nil
@players.any? {|key, value|
return value.battler if value.x == x && value.y == y}
end
return nil
end
end
# Load the network
$network = RMXOS::Network.new
Instructionsplace below Mouse Controller script & below my Mouse Path Finder
Compatibilityno compatibility issues known
Credits and Thanks
- Nathmatt
- Blizzard for the Mouse Controller script and RMX-OS
Author's NotesAny suggestions for updates are appreciated
amazing! level up!
Ah, finally people are extending RMX-OS in the right ways. :D
im open to suggestions for more options to add
update: 1.01 small bug fix
suggestion:
invite/kick guild?
btw.. lvl up for great script
suggestion : remove the nickname above the head of the player -> insert the nickname above in your menu
update: 1.11 added Kick & Ban if you have any mod status & Guild Invite if your a guild leader
I keep getting
undefined method 'battler'
error
update:1.12 fixed undefined method 'battler' error
Great! It now works. The only problem I have is that when you open the drop down menu and then open the regular menu, the drop down menu will still show.
update 1.13 fixed forgot to add the dispose method just put
below
hey i have a question for the sensitive functions like kick and ban/invite do you have a confirm dialog to make sure the player really wants to do those things in case the click on them by accident?
:clap: Yay! *lvls up*
update 1.14 added confirm window
update 1.15 fixed compatibility with my Mouse Controller enhancement Script
I'm gettin this error...:(
"Script 'CharacterDropDownMenu' line 145: TypeError occurred
Mouse is not a class"
are you using the mouse controller script by Blizzard
yes i do
sorry for the stupid questions but is my script below his mouse controller
I don't see why that would be a stupid question. :P
Quote from: nathmatt on July 11, 2010, 02:44:09 pm
sorry for the stupid questions but is my script below his mouse controller
yes it is...
okay i keep getting this error.
(http://img1.UploadScreenshot.com/images/main/8/23721362776.png) (http://www.UploadScreenshot.com/image/113846/340893)
These are the extra scripts and their order if its needed.
Tons of add ons 1,2,3
Mouse Controller by Blizzard
Mouse Controller Enhancement Script by Nathmatt
Character Drop Down Menu by Nathmatt
RPG Maker XP Online System (RMX-OS) (options,script,and main)
Make sure this is below RMX-OS.....
is it ? if it is i need to look into it
Im getting this error. any ideas how to fix?
http://s804.photobucket.com/user/richadam111/media/errordropdown_zpsa7ceab54.png.html
You need this (http://forum.chaos-project.com/index.php/topic,5909.0.html).
Thank you :), I can now click and see add party, buddy and trade but clicking them results in further errors, any idea?
http://s804.photobucket.com/user/richadam111/media/error_zps91254c19.png.html?sort=3&o=0
It seems when nathmatt updated his MCES script, he changed the parameter
@wait into, what I believe to be,
@lwait and
@rwait.
In the MCES script, at this spot
#============================================================================
# MCES::Processor
#----------------------------------------------------------------------------
# This class performs the $MCES's processing.
#============================================================================
class Processor
attr_accessor :item,:curser_lock,:disabled,:movement_disabled,:location
attr_reader :event_start
add this to the following
attr_accessor :lwait, :rwait
Then, in the Drop Down script, at the line that the error pointed out to you, change it into
This is all conjecture based on what makes logical sense. If that doesn't work, someone else will have to help you.
Thank you that has worked :)