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
  #5  
Old 12-05-2012, 01:16 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

your logic was a bit convoluted, had redundant checks, and at least one part was never going to be triggered (see highlights). also, when you were incrementing $botcount, it wasn't updating the qglobals, which it seemed to appear what you intended.

Quote:
Originally Posted by Sinclipse View Post
Code:
##Bot Script ##Made by Dirge

sub EVENT_SAY
{
    $botcount = $qglobal{bot_spawn_limit};
    
    if(($ulevel >= 10) && ($botcount == 0))
    {
        $companion = quest::saylink("companion");
        $yes = quest::saylink("yes");
        # we already know $botcount is 0
        if($botcount == 0)
        {
            if($text=~/hail/i)
            {
                plugin::Whisper("Hello there $name; would you be interested in obtaining a [$companion]?");
            }
            elsif($text=~/companion/i)
            {
                plugin::Whisper("Of course, I live to serve. 'Insert info about bot 1'");
            }
            elsif($text=~/yes/i)
            {
                # we already know both of these are true
                if(($ulevel >= 10) && ($botcount == 0))
                {
                    plugin::Whisper("Enjoy your first of many companions.");
                    # this is not updating the qglobal
                    $botcount = $qglobals{bot_spawn_limit} + 1;
                }
                # this will never happen, as we already know $botcount is 0
                else
                {
                    plugin::Whisper("You already have one bot; come back again once you are more experienced.");
                }
            }
        }
    }
    elsif(($ulevel >= 30) && ($botcount > 0 && $botcount < 2))
    {
        $completed = 0;
        $companion = quest::saylink("companion");
        
        if($text=~/hail/i)
        {
            plugin::Whisper("Hello again $name; are you interested in acquiring a second [$companion]?");
        }
        elsif($text=~/companion/i)
        {
            plugin::Whisper("Very well, 'Insert info about bot 2'");
        }
        
        
        ##End Product
        elsif($completed == 1)
        {
            plugin::Whisper("Congratulations $name; here is your second companion.");
            # this is not updating the qglobal
            $botcount = $qglobal{bot_spawn_limit} + 1;
        }
    }
    elsif($botcount >= 2)
    {
        plugin::Whisper("You already have the maximum number of companions; go adventure.");
    }
    else
    {
        plugin::Whisper("Please return when you have acquired enough knowledge.");
    }
}
This is the current code we have, it doesn't work. I've changed the plugin::Whisper to $npcwhisper as well, I can't seem to figure this out, is it something I'm doing wrong in the Database? As, when I tried copying over the Bazaar way of obtaining Bots to a random NPC in Nexus, it STILL didn't work... What's going on with the script, any help would be great.
try this:

Code:
##Bot Script ##Made by Dirge

sub EVENT_SAY
{
    $companion = quest::saylink("companion");
    $yes       = quest::saylink("yes");
    # qglobal not set, assume no bots.
    if (!defined $qglobal{bot_spawn_limit})
    {
        if ($ulevel < 10)
        {
            quest::say("Please return when you have acquired enough knowledge.");
        }
        elsif ($text=~/hail/i)
        {
            quest::say("Hello there $name; would you be interested in obtaining a [$companion]?");
        }
        elsif ($text=~/companion/i)
        {
            quest::say("Of course, I live to serve. 'Insert info about bot 1'");
        }
        elsif ($text=~/yes/i)
        {
            quest::say("Enjoy your first of many companions.");
            quest::setglobal('bot_spawn_limit', 1, 5);
        }
    }
    # qglobal is set to 1
    elsif ($qglobal{bot_spawn_limit} == 1)
    {
        $completed = 0;
        if ($ulevel < 30)
        {
            quest::say("Please return when you have acquired enough knowledge.");
        }
        elsif ($text=~/hail/i)
        {
            quest::say("Hello again $name; are you interested in acquiring a second [$companion]?");
        }
        elsif ($text=~/companion/i)
        {
            quest::say("Very well, 'Insert info about bot 2'");
        }
        ## End Product
        elsif ($completed == 1)
        {
            quest::say("Congratulations $name; here is your second companion.");
            quest::setglobal('bot_spawn_limit', 2, 5);
        }
    }
    # qglobal is > 1
    else
    {
        quest::say("You already have the maximum number of companions; go adventure.");
    }
}
Reply With Quote
 

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 02:16 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