Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2012, 03:13 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default another short one

this plugin will reduce the length of quest conditions where multiple qglobals are checked in a single statement.

Code:
# checks that quest globals are defined and set to values passed in parameters
# usage: my $flagged = plugin::IsFlagged(key=>val, ...);
sub IsFlagged
{
    my %flag = @_;
    return 0 unless %qglobals;
    while (my ($key, $val) = each %flag) {
        return 0 unless defined $qglobals{$key} and $qglobals{$key} == $val;
    }
    1;
}
this, for example:
Code:
if (defined $qglobals{bic}     && $qglobals{bic}     == 10
&&  defined $qglobals{bic_fer} && $qglobals{bic_fer} == 11
&&  defined $qglobals{bic_riw} && $qglobals{bic_riw} == 10
&&  defined $qglobals{bic_bar} && $qglobals{bic_bar} ==  6
&&  defined $qglobals{bic_qin} && $qglobals{bic_qin} ==  4) {
    # do whatever here
}
becomes this:
Code:
my $flagged = plugin::IsFlagged(bic=>10, bic_fer=>11, bic_riw=>10, bic_bar=>6, bic_qin=>4);
if ($flagged) {
    # do whatever here
}
or this:
Code:
if (plugin::IsFlagged(bic=>10, bic_fer=>11, bic_riw=>10, bic_bar=>6, bic_qin=>4)) {
    # do whatever here
}

Last edited by c0ncrete; 12-13-2012 at 03:15 PM.. Reason: removed die
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 03:03 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