Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #16  
Old 12-04-2012, 05:17 PM
kmra247
Sarnak
 
Join Date: Apr 2012
Posts: 55
Default

I don't see the need to be rude, as I said, I'm new to Perl, I apologize for not knowing everything. But in the saylink, I didn't want him to say "Ring of Armageddon" in purple text and make you click on it, I wanted him to link the item to where you could click on it and see the stats. Like a person linking an item in /ooc and you click on it, except an NPC. But, I guess I can Google it...

Edit: I found the thing it would be "my $roa = quest::varlink(150009);". Thanks to everyone who helped.
Reply With Quote
  #17  
Old 12-04-2012, 05:46 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 965
Default

i balance my helpfulness. you were told multiple times how to check your perl script for syntax errors. You apparently never did it based on the errors in the last one you posted.
That said I still fixed your script. What Cary is referring to is your script is horribly long and repetitive with the only thing changing being an incrementing number. That is the classic best case for a FOR loop. your entire check_handin logic section could shrink to about 15 lines of code.
Reply With Quote
  #18  
Old 12-04-2012, 07:17 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

here's an (untested except for syntax) example of how looping could greatly reduce your code, and due to that, the chance of syntax errors. i added comments directing you to information in the perl documentation (which i sent you links to in my first response) that applies to what i have done here.

Code:
# subroutines covered @ http://perldoc.perl.org/5.12.4/perlsub.html
sub customRoutine {
    # private variables covered @ http://perldoc.perl.org/5.12.4/perlsub.html#Private-Variables-via-my%28%29
    my $itemcount  = shift;
    # lists covered @ http://perldoc.perl.org/5.12.4/perldata.html#List-value-constructors
    # range operator covered @ http://perldoc.perl.org/5.12.4/perlop.html#Range-Operators
    my @validitems = (150009..150107);
    # foreach loop covered @ http://perldoc.perl.org/5.12.4/perlsyn.html#Foreach-Loops
    foreach my $itemid (@validitems) {
        # note: $itemcount is already a hashref, so we don't pass it like we did before
        if (plugin::check_handin($itemcount, $itemid => 1)) {
            quest::say("Well done, $name, you are now level 1 with an upgraded ring.");
            quest::level(1);
            # your reward item always seemed to be the itemid of the handin +1, so this does that
            quest::summonitem($itemid+1, 1);
            quest::ding();
        }
    }
}

sub EVENT_ITEM {
    if ($ulevel > 64) {
        # pass by reference covered @ http://perldoc.perl.org/5.12.4/perlsub.html#Pass-by-Reference
        customRoutine(\%itemcount);
    }
    else {
        quest::say("You're not level 65 yet, $name.");
    }
    plugin::return_items(\%itemcount);
}
Reply With Quote
  #19  
Old 02-22-2013, 09:34 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

This was almost two months ago, no need to necro old posts. ;D
Reply With Quote
  #20  
Old 02-22-2013, 09:40 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

if you haven't caught on yet, he's simply parroting exactly what someone else has said in the thread. :p
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #21  
Old 02-22-2013, 09:55 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

Yeah, I noticed, haha.
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 12:46 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