Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Blizzard on April 21, 2013, 02:52:00 pm

Title: [XP] Online Awareness for RMX-OS
Post by: Blizzard on April 21, 2013, 02:52:00 pm
Online Awareness for RMX-OS
Authors: Blizzard
Version: 1.0
Type: RMX-OS Plugin
Key Term: RMX-OS Plugin



Introduction

This script allows you to view the list of the players currently online, on the same map and optionally notify the player each time a player connects and/or disconnects.

This script is to be distributed under the same terms and conditions like the script it was created for: RMX-OS.


Features




Screenshots

N/A for this sort of script.


Demo

N/A


Script

Just make a new script above main and paste this code into it.
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Online Awareness for RMX-OS by Blizzard
# Version: 1.0
# Type: RMX-OS Plugin
# Date: 12.6.2013
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: RMX-OS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed below RMX-OS and requires RMX-OS to work
#   properly. This script allows you to view the list of the players currently
#   online, on the same map and optionally notify the player each time a player
#   connects and/or disconnects.
#   
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !defined?(RMXOS) || RMXOS::VERSION < 2.0
  raise 'ERROR: The "Online Awareness" requires RMX-OS 2.0 or higher.'
end

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  # set to false if you want to disable login/logout messages
  ONLINE_AWARENESS_SHOW_LOGIN_LOGOUT = true
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end

#==============================================================================
# module RMXOS
#==============================================================================

module RMXOS
 
  #============================================================================
  # module Documentation
  #============================================================================
 
  module Documentation
   
    PARAMETERS['online']   = 'none'
    PARAMETERS['onmap']    = 'none'
    DESCRIPTIONS['online'] = 'Displays the players currently online.'
    DESCRIPTIONS['onmap']  = 'Displays the players currently on the same map.'
   
  end
 
  #============================================================================
  # module Data
  #============================================================================
 
  module Data
   
    OnlineAwarenessLoggedIn     = 'PLAYER has logged in.'
    OnlineAwarenessLoggedOut    = 'PLAYER has logged out.'
    OnlineAwarenessPlayers      = 'Currently online: PLAYERS'
    OnlineAwarenessNoPlayers    = 'No one else is currently online.'
    OnlineAwarenessMapPlayers   = 'Currently on the same map: PLAYERS'
    OnlineAwarenessNoMapPlayers = 'No one else is currently on the same map.'
   
  end
 
  #============================================================================
  # Network
  #============================================================================
 
  class Network
   
    def add_info2(message)
      self.add_message(nil, message, RMXOS::Data::ColorInfo)
    end
   
    alias check_game_online_awareness_alias check_game
    def check_game(message)
      if BlizzCFG::ONLINE_AWARENESS_SHOW_LOGIN_LOGOUT
        case message
        when /\ADCT\t(.+)/ # disconnection message
          id = $1.to_i
          if self.players.has_key?(id)
            self.add_info2(RMXOS::Data::OnlineAwarenessLoggedOut.sub('PLAYER',
                self.players[id].username))
          end
          # does not return as original processing still needs to be done
        when /\AENT\t(.+)\t(.+)\t(.+)\t(.+)/ # server entry message
          name = $2
          self.add_info2(RMXOS::Data::OnlineAwarenessLoggedIn.sub('PLAYER', name))
          # does not return as original processing still needs to be done
        end
      end
      return check_game_online_awareness_alias(message)
    end
   
    alias check_normal_commands_online_awareness_alias check_normal_commands
    def check_normal_commands(message)
      case message
      when /\A\/online\Z/
        names = self.players.values.map {|player| player = player.username}
        if names.size > 0
          self.add_info2(RMXOS::Data::OnlineAwarenessPlayers.sub('PLAYERS',
              names.join(', ')))
        else
          self.add_info2(RMXOS::Data::OnlineAwarenessNoPlayers)
        end
        return true
      when /\A\/onmap\Z/
        names = self.map_players.values.map {|player| player = player.username}
        if names.size > 0
          self.add_info2(RMXOS::Data::OnlineAwarenessMapPlayers.sub('PLAYERS',
              names.join(', ')))
        else
          self.add_info2(RMXOS::Data::OnlineAwarenessNoMapPlayers)
        end
        return true
      end
      return check_normal_commands_online_awareness_alias(message)
    end
 
  end
 
end




Instructions

In the script in the first comment.


Compatibility

Requires RMX-OS to work.


Credits and Thanks




Author's Notes

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Title: Re: [XP] Online Awareness for RMX-OS
Post by: isnortmana on April 21, 2013, 10:48:14 pm
so I guess this replaces rmxos-logger/onlinelist

EDIT:i got a lot of problems after trying this it said remote restart requires a higher version of rmxos (I don't even use remote restart)
Title: Re: [XP] Online Awareness for RMX-OS
Post by: Blizzard on April 22, 2013, 02:17:14 am
Whoops, I didn't change that text.
Yes, this requires RMX-OS 1.3. I put it up because of the people who are beta testing RMX-OS 1.3. You will have to wait another week or two before RMX-OS 1.3 is out.

It doesn't replace my user logger, but it does replace the online list and login/logout notifications that Wizerd made (I think he made both).
Title: Re: [XP] Online Awareness for RMX-OS
Post by: Xolitude on April 22, 2013, 03:09:09 am
This plugin/script looks amazing! ;O

Can't wait to try it out!
Title: Re: [XP] Online Awareness for RMX-OS
Post by: isnortmana on April 22, 2013, 05:10:13 am
Quote from: Blizzard on April 22, 2013, 02:17:14 am
Whoops, I didn't change that text.
Yes, this requires RMX-OS 1.3. I put it up because of the people who are beta testing RMX-OS 1.3. You will have to wait another week or two before RMX-OS 1.3 is out.

It doesn't replace my user logger, but it does replace the online list and login/logout notifications that Wizerd made (I think he made both).


ah I see well cant wait to use either
Title: Re: [XP] Online Awareness for RMX-OS
Post by: Blizzard on June 12, 2013, 01:07:12 pm
Updated to work with the newly released RMX-OS 2.0.