EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Plugins & Mods (https://www.eqemulator.org/forums/forumdisplay.php?f=678)
-   -   Plugin::Whisper() (https://www.eqemulator.org/forums/showthread.php?t=30448)

trevius 01-30-2010 09:17 AM

Plugin::Whisper()
 
Here is simple plugin I made that can be used similar to quest::say(), but instead of saying the message, this will send the message directly to the player only. You can set the color in this plugin to whatever color you would like your whispers to be on your server.

Using this plugin will message the player in this format:

Code:

Soandso whispers, 'Only you can hear this!'
All it is actually doing is getting the name of the NPC and sending it along with your message in that format to the player using $client->Message(). If whispers are something you might like to use, this plugin should save a little time when writing scripts.

Note: This plugin requires that you have at least the "val()" plugin from the post here:
http://www.eqemulator.net/forums/sho...hlight=plugins

If you do not yet have that plugin, you can get it from the PEQ Quest SVN here:
http://projecteqquests.googlecode.co...quests/plugins
The particular plugin file there is named "globals.pl". Make sure you download that and save it to your server /plugins/ folder.

Here are the steps to add this plugin to your server:

1. Open notepad, or whatever text editor you prefer.

2. Copy and paste the following code into Notepad:
Code:

#Usage: plugin::Whisper("Message");

sub Whisper {
        my $TextColor = 315;        #Set the Text Color for the Message (this one is beige)
        my $npc = plugin::val('$npc');
        my $client = plugin::val('$client');
        my $MyMessage = $_[0];        #Use the Message Supplied to the Function - "$_[0]" means to use the first argument given
       
        if ($client) {
                #$client->Message($TextColor, "-");        #Spacer between Text messages to make them easier to read
                my $NPCName = $npc->GetCleanName();        #Get the clean name of the NPC sending the message
                $client->Message($TextColor, "$NPCName whispers, '$MyMessage'");        #Send a message to the player simulating a whisper directly to them from the NPC
        }
}

return 1;        #always leave this line at the end of the script_function.pl file as it is needed by require()

3. Save that file to your server /plugins/ folder and name it "whisper.pl".

4. Do a #questreload and the new plugin should be ready for use :D


One nice thing about this plugin is that you can use find/replace to convert an entire script from quest::say messages to plugin::whisper messages in a matter of seconds. Also, if you use silent saylinks regularly, you might want to uncomment the following line to make it easier to read the NPC text:

Code:

#$client->Message($TextColor, "-");        #Spacer between Text messages to make them easier to read

Akkadius 12-02-2010 10:01 PM

This plugin was added to the repository, I had made a small modification that adds a space before the client message that I do believe you had mentioned you added yourself a while back I am not sure.

Code:

#Usage: plugin::ClientSay("Message"); ###Whisper Modification
#Akkadius
sub ClientSay{
        my $TextColor = 315;        #Set the Text Color for the Message (this one is beige)
        my $npc = plugin::val('$npc');
        my $client = plugin::val('$client');
        my $MyMessage = $_[0];        #Use the Message Supplied to the Function - "$_[0]" means to use the first argument given
        if ($client) {
                my $NPCName = $npc->GetCleanName();        #Get the clean name of the NPC sending the message
                $client->Message($TextColor, " "); ###Gives a blank space in between messages
                $client->Message($TextColor, "$NPCName says, '$MyMessage'");        #Send a message to the player simulating a whisper directly to them from the NPC
        }
}

Both of these are added to client_messages.pl in the repo


All times are GMT -4. The time now is 08:26 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.