Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #12  
Old 01-10-2010, 09:43 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yup, I tested the require as Derision posted it, and it works perfectly as far as I can tell. Here is an example one that I made and tested tonight:

/home/eqemu/server/quests/functions/script_functions.pl
(note I added a new folder named "functions" to my quests directory)
Code:
# Script file to hold various subroutines and functions for multiple scripts to use

sub NPCWhisper {
	my $TextColor = 315;	#Set the Text Color for the Message (this one is beige)
	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()
And here is an example NPC script that makes use of that function:

TestNPC.pl:
Code:
require '/home/eqemu/server/quests/functions/script_functions.pl';

sub EVENT_SAY { 
	if ($text=~/Hail/i)
	{
		NPCWhisper("Hello, $name.  How do you like my whisper?);
	}
}
The cool part about this function is that you can open almost any script and do a find/replace and replace the words "quest::say" with "NPCWhipster" and it should automatically convert all say messages into whispers that no one else can hear.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3