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 07-13-2009, 01:47 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

I should start by saying that I have limited experience with perl or regular expressions.

Something like that, but instead of using quotations:
Code:
$say = player text
quest::summonitem("$say");
It should be:
Code:
quest::summonitem($say);
You could simply enough have it check if the string the player said was an integer and then summon that. I think that would be the following:
Code:
if($text=~/\d{1,6}/) {
quest::summonitem($text);
}
Someone who has more regex experience than me should double check that, but I think that strips everything except for the integer digits (minimum 1 digit, max 6).

edit: not sure what would happen if someone said for example '10061 13001', I think it might call summonitem(10061 13001) which should return an error. Also, you probably want to check the return value of summonitem (if it has one) and see if it found the item or not, if not the npc could say that there was no item found.
Reply With Quote
  #2  
Old 07-13-2009, 01:54 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

It would be 10x easier just to lower the status requirement for summon item instead. You can change the command's status individually to suit your needs, meaning you can give them access to just summon item if you like. I configure mine in command.cpp but I believe if you are using current EQEMU code, you can simply change the status in the database.

It is either in the rules table or there is a table called commands that lists these status levels in your database. The default status level for a player is 10 so change it to 10 and you're good to go.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #3  
Old 07-13-2009, 03:13 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Thanks pyfon for the reply. I will see what I can do with your suggestion.

Yeormon, I know I can just change the command in the DB but whats the fun in that. At least this way I can give players the ability to summon items but I can control it a bit more than just giving them the command.

I could create this into a quest where they have to do a turn in in order to be able to summon one item of thier choice. Or have the NPC spawn on the death of a very high level raid encounter.

I was trying to get a bit creative with it. This way the players will have to work for it, but it is still obtainable.

Just giving out #summonitem to everyone can ruin the game for someone fast. But if you have a character that you maxed out, and you finally can get to the NPC then you have earned it!
Reply With Quote
  #4  
Old 07-13-2009, 03:30 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Ok this works but I need to polish the quest a bit since it returns the following after everything you say to the npc even hails. But I just wanted to see if the item summon funtion works before I ironed out the details and it does.

Code:
No such item: 0
Code:
#############
#Written By : Cubber
#Quest Name: #summonitem proxy
#Quest Zone: Cshome
#Quest NPC: Krakskull
#################
sub EVENT_SAY
{
   if($text=~/Hail/i)
      {
         quest::say("Hello there $name,  Need some [items summoned]?");
      }
if ($text=~/items summoned/i)

                        {
                                quest::say("In order for me to summon an item for you I need to know it's ID number.  Please do a #itemsearch itemname and just tell me the number next to the item.");
                        }

                                if ($text=~/\d{0,9}/)
                                        {
                                                quest::summonitem("$text");     
                                        }


}
This successfully summons the item into your players cursor.

Thanks for the help pfyon!
Reply With Quote
  #5  
Old 07-13-2009, 03:43 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

You could replace the if statements after the first one with elsif statements. It's what I do whenever I work on quests unless I need it to check the text more than once separately.

The way I figure, if someone says (for example) "hail items summoned", I only want the hail text, not both the hail and items summoned. It also reduces server load (slightly) by not needing to evaluate every if, it just stops when something evaluates true.

This would keep the number checking code from being executed when they say hail or items summoned, which is a start. Other stuff would still trigger it though.
Reply With Quote
  #6  
Old 07-13-2009, 03:44 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

elsif worked perfectly thanks!
Reply With Quote
  #7  
Old 07-13-2009, 04:13 PM
Dibalamin
Hill Giant
 
Join Date: Dec 2007
Posts: 182
Default

How can you make it store a text string? Been thinking about a bot to do guilds.
__________________
Retired EMarr
Project1999 Developer
Reply With Quote
  #8  
Old 07-13-2009, 03:35 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

I should also note that someone who says '1some2thing som3et45hing' might get it picked up as id 12345, I suggest you look up perl regular expressions on google and do some testing.
Reply With Quote
  #9  
Old 07-13-2009, 03:39 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Yup I will have to fix the script to get rid of the errors and to make it a bit cleaner like you say. Just wanted to figure out if it was possible or not first, and ... well ... it looks like it is!
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 09:11 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