Thread: Task System
View Single Post
  #6  
Old 08-07-2011, 03:32 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

This should work better:
Code:
######
#Name: Task
#Author: Kingmen
######

sub EVENT_SAY
{
 #Saylinks
        my $job = quest::saylink("job");

        if($text=~/Hail/i) {
                quest::say("Hi $name, I have a [$job] for you.");
        }
        elsif($text=~/job/i)
        {
                if(!quest::istaskcompleted(quest::lasttaskinset(1)))
                {
                        if(quest::enabledtaskcount(1) == 0)
                        {
                                plugin::Whisper("I haven't seen you before!");
                                quest::enabletask(quest::firsttaskinset(1));
                        }
                        else
                        {
                                $task = quest::activespeaktask();
                                if($task != 0)
                                {
                                        $activity = quest::activespeakactivity($task);
                                        quest::updatetaskactivity($task, $activity);
                                        plugin::Whisper("Well Done!");
                                        if(!quest::istaskactive($task))
                                        {
                                                quest::disabletask($task);
                                                if($task != quest::lasttaskinset(1))
                                                {
                                                        plugin::Whisper("Well done, I ahve another task if you are willing.");
                                                        quest::enabletask(quest::nexttaskinset(1, $task));

                                                }
                                                else
                                                {
                                                        plugin::Whisper("Thank you for all your work.");
                                                }
                                        }
                                }
                                else
                                {
                                }
                        }
                        if(quest::activetasksinset(1) == 0)
                        {
                                quest::tasksetselector(1);
                        }
                }
                else
                {
                        plugin::Whisper("Hail, Conqueror!");
                }
        }
}
I replaced your elseifs with else where appropriate, fixed the typo I mentioned above, and also you had activetaskinset instead of activetasksinset.

I changed the taskset number from 500 to 1, since I already had a taskset 1 I could use for testing, so you will need to change them back to 500. I tested as far as completing the first task and getting assigned the next one.
Reply With Quote