Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Wizered67 on February 13, 2013, 07:04:55 pm

Title: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 13, 2013, 07:04:55 pm
RMX-OS Login Messages
Authors: Wizered67
Version: 0.89
Type: RMX-OS Login Notification
Key Term: RMX-OS Plugin



Introduction

A simple script that will alert players when someone logs in or out.


Features






Screenshots
None, use your imagination.


Demo

N/A


Script
Spoiler: ShowHide
[/list]

module RMXOS
 class Network

   alias check_game_login_messages check_game
   def check_game(message)
     case message
   when /\ASCM(.+)\t(.+)/
      if eval($2)
         connect = "Logged in"
       else
         connect = "Disconnected"
       end
     
       self.add_message(nil,"#{$1} Has #{connect}." , RMXOS::Data::ColorInfo, false)
       return true
     end
     return check_game_login_messages(message)
   end
 end
end
   


.rb extension: ShowHide

#------------------------------------------------------------------------------
module RMXOS
 
 def self.load_current_extension
   return LoginMessages
 end
 
end

#======================================================================
# module MOTD
#======================================================================

module LoginMessages
 
 VERSION = 1.00
 RMXOS_VERSION = 1.15
 SERVER_THREAD = false
 
 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 /\ADCT\Z/ # disconnect
connect = false
     client.sender.send_to_all("SCM#{client.player.username}\t#{connect}", false)
   return true
 
 when /\AENT\Z/ # enter server
# broadcast to everybody that a new player has entered the server
connect = true
     client.sender.send_to_all("SCM#{client.player.username}\t#{connect}", true) #login message avictor
      #print "Login: #{@player.username}"
     return true

end
    return false
end
 
end



Instructions

Place the script below RMX-OS and add the extension.


Compatibility

Requires RMX-OS. No other issues none.


Credits and Thanks




Author's Notes

Enjoy! Should be simple, but let me know if you have any problems.
Title: Re: [XP] RMX-OS Login Messages
Post by: MOAL on February 14, 2013, 04:53:05 am
Tested and running without any problems, except the only "Username has logged in." that shows up in the chat is when yourself logs in and nobody else. Otherwise, good job. :) *levels up*
Title: Re: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 14, 2013, 10:12:56 am
Really? The message should be sent to everybody. I'll double check that.
Title: Re: [XP] RMX-OS Login Messages
Post by: Aegisrox on February 14, 2013, 11:43:37 am
Thanks Wizered! It works perfectly! You are awesome :D

Thanks again!

Regards

Aegis
Title: Re: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 14, 2013, 07:56:29 pm
@MOAL I just tested this and it sends the messages to everyone online. If you can reproduce your problem, let me know and I'll look into it.
Title: Re: [XP] RMX-OS Login Messages
Post by: MOAL on February 15, 2013, 06:30:40 am
I basically have two clients open then log one in, and then the other, but it only said that client in specific has logged in. I don't know if it's because I'm using one computer or what, but here's what I'm talking about, the green names are the one who is logged into that client. Username2 is on the left client while Username1 is on the right client:
Spoiler: ShowHide
(http://i48.tinypic.com/nzned2.jpg)
Title: Re: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 15, 2013, 10:11:55 am
Interesting... I have also tested it on one computer and don't have that problem. I'll check that out again overt this weekend.


Edit: Try hitting F6 and scrolling down the chat to see if its been hidden. I've just retested and cannot reproduce the problem.
Title: Re: [XP] RMX-OS Login Messages
Post by: MOAL on February 16, 2013, 05:46:35 am
Oh! You're right. The messages don't seem to follow with new messages, but yes, it does say both have logged in. But, about the chat doing that, is there a way to fix that?
Title: Re: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 16, 2013, 12:46:56 pm
I'm not entirely sure, I remember running into that before. It happens a lot when you change scenes from like the map to the menu screen. Its something in RMX-OS itself.
Title: Re: [XP] RMX-OS Login Messages
Post by: MOAL on February 17, 2013, 11:03:49 am
I've found the problem, it was chat-related extension that was conflicting. I was an idiot and threw it in there to see what it did despite the person who made it saying it wouldn't work and forgot all about it. The chat for me now works perfectly fine even if I switch scenes and everything and it doesn't "un-synchronize" either.

I've also found that having the WASD keys set as the arrows, will make the chat scroll up and down while you type if using those keys in what you're typing, thus making it appear "un-synchronized". So, it may be that instead of the scene issue, because I've tried switching scenes a lot and never had the problem that you said.
Title: Re: [XP] RMX-OS Login Messages
Post by: Wizered67 on February 17, 2013, 03:09:32 pm
Oh okay. Glad you got that fixed. I had the issue when changing scenes a while ago in an old project, so it could have been fixed.
Title: Re: [XP] RMX-OS Login Messages
Post by: Xolitude on February 19, 2013, 11:23:44 pm
How do I make the chat auto-scroll down so people don't have to keep scrolling down to see the chat and messages?