RMX-OS Online List
Authors: Wizered67
Version: 1.00
Type: RMX-OS Add-on
Key Term: RMX-OS Plugin
IntroductionAdding this script will add a new command for RMX-OS called "/online". By using this command it will give the player a list of all players online. This script requires Blizzard's User Logger for RMX-OS.
Features
- Simple add-on that is easy to use
- Makes it easy for any player to find out who is online.
Screenshots(http://i55.tinypic.com/2ikcvit.png)
DemoN/A
Script
#------------------------------------------------------------------------------
# RMX-OS Online List
# by Wizered67
# V 1.00
# All errors should be reported at www.chaos-project.com.
#------------------------------------------------------------------------------
module RMXOS
module Documentation
PARAMETERS['online'] = 'none'
DESCRIPTIONS['online'] = 'Shows the amount of players online.'
end
class Network
alias check_normal_commands_online_add check_normal_commands
def check_normal_commands(message)
case message
when /\A\/online\Z/
$network.send('POL')
return true
end
return check_normal_commands_online_add(message)
end
end
end
.rb server extension
module RMXOS
def self.load_current_extension
return PlayersOnline
end
end
#======================================================================
# module PlayersOnline
#======================================================================
module PlayersOnline
VERSION = 1.01
RMXOS_VERSION = 1.08
SERVER_THREAD = false
#This will not work if the user logger isn't listed before this.
LOG_LOCATION = UserLogger::ONLINELIST_FILENAME
def self.initialize
end
def self.main
while RMXOS.server.running
self.server_update
sleep(0.1)
end
end
def self.server_update
end
def self.client_update(client)
case client.message
when /\APOL\Z/
#set @players_online to equal an empty array
@players_online = []
#get info from the user logger log.
file = File.open(LOG_LOCATION , 'r')
#add each line to the @players_online array. Each line is a different user.
file.each_line {|line| @players_online.push(line)
}
#close file
file.close
#define a new variable, at first being equal to an empty string.
@players_on = ''
for i in 0...@players_online.size
#makes @players_on equal to the current @players_on plus the players that are online.
@players_on = @players_online[i] + @players_on
end
#sends final message
client.send("CHT#{RMXOS::Data::ColorInfo}\t0\tPlayers Online: #{@players_on}")
return true
end
return false
end
end
InstructionsJust put in the script below RMX-OS and add the .rb add-on to extension to the extensions list.
Make sure it comes after the user logger in the server config.
CompatibilityRequires RMX-OS and Blizzard's User Logger.
Credits and Thanks
- Wizered67
- Blizzard for making RMX-OS and his user logger.
Author's NotesIf you have any problems, just report them. I may have missed something.
Quote from: Wizered67 on December 20, 2010, 09:03:27 pm
Authors:Wizered67
Quote from: Blizzard on January 07, 2008, 08:51:26 pm
Authors: <AUTHORS, NO SPECIAL THANKS HERE>
Play VERY close attention to the template. There is a space between : and the name of the authors.
Sorry about that. I fixed it.
Please try to pay more attention in the future. Thanks.
i got this error with rmx-os 1.17 with 1.15 all wotks fine ...
http://img827.imageshack.us/i/onlinelisterror.png/ (http://img827.imageshack.us/i/onlinelisterror.png/)
thx in advance
When do you get that error? I need more information to help you.
when i wrote the command "online" and ten press enter the error message comes up :???:
Is there an error in the server log? Also, make sure you have the extension for this and blizzards user logger.
no there are now errors with the user logger so idk with 1.15 it works with 1.17 not ...
I can try to help you, but off of what you've given me, I don't know what I can do to help.
at some point in a recent version of RMX-OS Blizz changed how communication worked. that is likely the root of this problem.
When I take a look at this script, you should be able to make this a lot easier. Just iterate through the $clients hash.
usernames = []
$clients.each_value {|c| usernames.push(c.player.username) if c.player.user_id > 0}
onlinelist = usernames.join(',')
Then just send onlinelist over the network. This should work.
hmmm so its actually a bug right?! do you change it pls :roll:
Not really a bug, just something that may need to be added to accomodate for a new version of RMX-OS. It would only have to be a if..else statement to check for the RMX-OS version, or if Blizzard's suggestion works with all versions, simply replace the troublesome part with the error-safe way.
Okay, so its caused by changes in RMX-OS. I'll try to update this script as soon as I can. What exactly was wrong with the old version though that made it not work with the new RMX-OS?
I'm not even sure. Your code looks alright to me at first sight.
You should check the methods you have aliased. One may be called now differently or something like that.
I just tested this with the new RMX-OS and had no problems. That leads me to believe you are doing something wrong. Make sure you have the extension for this and the user logger. That's all I can think would be wrong.
Hello my Heros ;)
I get the same error if i use /online.
Error Log:
Quote2011-06-04 04:31:30 UTC; 2 (test) - Error:
No such file or directory -
./Extensions/OnlineList.rb:40:in `initialize'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Extensions/OnlineList.rb:40:in `open'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Extensions/OnlineList.rb:40:in `client_update'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Data/Client.rb:43:in `block in handle'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Data/Client.rb:43:in `each_value'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Data/Client.rb:43:in `handle'
G:/RPG Maker/Tools/RMX-OS 1.18/RMX-OS Server/Data/Server.rb:272:in `block in run'
Thats my Extension Order:
GlobalDay-and-Night
GlobalSwitches
UserLogger
OnlineList
Report
Versioning
Screen of script editor (.[img] doesn'tshow the picture :/ )
http://imageshack.us/photo/my-images/163/screenxu.png/
I use rmxp 1.04 and the latest scripts. Hope you can find the bug.
The file OnlineList.rb is either mislabeled, not where it is supposed to be, or straight missing.
It should be named just like that and located in the Extensions folder.
It is in the extension Folder. But I give file names like I want.. (you see at the screenshot). All other Scripts are running so I don't think that the file name must be the same like the script name :???: and I write the file names in the Extension array (cfg.ini).
When I start the server the extensions are loaded correctly.
But I will check it again. I'm not home at the moment. Maybe I made a mistake.. it was 5am :zzz:
Edit:
I checked all, the script is loaded after User Logger by the server. In rmxp the Script is below RMX-OS.. no errors. Then /online and crash.. its not working.. I don't think its my failure because all other extensions work.. the documentation is a bit short.. only that User Logger must load before.
This thread is pretty old, but I hope it's still fine that I'm posting, as I have a problem. Namely, the exact same problem as everyone else in this thread. I've triple checked and everything is correct, extension is there, added in the config, it loads after user logger, names are correct and exactly the same everywhere (even the script in the project), but it keeps giving me this error. Not sure what's wrong. I saw this working fine in Pokemon Remexos. :< Any developments on this that haven't been posted?
I believe Blizzard made a script with this functionality that I would advise using, as he is the master ;)
http://forum.chaos-project.com/index.php/topic,13074.0.html
However, should you still want to use this one for any reason, I think I have an updated version I haven't posted that should work.
Ah, I see. Silly me, I was actually going to use that script, but as it only works with RMXOS 1.3 and I've yet to update to that one (figured it's not worth the hassle as Blizz is working on 2.0 already) I forgot about it. I'll just keep waiting, thanks! :P