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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2010, 05:41 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ahh sweet! Thanks Derision!

I kept messing with it, and did try returning a 1 result a couple of times, but I don't think I hit the right combo of how to get it to work. It may just have been that I didn't put a full path in the require and assumed that it would look for the file in the same directory as the NPC script was running from. That was on my list of things to try still, but hadn't gotten that far yet and not at home to test it out.

At the very least, using require should be a perfect way to test out plugins without having to reload the server to do so. Then, you just test them out with require and adjust the needed stuff afterward to use it as a plugin instead for the next restart.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
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
  #3  
Old 01-10-2010, 02:42 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Plugins should be reloading when you do a #reloadqst.
Reply With Quote
  #4  
Old 01-28-2010, 05:39 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Quote:
Originally Posted by KLS View Post
Plugins should be reloading when you do a #reloadqst.
FYI: Yes, plugins reload fine from what I tested.
Reply With Quote
  #5  
Old 01-28-2010, 06:07 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, I had always read that they required a reboot and wasn't able to get the ones I was making working properly when I tested, so I assumed that was how it worked. But, after more work and testing, they definitely do update with a #questreload.

The only problem I see with plugins vs a require() function/sub is that $npc, $client and such are not available inside the plugin unless they are passed into the plugin as an argument. I think plugins would be more useful if they could be passed those variables without having to put them in as an argument.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:56 PM.


 

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