[XP] RMX-OS Login Messages

Started by Wizered67, February 13, 2013, 07:04:55 pm

Previous topic - Next topic

Wizered67

February 13, 2013, 07:04:55 pm Last Edit: February 13, 2013, 07:30:56 pm by KK20
    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


    • Displays login messages

    • Easy to use





    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


    • Me

    • Blizzard of course




    Author's Notes

    Enjoy! Should be simple, but let me know if you have any problems.

    MOAL

    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*

    Wizered67

    Really? The message should be sent to everybody. I'll double check that.

    Aegisrox

    Thanks Wizered! It works perfectly! You are awesome :D

    Thanks again!

    Regards

    Aegis
    Crushing girls in the vanishing point......

    Wizered67

    @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.

    MOAL

    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

    Wizered67

    February 15, 2013, 10:11:55 am #6 Last Edit: February 15, 2013, 11:20:09 pm by Wizered67
    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.

    MOAL

    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?

    Wizered67

    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.

    MOAL

    February 17, 2013, 11:03:49 am #9 Last Edit: February 17, 2013, 11:07:38 am by MOAL
    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.

    Wizered67

    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.

    Xolitude

    How do I make the chat auto-scroll down so people don't have to keep scrolling down to see the chat and messages?