Notification of player login

Barclay

Squire
Jun 3, 2019
123
6
0
Shard Name
Warwickshire
Is there a script or a command that will pop up an alert in my chat box whenever a new player logs onto my shard?
 

PyrO

Moderator
Jan 27, 2015
1,347
193
63
in what kind of chat box? And you can simply hook into the event for that
 

Barclay

Squire
Jun 3, 2019
123
6
0
Shard Name
Warwickshire
you can simply hook into the event for that
I'm sorry - I don't understand what you're saying. What I am hoping to find is a script that works like the official Ultima Online servers. I was a Companion before they shut down the program. Being a Companion meant that every time a [Young] character entered the shard, a system message would appear. I could then jump to the new person or (I think) I could message them,.

What I'm looking for is a way to get a system message in my UO client whenever someone joins the server. I used [admin to jump to them and see if they need help but if there's a script that will do all this that would be brilliant.
 

PyrO

Moderator
Jan 27, 2015
1,347
193
63
What I ment is that you would go and look at the EventSink and then take the Login event and hook into that.
Like this.

C#:
EventSink.Login += OnLogin;
So here you got a full working example that gives a server wide message if a young player logs in.

C#:
using Server.Mobiles;

namespace Server.Custom.LoginMessage
{
    public static class LoginMessage
    {
        public static void Configure()
        {
            EventSink.Login += OnLogin;
        }

        private static void OnLogin(LoginEventArgs e)
        {
            if (((PlayerMobile)e.Mobile).Young)
            {
                World.Broadcast(0, false, "A new adventurer has arrived. The name is " + e.Mobile.Name);
            }
        }
    }
}
 
  • Like
Reactions: Howard57

Joshua

Knight
Sep 13, 2014
606
121
43
35
Bountiful, Utah
Shard Name
My Own Shard
I was a companion too, those were fun times. I admitted I occasionally used my 'powers' for selfish needs. lol
I think i still have the document with the rules they handed out in the IRC chat room.
 

Barclay

Squire
Jun 3, 2019
123
6
0
Shard Name
Warwickshire
Me too... walking around Fel with =TH setup as a hotkey macro incase a red tried to kill me. Excellent.
 
  • Like
Reactions: Joshua

Joshua

Knight
Sep 13, 2014
606
121
43
35
Bountiful, Utah
Shard Name
My Own Shard
It would be easy to set something up like that, although learn from OSI mistake, add a switch that when certain commands are used you become frozen or very limited until the command is used again to return you to the home location. Also allow the command only to work in certain regions. At the beginning stages of the companion program they accidently let a teleport command in, so I made a few runes to some impossible to reach locations.
 

Grimoric

Squire
Mar 21, 2015
219
77
28
45
Sins I collect everything I can find about UO that would be interested it might be something I'm missing or older/newer version.

Here are some related things :D

The GM guide book is 181 MB so I don't add it.

Edit: I was an [companion] on Europa.

-Grim
 

Attachments

Last edited:

Muddling

Citizen
May 12, 2018
12
1
3
I've been working on this script today, and got it to notify whenever a player logged in. That's ok, but it also notifies whenever a staff member logs in. With that, eventually people will know what player accounts belong to GMs as well. I thought about trying to use AccessLevel.Player, but I can't seem to get that to work. Does anyone have any thoughts on this? I want it to NOT broadcast when a staff member logs in.
 

Falkor

Squire
Apr 11, 2018
432
171
43
wpshard.com
Shard Name
Whispering Pines
Changing that section to something like

Code:
        private static void OnLogin(LoginEventArgs e)
        {
        if (e.Mobile.Player)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;
                    if (pm !=null && pm.Young  && (e.Mobile.AccessLevel == AccessLevel.Player) ) //broadcast for young players
                    {
                    World.Broadcast(0, false, "A new adventurer has arrived. The name is " + e.Mobile.Name);
                    }
        }
        }
should do the trick. I haven't actually tested the code since I already have a similar script in place. I think some of my formatting got chewed up in the paste but it should be ok :D
 

Muddling

Citizen
May 12, 2018
12
1
3
Thanks for the quick reply. I'll give it a go!
Post automatically merged:

Thanks Pyro and Falcor. What I ended up with in the end is:

C#:
using System;
using Server.Mobiles;

namespace Server.Custom.LoginMessage
{
    public static class LoginMessage
    {
        public static void Configure()
        {
            EventSink.Login += OnLogin;
        }

        private static void OnLogin(LoginEventArgs e)
        {
        if (e.Mobile.Player)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;
            if (pm !=null && pm.Young  && (e.Mobile.AccessLevel == AccessLevel.Player) ) //broadcast for young players
            {
            World.Broadcast(0, false, "A new adventurer has arrived! Hail and well met " + e.Mobile.Name + "!");
            }
            if (pm !=null && (e.Mobile.AccessLevel == AccessLevel.Player) )
            {
            World.Broadcast(0, false, "Welcome back to our shard " + e.Mobile.Name + "!");   
            }
        }
    }
}
}
 
Last edited:

Falkor

Squire
Apr 11, 2018
432
171
43
wpshard.com
Shard Name
Whispering Pines
If you change the "if" between the two possible broadcast commands to "else if", people will get one message or the other. Otherwise new players will get both messages when they log in since they still meet the conditions of the statement.