View Full Version : quest::istaskcompleted(taskID) help.
Lillu
05-22-2009, 06:04 PM
Can anyone please post a working Task related perl Quest code?
I tried to use quest::istaskcompleted(taskID) but no luck. Tasks are working great, but I would like the task giver npc to respond properly depending if the player has or already done the task. any hint on the syntax would be nice.
Thank you,
Lillu
Derision
05-22-2009, 06:51 PM
An example of it's use is:
if(quest::istaskcompleted(2004)) {
quest::say("You have completed task 2004");
}
There is a rule, TaskSystem:RecordCompletedTasks which if set to false, would cause this to not work, however the default value is true.
Lillu
05-23-2009, 02:58 PM
Thanks Derision. This works great, besides I don't fully understand how can quest::istaskcompleted(Task_ID) be once a value, once a boolean? :p I might miss something though. But afterall, I got it now, thanks!
sub EVENT_SAY
{
if ($text =~/Hail/i)
{
if (quest::istaskcompleted(20)) {
quest::say ("Hurray, $name the Orc Slayer!"); }
if (quest::istaskcompleted(20)==0) {
quest::say ("Good day adventurer.. If you are bored enough..I might have a [task] for
you.");
$client->Message(6, "Foolin grins evilly."); }
}
if ($text =~/Task/i && quest::istaskcompleted(20)==0) {
quest::say ("There are too many orcs out there, and it just isn't right. Agree? All you
have to do is kill some of em, [will] ya?");}
if ($text =~/will/i && quest::istaskcompleted(20)==0) {
quest::say ("Good luck. I'll wait for you here.");
quest::assigntask(20); }
}
Derision
05-23-2009, 03:08 PM
I may be misunderstanding your comment, but quest::istaskcompleted() returns 0 for false and 1 for true, so:
if(quest::istaskcompleted(20)) {
// do something
}
is the same as:
if(quest::istaskcompleted(20) != 0) {
// do something
}
The first form is just shorthand.
Lillu
05-23-2009, 03:41 PM
thanks a lot, all clear now.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.