If you use VNc, you can use SuperGumps to do this.

C#:
using System;

using Server;

using VitaNex;
using VitaNex.SuperGumps.
using VitaNex.SuperGumps.UI;

namespace Server.Gumps
{
   public class MyGump : SuperGump
   {
       public static void Initialize()
       {
            CommandUtility.Register("MyGump", AccessLevel.Player, OpenMyGump);
       }

       private static void OpenMyGump(CommandEventArgs e)
       {
            new MyGump(e.Mobile).Send();
       }

       public MyGump(Mobile user)
           : base(user)
       {
           BlockMovement = true;
       }

       public override void CompileLayout(SuperGumpLayout layout)
       {
           base.CompileLayout(layout);

           layout.Add("body", DrawBody);
       }

       protected virtual void DrawBody()
       {
           AddBackground(0, 0, 100, 100, 9270);
       }
    }
}

Otherwise, feel free to extract the relative code from the SuperGump class, there is a lot of back-end stuff going on in order to achieve this.

You may need to test using a non-staff character.
 
I know JustUO had it added. Is VNC a drag and drop? I may try to make the gump the size of the screen. Can not close or move.
 
I suppose the other way to do it would be to add a check to see if the player has the specific gump open in the PlayerMobile.Move/OnMove method.

I tend to stay away from editing distro files directly :)
 
I will try to figure it out on my own. I was just wondering if, using any other STOCK scripts, something like this already applies so I could work off of that.
 
Funny that, VNc also comes with a unique character name registry feature and SuperGump has a property called "Modal", which when true will cause an overlay to appear under the gump that covers the entire screen and forces that gump to stay on top/in focus.

Three birds, one stone.
 
Just to point at this, if this is meant to stop scripts or rather bots from farming or doing different autonomous task, I don't they they would actually "feel" it. Unless you go with a pre AOS shard you can read item properties and such from the tools, positions, sending them packets to use items and all that.

Also the "no moving items" that I feel like won't have an impact to scripts since they too use packets to drag and drop items at specified locations.
 
Hey Tasanar, I hope I am understanding the issue..

How does this sound?

Three Line changes in total.

Code:
  static void OnLogin(LoginEventArgs args)
  {
  Mobile from = args.Mobile;

  if (HasValidName(from))
  return;

  from.SendMessage(33, "Your character name '{0}' is already in use by player character or it has been marked as invalid. Please choose a new one.", from.Name);
  from.RawName = "Generic Player";
  from.SendGump(new NameChangeGump());
  from.Paralyzed = true; // <------- Tasanar add this line here
  }


  public NameChangeGump() : base(50, 50)
  {
  Closable = false; // <------- Tasanar change this line to false



  public override void OnResponse(NetState sender, RelayInfo info)
  {
  if (info.ButtonID != 1)
  return;

  var m = sender.Mobile;
  var nameEntry = info.GetTextEntry(0);

  m.RawName = nameEntry != null ? nameEntry.Text.Trim() : "Generic Player";

  if (HasValidName(m))
  {
  m.SendMessage(66, "Your name has been changed! You are now known as '{0}'.", m.RawName);
  m.Paralyzed = false;// <------ Tasanar add this line here
  }
  else
  {
  m.SendMessage(33, "You can't use that name. Please choose a new one.");
  m.RawName = "Generic Player";
  m.CloseGump(typeof(NameChangeGump));
  m.SendGump(new NameChangeGump());

  }
  }
 
Hey Tasanar, I hope I am understanding the issue..

How does this sound?

Three Line changes in total.

Code:
  static void OnLogin(LoginEventArgs args)
  {
  Mobile from = args.Mobile;

  if (HasValidName(from))
  return;

  from.SendMessage(33, "Your character name '{0}' is already in use by player character or it has been marked as invalid. Please choose a new one.", from.Name);
  from.RawName = "Generic Player";
  from.SendGump(new NameChangeGump());
  from.Paralyzed = true; // <------- Tasanar add this line here
  }


  public NameChangeGump() : base(50, 50)
  {
  Closable = false; // <------- Tasanar change this line to false



  public override void OnResponse(NetState sender, RelayInfo info)
  {
  if (info.ButtonID != 1)
  return;

  var m = sender.Mobile;
  var nameEntry = info.GetTextEntry(0);

  m.RawName = nameEntry != null ? nameEntry.Text.Trim() : "Generic Player";

  if (HasValidName(m))
  {
  m.SendMessage(66, "Your name has been changed! You are now known as '{0}'.", m.RawName);
  m.Paralyzed = false;// <------ Tasanar add this line here
  }
  else
  {
  m.SendMessage(33, "You can't use that name. Please choose a new one.");
  m.RawName = "Generic Player";
  m.CloseGump(typeof(NameChangeGump));
  m.SendGump(new NameChangeGump());

  }
  }

This does not account for any scenario where the gump may no longer be available to the user. I.e they log out.

Since the user may also be paralysed from any other means then it would not be the best way to handle this as you would not know whether or not it was because of the gump they were paralysed and should be unparalysed in the end.

The best way in my opinion would be to subscribe to the movement event and block movement if the playermobile has the gump.

Code:
// Unique Character Names v1.1.1
// Author: Felladrin
// Started: 2013-08-01
// Updated: 2016-01-24

using System;
using Server;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
using Server.Network;

namespace Felladrin.Automations
{
	public static class UniqueCharacterNames
	{
		public static void Initialize()
		{
			EventSink.Login += OnLogin;
			EventSink.Movement += OnMove;
		}

		static void OnLogin(LoginEventArgs args)
		{
			Mobile from = args.Mobile;

			if (HasValidName(from))
				return;

			from.SendMessage(33, "Your character name '{0}' is already in use by player character or it has been marked as invalid. Please choose a new one.", from.Name);
			from.RawName = "Generic Player";
			from.SendGump(new NameChangeGump());
		}

		static void OnMove(MovementEventArgs args)
		{
			Mobile from = args.Mobile;

			if (from.HasGump(typeof(NameChangeGump)))
			{
				args.Blocked = true;
				from.SendMessage("Please enter a valid name");
			}
		}

		static bool HasValidName(Mobile m)
		{
			if (m.AccessLevel != AccessLevel.Player)
				return true;

			if (m.RawName == "Generic Player" || !NameVerification.Validate(m.RawName, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote))
				return false;

			foreach (Mobile otherPlayer in World.Mobiles.Values)
				if (otherPlayer is PlayerMobile && otherPlayer != m && otherPlayer.RawName != null && m.RawName != null && otherPlayer.RawName.ToLower() == m.RawName.ToLower() && m.CreationTime > otherPlayer.CreationTime)
					return false;

			return true;
		}

		public class NameChangeGump : Gump
		{
			void AddBlackAlpha(int x, int y, int width, int height)
			{
				AddImageTiled(x, y, width, height, 2624);
				AddAlphaRegion(x, y, width, height);
			}

			void AddTextField(int x, int y, int width, int height, int index)
			{
				AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
				AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
			}

			static string Center(string text)
			{
				return String.Format("<CENTER>{0}</CENTER>", text);
			}

			static string Color(string text, int color)
			{
				return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
			}

			void AddButtonLabeled(int x, int y, int buttonID, string text)
			{
				AddButton(x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0);
				AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF), false, false);
			}

			public NameChangeGump()
				: base(50, 50)
			{
				Closable = true;
				Dragable = true;
				Resizable = false;

				AddPage(0);
				AddBlackAlpha(10, 120, 250, 85);
				AddHtml(10, 125, 250, 20, Color(Center("Your name is already in use or invalid!"), 0xFFFFFF), false, false);
				AddLabel(73, 15, 1152, "");
				AddLabel(20, 150, 0x480, "New Name:");
				AddTextField(100, 150, 150, 20, 0);
				AddButtonLabeled(175, 180, 1, "Submit");
			}

			public override void OnResponse(NetState sender, RelayInfo info)
			{
				if (info.ButtonID != 1)
					return;

				var m = sender.Mobile;
				var nameEntry = info.GetTextEntry(0);

				m.RawName = nameEntry != null ? nameEntry.Text.Trim() : "Generic Player";

				if (HasValidName(m))
				{
					m.SendMessage(66, "Your name has been changed! You are now known as '{0}'.", m.RawName);
				}
				else
				{
					m.SendMessage(33, "You can't use that name. Please choose a new one.");
					m.RawName = "Generic Player";
					m.CloseGump(typeof(NameChangeGump));
					m.SendGump(new NameChangeGump());
				}
			}
		}
	}
}


That should work, I did not test it though so let me know if there are any issues.
 
Actually I think on logout the character name would remain invalid and the gump would reopen on login until such time as a proper name is given, then the paralyze would be removed.
Since this is a login event, any non movement would be a dangerous situation.
I would assume the admin would realize this and make all initial Character created logins in a safe place where being affected by anything wouldn't be allowed.

However, granted.. I took the easy route.. I suppose an issue could arise somehow.
Also why I changed the gumps closable to false.., I think that should be set this way in both examples.
 
Well this system has been live since my shard went live. Any duplicate names would be known RIGHT away when they start in New Haven. I just want it so when a new player logs in, if the name he picked is already chosen, he MUST pick a new one before moving.
 
dmurphs is a more elegant solution, I would go with that..
I didn't foresee the chance that a paralyze spell could in some odd situation be cast on the person undergoing name change..
which may cause the paralysis for the name change to expire before the proper name is chosen..
It could happen. :)

I would suggest changing this line in either example..
public NameChangeGump()
: base(50, 50)
{
Closable = true; <---- change to false, so the user cant dismiss the gump
 
Last edited:
Even though this has been solved.
If anyone cares about the VNc feature, this is how you turn it on/off;

Use Command: [VNC SRV
Find Service: Player Name Registry

ai.imgur.com_yA2fvDI.png

ShareNames = false
Will force players to rename their character upon login, using a dialog that blocks their speech, movement and mouse interaction.
It also detects duplicate names based on character age, so people who picked their name first will never be forced to change should something happen and a newer player acquires the same name.

This service also doubles as an API/SDK for maintaining a registry of all used player names and fetching data from the registry.
 
Looks cool! Small similarity to an admin menu I made back in the day..lol.. check it out..
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
The choppy video isn't the game its the free program I used to make the video.. that server is greased lightning. :)

I'll have to check yours out!

This emu was made pre-RunUO btw
 
Back