Log in

View Full Version : Task System


Kingmen30264
08-06-2011, 08:44 PM
I found my way into tasks, but I am undergoing and issue when it comes to setting it up to allow when a user approaches the task npc, it checks to see where they are at and it keep count if they have done it or not and also allows them have the next task in line.

I followed this guide here:


http://www.eqemulator.net/wiki/wikka.php?wakka=TaskSystemTaskSets


Here is what I have written up so far. Could someone please look this over and tell me where I am wrong?


######
#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(50 0))) {
if(quest::enabledtaskcount(500) == 0) {
plugin::Whisper("I haven't seen you before!");
quest::enabletask(quest::firsttaskinset(500));
}
elsif {
$task = quest::activespeaktask();
if($task != 0) {
$activity = quest::activespeakactivity($task);
quest::ipdatetaskactivity($task, $activity);
plugin::Whisper("Well Done!");
if(!quest::istaskactive($task)) {
quest::disabletask($task);
if($task != quest::lasttaskinset(500)) {
plugin::Whisper("Well done, I ahve another task if you are willing.");
quest::enabletask(quest::nexttaskinset(500, $task));

}
elsif {
plugin::Whisper("Thank you for all your work.");
}
}
}
elsif {
}
}
if(quest::activetaskinset(500) == 0) {
quest::tasksetselector(500);
}
}
elsif {
plugin::Whisper("Hail, Conqueror!");
}
}
}


The tasks themselves work. I tested them BEFORE I composed this.

Also I created a "TaskSet" in the taskset table using:


INSERT INTO `taskset` (`id`, `taskid`) VALUES (500, 500);
INSERT INTO `taskset` (`id`, `taskid`) VALUES (500, 501);


From what I understand on this, the first column (id) refers to the ID of the taskset you wish to denote it and the second column (taskid) refers to the actual task(s) themselves (In this case 500 and 501 for my tasks).

Like I said, they work just fine...... individually, but if I were to try and pair them up and make them sequential, then I get nowhere.

Any and all help on this would be great.

Thank you,
Kingmen

joligario
08-06-2011, 11:34 PM
Just glancing over the code... elsif what?

Kingmen30264
08-07-2011, 01:46 PM
I just followed what he had done. What part of the code are you referring to with "elsif"....

sorvani
08-07-2011, 02:23 PM
An elsif requires a logic statement just like an if

Derision
08-07-2011, 02:34 PM
quest::ipdatetaskactivity($task, $activity);

Is one error that jumps out at me.

Derision
08-07-2011, 03:32 PM
This should work better:


######
#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.

Kingmen30264
08-07-2011, 05:00 PM
Thank you very much Derision, I will give this a test run and see if it I can't use this sometime in the future. I really enjoy the way you have this set up as well, it is VERY clean, and allows me to look at what you have done and could potentially open a lot of doors for me.

Thanks to all that gave me responses as they were all informative as well =)

Kingmen30264
08-07-2011, 09:20 PM
I was looking at this, and I changed ALL of them to reflect my taskSET ID in my DB, but when I complete the first task, she just keeps offering it to me. Now if I have the task, she won't offer it to me, she will just "ignore" me.

How do I make it go to the next task?

*EDIT* It works just fine (The last part) on my character that I tested the quests with.

*EDIT* I tested it out with the Cleansing of Qeynos Hills task, but it keeps returning Part 1 when I want Part 2 to come up.

(Sorry for all these questions, I am sure it is something that I am simply missing, or not doing, but that is why I am here asking, to learn it :) )

Derision
08-08-2011, 01:37 PM
I tested the whole of the Cleaning Qeynos Hills task chain just now with the script I posted above. The only way I can get it to fail in the manner you describe is if I have a syntax error, or other error with the quest::enabletask command after the 'Well done, I have another task if you are interested.

i.e.

plugin::Whisper("Well done, I ahve another task if you are willing.");
quest::enabletask(quest::nexttaskinset(1, $task)); <--- Check you have the correct task set and no errors on this line

If you are sure the line is correct, take a look in your character_enabledtasks right after you finish the first task to see if the second task is getting enabled.

Kingmen30264
08-08-2011, 06:05 PM
Okay, well I checked this, and I even copied and pasted your script directly to the NPC task, and it is still not working. When I checked the character_enabledtasks table, it shows it as 11, 7 (11 being my chars' ID and 7 being the quest.) I have completed it several times, and it keeps giving me the SAME task, over and over again.

I tested it against my main char RIGHT NOW (He has yet to attempt this line of tasks) and he was able to complete it just fine, but when he returned to my task NPC, all she does it repeat:


Hi $name, I have a [job] for you.


I checked the character_enabledtasks window and it didn't update from 1, 7 to 1, 8(I am presuming this is the next one in the line-up based on tasks table).

How do I make it update the character_enabledtasks table? I am doing everything that I know with no effect =\

Kingmen30264
08-16-2011, 12:56 AM
*Bump* Sorry to bump this post, I was just wondering if anyone had anything that might help me in my endeavor.

Thanks for any posts.