Syntax: .w OR .whisper <PlayerName> <message>
The cmd below works.
But <PlayerName> must be CaSE sensitive in order to find that person and to remove it from the original message. Is there anyway past that? Or another method, with the same syntax?
I've tried lower(text), lower(player.name), but then I start having issues with removing the persons name they're trying to whisper from the string.
Code: Select all
Use uo;
Use os;
Use util;
Program TextCMD_Whisper( Who, Text )
Var xText := Text;
Var xHandle;
If( !xText )
SendSysMessage( Who, "Syntax: .w OR .whisper <PlayerName> <message> - PlayerName is CaSE sensitive." );
Return 0;
Endif
Foreach Player in EnumerateOnlineCharacters()
If( xText[Player.name] )
xHandle := Player;
Break;
Endif
Endforeach
If( !xHandle )
SendSysMessage( Who, "Couldn't find that person." );
SendSysMessage( Who, "Syntax: .w <PlayerName> <message> - PlayerName is CaSE sensitive." );
Return 0;
Else
xText := ( xText - xHandle.name ); // Remove the players name from the string.
SendSysMessage( Who, "<To: " + xHandle.name + ">" + xText );
SendSysMessage( xHandle, "<From: " + Who.name + ">" + xText );
Endif
Endprogram