Page 1 of 1

cant get the status of a quest

Posted: Sun May 27, 2012 5:40 pm
by Rickster
Hi,

dealing with quests is normaly no problem for me. usually i use the functions from userfunction_QuestByName()
AcceptQuestByName()
CompleteQuestByName()

and in other places i deal with
OnClick_QuestListButton(..), AcceptQuest(), CompleteQuest()

but with all these i need getQuestStatus() to get to know wheter a quest is completed or not.

now i have one quest wich getQuestStatus() does not seem to get information about.

the quest id is 424163
the german questname is: "Grippe? Vergiftet!"

i tried following code snippet to test

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	repeat questname=RoMScript("TEXT('Sys424163_name')"); yrest(500) until questname; -- "Grippe? Vergiftet!"
	queststatus = getQuestStatus(questname);
	printf("Questname: %s\n", questname);
	printf("Queststatus: %s\n", queststatus);
	error("Finished",0);

</onLoad>
</waypoints>
the questname is returned correctly.
but getQuestStatus() always returns "not accepted" wheter i have the quest in my questbook or not, completet or incomplete.
i also tried with getQuestStatus(questid), which also does not work.

do you have got any ideas?

Ric

Re: cant get the status of a quest

Posted: Sun May 27, 2012 7:36 pm
by BillDoorNZ
I always use CheckQuest for determining if the quest is accepted / complete

Re: cant get the status of a quest

Posted: Sun May 27, 2012 7:44 pm
by Rickster
Thanks Bill :)

i modified my test wp file

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
while true do
	repeat questname=RoMScript("TEXT('Sys424163_name')"); yrest(500) until questname; -- "Grippe? Vergiftet!"
	queststatus = getQuestStatus(424163);
	printf("Questname: %s\n", questname);
	printf("Queststatus: %s\n", queststatus);
	printf("No. of queststatus: %s\n",RoMScript("CheckQuest(424163)"));
	player:sleep();
end

</onLoad>
</waypoints>
but CheckQuest(questid) allway returns "2" for this quest, wether accepted, incomplete or not complete.

Re: cant get the status of a quest

Posted: Sun May 27, 2012 9:43 pm
by BillDoorNZ
Its because the quest is a daily quest that you have completed previously.

On a character that has never accepted or completed this quest, the return value is 0 :)

Re: cant get the status of a quest

Posted: Mon May 28, 2012 6:02 am
by rock5
Looks like it doesn't like the question mark. Easy way to fix it is use

Code: Select all

getQuestStatus("Grippe. Vergiftet!")
'.' means 'any character' when searching strings. getQuestStatus actually does "normalise" the string but at the moment it only fixes "-" and """. We would have to add "?".

I'll add it to my next commit. I've got another nice one coming up to do with item classes such as 'bank', 'guildbank' and 'equipment' classes. And I've encormporated super fast item moving. :)

Re: cant get the status of a quest

Posted: Mon May 28, 2012 6:51 am
by rock5
I just had an idea.

The 'correct' solution, that I avoided mentioning before, is to fix the 'igf_questStatus' function in the 'ingamefunctions' file to ignore the special meaning of those special characters. It should have been done that way in the beginning. The reason we haven't done this before is because all the users who have been managing by changing them to periods ".", like the example I used above, would stop working because now the special meaning of '.' would also be ignored.

Anyway I just had an idea how I can fix it so all older code using periods will still work and also 'unnormalised' names will also work. So both

Code: Select all

print(getQuestStatus("Flu.  Poisoned!"))
and

Code: Select all

print(getQuestStatus("Flu?  Poisoned!"))
would work.

I just tried it, it works. All I had to do is check if there are any '.' in the string. If there are, then it does a pattern match. If not it does a plain match which ignores special characters.

I don't know why I didn't think of it before.

I'll also include this in the next commit.

Re: cant get the status of a quest

Posted: Mon May 28, 2012 12:53 pm
by Rickster
ok, thanks :)

i now set the quest title manually

Code: Select all

	questname = "Grippe. Vergiftet!"
and then call

Code: Select all

	getQuestStatus(questname)
which works fine.

although it works, it includes no automatic localisation for other languages like this code would do

Code: Select all

questname=RoMScript("TEXT('Sys424163_name')")
so i am curious about your upcoming changes roc :)

thanks so far
Ric

Re: cant get the status of a quest

Posted: Mon May 28, 2012 12:59 pm
by rock5
I did a review of the changes today and I think I'm happy with it but they are pretty extentive so I'll probably run them for a couple of days before releasing. I could commit the fix for this now though. It's no trouble really.

Re: cant get the status of a quest

Posted: Mon May 28, 2012 1:33 pm
by rock5
Ok Committed in rev 718.

But don't use

Code: Select all

questname=RoMScript("TEXT('Sys424163_name')")
use

Code: Select all

questname=GetIdName(424163)
Which gets the name of any id directly from memory without the need of a RoMScript.

Re: cant get the status of a quest

Posted: Mon May 28, 2012 2:04 pm
by Rickster
i changed to GetIdName(ID) in this script ... big changes to change in all scripts :D

RoM bot 718 works great. now i can get and use the questname automatically! thanx!

Re: cant get the status of a quest

Posted: Mon May 28, 2012 2:11 pm
by rock5
GetIdName is not new. It's been around for a long time. You'll probably see it used in a lot of the uploaded waypoints on the forum.

Well you learn something every day after all. :D