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
  #2  
Old 08-15-2018, 05:45 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

Welcome to the forums!

First of all, when posting code on here, try to wrap it in [code] blocks. That will make it much easier to read.

Now, onto your code itself. The sub EVENT_SAY is going to trigger once for each time you say something to the NPC. This means that your nested if statements are not going to work as you may be expecting.

For instance,
Code:
if ($text =~/Scale Level/i)
{
     $client->Message(4, "What Level?");
     if($text!~/Hail|Scale Level|ScaleLevel|WhatLevel|What Level/i)
     {
           plugin::ScaleLevel($text);
     }
}
Here, assuming the player chose to scale level, $text is going to be equal to "Scale Level." Once the $client->message line executes, it's immediately going to proceed to the next if statement. Since "Scale Level" will fail your regex check, the plugin::ScaleLevel will not run. The EVENT_SAY sub will then end.

You will need to restructure your code to account for the fact that you will never have different values for $text in the same execution of sub EVENT_SAY.

Also, for efficiency, you should use elsif's so that not every option is checked every time the NPC is spoken too. Right now, if someone hails your NPC, it will run the hail code, and then check every other prompt you have listed as well. It won't cause problems, but it does make the script slower.
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 09:26 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