Onmap Players Window for RMX-OS
Authors: Sylphe
Version: 1.1
Type: RMX-OS Plugin
Key Term: RMX-OS Plugin
IntroductionIf your game uses RMX OS you'll certainly want to have some windows here and there, but you're too lazy to do it :p so this will help you a bit.
Features
- Display onmap players
- System of pages where you can switch pages with P and O if more than 15 players
- You can show/hide the window with one switch
- You can turn this switch on/off with one RMX-OS chat command (/offmap)
Screenshots(http://i.imgur.com/80ZdRVD.jpg)
DemoNone.
ScriptYou will have to change RMXOS OnlineAwareness line 126
Just add the extra lines of this code :
when /\A\/onmap\Z/
names = self.map_players.values.map {|player| player = player.username}
HERE ==> $onmap_players = names
HERE ==> $onmap_player_need_refresh = true
Here is the window code, put it as the Blizzard's order script say : http://forum.chaos-project.com/index.php/topic,23.0.html (http://forum.chaos-project.com/index.php/topic,23.0.html)
=begin
================================================================================
Onmap Player Window for RMXOS Version 1.0
Author: Sylphe [31/07/2014]
--------------------------------------------------------------------------------
This script is a window displaying all characters on the same map of the actor.
The limit of the window is 15 players, if there are more players, type P/O to
See previous/next page of players
--------------------------------------------------------------------------------
[[ Version History ]]
1.0
********************************************************************************
* I N S T R U C T I O N S *
********************************************************************************
You will have to change RMXOS OnlineAwareness line 126
Just add the extra lines of this code :
when /\A\/onmap\Z/
names = self.map_players.values.map {|player| player = player.username}
HERE ==> $onmap_players = names
HERE ==> $onmap_player_need_refresh = true
Then You will have to add this window in a scene, just do like all other
windows in scenes ( .new, dispose, update, refresh)
----------
-Controls-
----------
if player number exceed 15
P / O to change page (P = next Page, O = previous page)
you can change it at the end of this script, in class Scene_Map in the method update_controls
Use command /offmap on the rmx-os chat to show/hide this window
----------
-Graphics-
----------
WINDOWSKIN
line 85 change the windowskin to what you want.
WINDOW'S SIZE
line 174, 185 change the value 10 in 'self.heigt += 10' if you want the window
to be smaller or bigger than usual when another player is displayed.
SPACE BEETWEEN NAMES
line 117 change y+= 15 if you want more/less spaces beetween each player name
------------
-Compatibility-
------------
Only Work with RMXOS and RMXOS OnlineAwareness modified.
---------------
-Configuration-
---------------
TIMER
set line 204 the timer (255 by default). It is the time (in frame maybe)
the game will wait until asking the server who is on the same map
( And don't forget changing windowskin line 85 if you don't use my buddy list script )
SWITCH
Just below in the module you can change the switch you have to set to true or false
whether to hide or show this window.
================================================================================
Credits:
Sylphe -> Making this script
Blizzard -> Doing RMXOS and RMXOS OnlineAwareness
================================================================================
=end
module OnMapData
# The switch to hide/show this window
# note that you can manually change its switch by using /offmap command
Switch = 210
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
# Window displaying onmap players
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
class Onmap_Window < Window_Base
attr_accessor :page
def initialize
# store the last player number
@ancient_player_number = 0
#the actual window page
@page = 0
#The array that will store onmap players
#(used in online awareness if you changed like in configuration)
$onmap_players = []
# flag that will be used to know if we must refresh
$onmap_player_need_refresh = false
# Change this if you want to replace the window
# super (x, y, width, height)
super(380, 140, 200, 60)
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /
(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
self.opacity=125
# here change WINDOWSKIN like
# self.windowskin = RPG::Cache.windowskin("YourWindowskinFileName") without extension.
self.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
refresh
end
def refresh
self.contents.clear
self.contents.font.color= Color.new(255, 255, 255, 255)
@actual_player_number = 0
y = 0
# the first player we display
@first_player = @page * 15
w = contents.text_size("Sylph was the Wind Goddess").width
#if there are players on the map
if $onmap_players[@first_player] != nil
# We display them until 15
for i in @first_player..($onmap_players.length-1)
if @actual_player_number < 15
# Si on a fait la requete on agrandi la fenetre si y a + de joueurs qu'avant
@actual_player_number += 1
if @actual_player_number > @ancient_player_number
bigger
end
self.contents.draw_text(0, y, w, 24,$onmap_players[i],1)
#CHANGE THIS IF THE SPACE BEETWEEN NAMES DOES NOT SUIT YOU
y += 15
end #if there are less than 15 players
end # for every onmap player
end # if player non null
# If there are less players than before we reduce window
difference = (@ancient_player_number - @actual_player_number)
# if 'O' doesn't work, try decomment those lines
# if @tropdmonde.length > 0
# difference -= (@tropdmonde[@page].length - 1)
# end
if difference > 0
for i in 1..difference
if i <= 15
smaller
end
end
end
@ancient_player_number = @actual_player_number
end # End of refresh
# scale window and it's content
def bigger
self.height += 8
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /
(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
end
# reduce window and it's content
def smaller
self.height -= 8
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /
(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
end
end # End of my window
class Scene_Map
alias sylphe_opw_main main
def main
#the timer, change the condition in update
@timer = 0
@onmap_window = Onmap_Window.new
sylphe_opw_main
@onmap_window.dispose
end
alias sylphe_opw_update update
def update
@onmap_window.update
# If we have too much persons, we check if player type P or O
if $onmap_players.length > 15
update_onmap_player_controls
end
# we check who is on the same map
# Once we connect and once the timer match condition at the bottom
if @timer == 0
$network.check_normal_commands('/onmap')
end
if $onmap_player_need_refresh
@onmap_window.refresh
@onmap_window.refresh
$onmap_player_need_refresh = false
end
@timer = @timer+1
# CHANGE THIS TO CHANGE THE TIME UNTIL IT WILL CHECK SERVER DATAS
#(255 = I dunno how many seconds, I would say 15)
if @timer == 255
@timer = 0
end
# If switch is activated
if !$game_switches[OnMapData::Switch] and @onmap_window.visible
@onmap_window.visible = false
elsif $game_switches[OnMapData::Switch] and !@onmap_window.visible
@onmap_window.visible = true
end
sylphe_opw_update
end
#we check if the input is P or O (works now)
def update_onmap_player_controls
if Input.trigger?(Input::Key['P'])
if ((@onmap_window.page*15)+15) < $onmap_players.length
@onmap_window.page += 1
@onmap_window.refresh
@onmap_window.refresh
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.trigger?(Input::Key['O'])
if @onmap_window.page > 0
@onmap_window.page -= 1
@onmap_window.refresh
@onmap_window.refresh
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end # end of Class Scene_Map
module RMXOS
#============================================================================
# module Documentation
#============================================================================
module Documentation
PARAMETERS['offmap'] = 'none'
DESCRIPTIONS['offmap'] = 'Show/Hide the window displaying all onmap players.'
end
#============================================================================
# Network
#============================================================================
class Network
alias check_normal_commands_onmap_window_alias check_normal_commands
def check_normal_commands(message)
case message
when /\A\/offmap\Z/
$game_switches[OnMapData::Switch] = !$game_switches[OnMapData::Switch]
return true
end
return check_normal_commands_onmap_window_alias(message)
end
end
end
InstructionsSee at the top of the code.
CompatibilityNot compatible with radically Window_Base or RMXOS modifying scripts
Credits and Thanks
- Sylphe, for the script.
- Blizzard, for RMXOS and OnlineAwareness.
Author's NotesIt was made for R5GAMER but I tought anyone could want this ^^ so here is the release
Please report any bugs or suggestions.
( the feature with more than 15 players may bug I didn't test it because I don't have 15 players in my project)
Lol, this has been requested so many times. I'm glad someone finally made it xD
also, add this at the bottom for the scene_map stuff
class Scene_Map
alias sylphe_opw_main main
def main
@onmap_window = Onmap_Window.new
sylphe_opw_main
@onmap_window.dispose
end
alias sylphe_opw_update update
def update
@onmap_window.update
@onmap_window.refresh
sylphe_opw_update
end
end
Yeah I was wondering why anyone didn't post windows scripts for RMX OS ^^ I'm also doing a graphical buddy list but there are some annoying things causing troubles
Thank you for the enhancement I added it :) and now I think I understood how aliases works ^^
Great to see people adding things to rmx-os ;)
rmx-os is something great I hope the general bugs like the ones you mentionned will be fixes one day
Maybe I ! Will fix it 8-| haha
but for now I'm a noob
You shouldn't actually call refresh every frame, but only when the player list changes.
what do i change here guys?
# ici change le WINDOWSKIN selon ce que tu veux
self.windowskin = RPG::Cache.windowskin(BuddyData:windowskin)
refresh
end
I use a different window skin to standard rmxp
Quote from: Blizzard on July 31, 2014, 04:18:14 pm
You shouldn't actually call refresh every frame, but only when the player list changes.
Do I have to move some codes from refresh method to scene_map ?
(I think about the timer)
white you just have to put here the windowskin you want to, it doesn't work if you just put
self.windowskin = RPG::Cache.windowskin('Yourwindowskin')
?
Perfect! And Very thanks!
You welcome :D
Updated, the refresh performed only when checking server's datas
You have a refresh flag there already as far as I can see.
if $onmap_player_need_refresh
@onmap_window.refresh
$onmap_player_need_refresh = false
end
Using a timer is unnecessary if you refresh it only when the data has changed.
I updated it =)
The timer is for checking the datas (sending /onmap manually). Once I receive the datas, I set the flag to true in onlineAwareness then I can run the refresh in the code you mentionned, in the scene_map update ^^
I just tested with 16 players to see if there was a concern with touch p and o and see if the code do its job .. Unfortunately, there is an error ..
And I change :
def update_controls
if Input.trigger?(Input::P)
@page += 1
elsif Iput.trigger?(Input::O)
@page -= 1
end
end
to :
def update_controls
if Input.trigger?(Input::Key['P'])
@page += 1
elsif Input.trigger?(Input::Key['O'])
@page -= 1
end
end
Try replacing 'o' and 'p' with a capitol 'O' and 'P'.
Quote from: gameus on August 01, 2014, 02:45:13 am
Try replacing 'o' and 'p' with a capitol 'O' and 'P'.
Yes, I just saw I was not careful .. lol
Another problem, I've put 20 players when the player clicks on P must do this several times until you get to another window .. By cons, once the other window and reached .. and that you click on O, its deletes all the names and adds in a few ..
MMMhhh.. I changed the timer in 1 and I noticed he responds immediately to the 'P' button but the button 'O' it does not respond ..
im getting an error :(
(http://i804.photobucket.com/albums/yy324/richadam111/errorawerness_zpsd4f43d6b.png) (http://s804.photobucket.com/user/richadam111/media/errorawerness_zpsd4f43d6b.png.html)
@R5GAMER ok thank you I'll see what I can do and I have an idea why it bugs (also clean your inbox when I send you a PM it says your inbox is full xd)
@whitespirit Are you sure you put the lines I mentionned for OnlineAwareness at the right place ? (it's near line 126 for me in online awareness)
EDIT : updated please try the new code with more than 15 players
Quote from: Sylphe on August 01, 2014, 12:14:47 pm
@R5GAMER ok thank you I'll see what I can do and I have an idea why it bugs (also clean your inbox when I send you a PM it says your inbox is full xd)
@whitespirit Are you sure you put the lines I mentionned for OnlineAwareness at the right place ? (it's near line 126 for me in online awareness)
EDIT : updated please try the new code with more than 15 players
I go test and I tell you!
An Error :
elsif Iput.trigger?(Input::Key['O'])
@onmap_window.page -= 1
@onmap_window.refresh
end
Remplace to :
elsif Input.trigger?(Input::Key['O'])
@onmap_window.page -= 1
@onmap_window.refresh
end
If you touch the button 'P' he can't no longer use the 'O' button ..
If you click on 'O' he appears other players but when repeatedly clicking on 'O' he displays an error.
(http://gohproject.free.fr/erreur1.png)
Ok thank you ! I updated, try again ! Lol
Quote from: Sylphe on August 01, 2014, 08:35:09 pm
Ok thank you ! I updated, try again ! Lol
Always the same error .. :/
o_o weird lol I'll test some things, you will have your 15 players limit I promise ! x)
Quote from: Sylphe on August 02, 2014, 11:21:32 am
o_o weird lol I'll test some things, you will have your 15 players limit I promise ! x)
LoL! Take your time, don't worry, you help me a lot compared to other :)
Best for you can try without necessarily used 15 players is to test with 2 characters.
Yeah just updated ! I think this time it is good (with 2 players it works)
EDIT : j'ai rajouté un truc faut activé un switch pour afficher la fenêtre maintenant ^^ pour ceux qui ne veulent pas tout le temps l'avoir en vue.
It works!! Nice Work!! My Friend ;) I just test with 50 players was long but it works well xD
Quote from: Sylphe on August 02, 2014, 12:55:32 pm
EDIT : j'ai rajouté un truc faut activé un switch pour afficher la fenêtre maintenant ^^ pour ceux qui ne veulent pas tout le temps l'avoir en vue.
When did the forum become French speaking? Did I miss something?
@R5GAMER yeah I finally made it ! Youhou ! xD
@F0 Ooops sorry ! In english it is "I added a switch to show/hide the window" it's in the config
also the version is 1.1 now
Really great work, instead of a switch is it possible to add a command to rmx-os to open and close it? example /onmap then /onmapoff or something? what would be cool is adding a mouse an icon list that could be clicked on with blizz mouse controller :)
Quote from: whitespirits on August 02, 2014, 03:46:10 pm
Really great work, instead of a switch is it possible to add a command to rmx-os to open and close it? example /onmap then /onmapoff or something? what would be cool is adding a mouse an icon list that could be clicked on with blizz mouse controller :)
That is what mouse map menu is for ;)
Quote from: whitespirits on August 02, 2014, 03:46:10 pm
Really great work, instead of a switch is it possible to add a command to rmx-os to open and close it? example /onmap then /onmapoff or something? what would be cool is adding a mouse an icon list that could be clicked on with blizz mouse controller :)
I added the feature, you can now use /offmap to show/hide the window, but you have to properly configure the switch
(when yo type /offmap it just changes the switch state)
For the mouse thing I'm sorry but I don't use blizz mouse controller for now