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 10-04-2015, 08:24 AM
Soak
Sarnak
 
Join Date: Mar 2015
Posts: 33
Default Event_Task_Complete question

I have about 40 tasks that end in the same zone and have the same reward (in addition to the item/exp rewarded in the actual task). My player.pl looks like this:

Code:
sub EVENT_TASK_COMPLETE{
	if($task_id == 311){
		quest::ding();
		$client->AddAAPoints(2);
		$client->Message(4, "You receive two additional AA!");
	}
	
	if($task_id == 312){
		quest::ding();
		$client->AddAAPoints(2);
		$client->Message(4, "You receive two additional AA!");
	}
	
}
etc....

Can I simplify this so that the one event has multiple task_id's rather than filling up the player.pl with 40 different ones?

I know this is probably a simple PERL thing, but with all the info coming into my brain lately, I just can't seem to find it. The more I learn, the more respect I have for all you guys who have helped create this community. I'm also a little jealous of y'alls skills! Wish it came so easy to me.

Thanks for your help as usual!
Reply With Quote
  #2  
Old 10-04-2015, 03:48 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

Simply change 'MAXID' to your highest ID, assuming they're all in a range:
Code:
sub EVENT_TASK_COMPLETE {
    if($task_id ~~ [311..MAXID]) {
        quest::ding();
        $client->AddAAPoints(2);
        $client->Message(4, "You receive two additional AA!");
    }
}
~~ Is the smartmatch operator that attempts to match the left operand to the any data in the right operand, similar to a grep of an array.
Reply With Quote
  #3  
Old 10-04-2015, 04:35 PM
Soak
Sarnak
 
Join Date: Mar 2015
Posts: 33
Default

Awesome! Solved my issue and learned something new and useful! Thanks Kingly.
Reply With Quote
  #4  
Old 10-04-2015, 04:53 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

You're welcome, feel free to send me a private message if you have any further questions.
Reply With Quote
Reply


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 02:52 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3