RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Yell default command working as a Chat System

Felladrin

Sorceror
Yell default command working as a Chat System

Introduction:

I wanted to have a global chat system to use on a small casual shard. Using the default uo chat system was not fast, and the other system released here on forums were much more than I wanted.

So I thought giving a new use for the Yell command, as it's rarely used. Just needed to change it to send a broadcast message.


Exclamation.


Exclamation + Space-Bar.


Exclamation + Space-Bar + Your Message.


Everyone in the game will see your broadcast message.

Making the change:

Open your PlayerMobile script (Scripts/Mobiles/PlayerMobile.cs).

Find the line: public override void DoSpeech

You should see this on an unmodified script:

Code:
public override void DoSpeech( string text, int[] keywords, MessageType type, int hue )
{
	if( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) )
	{
		(...)
	}
	else
	{
		base.DoSpeech( text, keywords, type, hue );
	}
}

Now you just need to add the following green lines:

Code:
public override void DoSpeech( string text, int[] keywords, MessageType type, int hue )
{
	if( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) )
	{
		(...)
	}
[B][COLOR="Green"]        else if( type == MessageType.Yell )
	{
		Server.Commands.CommandHandlers.BroadcastMessage( AccessLevel.Player, 0x482, String.Format( "{0} says: {1}", this.RawName, text ) );
	}[/COLOR][/B]
	else
	{
		base.DoSpeech( text, keywords, type, hue );
	}
}

Save, close and restart the server to see the results.

Some Notes:

I used RawName because the property Name can be temporally changed with some systems, but RawName is always the same.

You can change the string format to whatever you want, just need keep the "{0}" (Palyer Name) and "{1}" (Text the player wrote).

To change the color of the messagem, just edit the "0x482" to the hue code of your choice.

It's good for small and/or private shards. Maybe on big shards it could bring chaos.

There's no ban/mute player option, and Squelch the player won't stop him. If you want this feature and much more, I suggest Knives' Chat 3.0.

Just remove the green lines and restart the server if you don't want it anymore.

Please, if I wrote something wrong, tell me, and feel free to comment.

Have fun!

Felladrin.
 

ashftw

Sorceror
Pretty cool - useful for the small family/friends shards i bet.

I did something similar to this some time ago, I think you can spam msgs almost to the top of the screen though so on a big shard it'd probably get abused.
 

Felladrin

Sorceror
Thank you two for your kind words!

Just a note: If you want to use this, and make squelched players not to be able to talk, add the following code instead:

Code:
[COLOR=Green]            else if( type == MessageType.Yell )
            {
               if ( this.Squelched == true )
                   this.SendMessage( "You can not say anything, you have been squelched." );
               else
                   Server.Commands.CommandHandlers.BroadcastMessage( AccessLevel.Player, 0x482, String.Format( "{0} says: {1}", this.RawName, text ) );
            }[/COLOR]
 

moneo

Sorceror
This is a great idea.
I notice in 7.0 clients by pressing comma "," you get a Chat: prompt. I wonder if thers a way to bind it to this command rather than messagetype.yell , so it operates similar to the new OSI chat.

Im guessing a new messagetype would need defining in packethandlers to capture stuff sent by Chat:

Anyone have any ideas on this?
 

voicer

Sorceror
yes i also would like to know if there's a way to use the "," chat prompt similiar to this Yell script above. anyone found a solution?
 

Corrado

Sorceror
I'd also love to have the comma "Chat:" system working. I've been playing with the above code and trying to get it to work with the comma command and can't get it.

Any ideas?
 

_Epila_

Sorceror
I am working on default UO Chat with the "," command and using the default client menus and based on runuo default chat engine
Just replace the original runuo chat with this one. Dont know if there are any bugs and the code may be a bit confusing, since its not intended to be a release, but you're free to use and release it if you want
 

Attachments

  • Chat.zip
    5 KB · Views: 18

Trip3033

Sorceror
I am working on default UO Chat with the "," command and using the default client menus and based on runuo default chat engine
Just replace the original runuo chat with this one. Dont know if there are any bugs and the code may be a bit confusing, since its not intended to be a release, but you're free to use and release it if you want

an improvement for this is in channel.cs line 85 change
Code:
initiator.Serial.Value
to
Code:
Name
for channel name instead. Why would you want to know players serial value? :| lol i changed it to Channel name it looks better. that way players know what channel they're in.
 

moneo

Sorceror
I am working on default UO Chat with the "," command and using the default client menus and based on runuo default chat engine
Just replace the original runuo chat with this one. Dont know if there are any bugs and the code may be a bit confusing, since its not intended to be a release, but you're free to use and release it if you want

Good job Epila! Tested this briefly with Classic and Enhanced clients against latest runuo SVN. Its working good.
It has been a long time since RunUO has worked with client chat- this should have its own forum thread.
 
Top