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 02-19-2013, 10:56 AM
Disorder
Hill Giant
 
Join Date: Apr 2010
Location: USA
Posts: 133
Default

[QUOTE=c0ncrete;218378]i'd do something like this, but i'm extremely picky...

Code:
    elsif (                                 # consume knife only if
        $ulevel < 6                         # client is under level 6
        && !defined $qglobals{jep_knife}    # and has not turned it in yet
        && plugin::check_handin( \%itemcount, 1377 => 1 )
      )
    {
        # FYI: this will allow another turn-in after 30 minutes...
        quest::setglobal( "jep_knife", "1", "4", "M30" );
        quest::exp("20000");
        quest::ding();
    }

    # if the knife has already been turned in
    # and the client is attempting to turn it in again
    my $knife_back = 0;
    if ( defined $qglobals{jep_knife} && defined $itemcount{1377} ) {
        plugin::Whisper( "Oh, $name, you already brought my knife back. "
              . "Thank you though! You can have this one back." );
        my $knife_back = 1;
    }

    # determine how many items are left in %itemcount to return
    # NOTE: we're counting the knife if it has not been addressed above
    # because ( $ulevel > 5 && !defined $qglobals{jep_knife} ) is possible
    my $return_count = ( scalar keys %itemcount ) - $knife_back;

    # if we're returning at least one item that we have not addressed,
    # then we'll use some additional item return flavor text
    # NOTE: %itemcount will always have at least one key (0)
    if ( $return_count > 1 ) {

        # this is the text template we'll use in the call to sprintf
        my $return_template = "I don't want %s. Here, take %s back, $name.";

        # if we have more than 1 item going back that is not addressed,
        # use plural nouns... otherwise, use singular nouns
        my @return_noun =
          $return_count > 2
          ? ( "these", "them" )
          : ( "this", "it" );

        # put the template and the nouns together here
        plugin::Whisper( sprintf $return_template, @return_noun );
    }

    # give stuff back
    plugin::return_items( \%itemcount );
}
I used this code and when the knife is returned after q globals is set, he says the return statement for the knife specifically and the return statement for all other items. Any idea why? Also, can you explain how %return_count and sprintf work?
__________________
Disorder
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 07:56 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