accept quest by name

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

accept quest by name

#1 Post by lisa » Thu Feb 03, 2011 7:37 am

JackBlonder has been doing some great work, unfortunately I started it in Rock5's todo list so I decided it would be better to continue discussion in a new topic.
JackBlonder wrote:
Do you really need to use a second argument?
Not really. I'll change it.
1. RoMScript should be used instead of sendMacro so you don't get so much junk messages and
2. When searching for a quest name, once found it can break from the loop so it stops searching.
OK, I'll change this, too.

[Edit]:
My changed version:

Code: Select all

function AcceptQuestByName(_name)
	
	_name = _name or "All"
	local questToAccept = _name 
	local questOnBoard = ""
	local i
	
	-- Accept all available quests
	if (_name == "" or _name == "All" or _name == "ALL" or _name == "all") then
		printf("We accept all quests\n")
		for i = 1,RoMScript("GetNumQuest(1)") do
			RoMScript("OnClick_QuestListButton(1, "..i..")") -- Clicks the quest
			yrest(100)
			RoMScript("AcceptQuest()") -- Accepts the quest
		end
	
	-- Accept a quest by quest name
	else
		for i = 1,RoMScript("GetNumQuest(1)") do
			questOnBoard = RoMScript("GetQuestNameByIndex(1, "..i..")")
			if questOnBoard == questToAccept then
				RoMScript("OnClick_QuestListButton(1,"..i..")") -- Clicks the quest
				yrest(100)
				RoMScript("AcceptQuest()") -- Accepts the quest
				break
			end
		end
	end
end

function CompleteQuestByName(_name)

	_name = _name or "All"
	local questToComplete = _name
	local questOnBoard = ""
	local i
	
	-- Complete all available quests
	if (_name == "" or _name == "All" or _name == "ALL" or _name == "all") then
		for i = 1,RoMScript("GetNumQuest(3)") do
			RoMScript("OnClick_QuestListButton(3, "..i..")") -- Clicks the quest
			yrest(100)
			RoMScript("CompleteQuest()") -- Completes the quest
		end
	
	-- Complete a quest by quest name
	else
		for i = 1,RoMScript("GetNumQuest(1)") do
			questOnBoard = RoMScript("GetQuestNameByIndex(3, "..i..")")
			if questOnBoard == questToComplete then
				RoMScript("OnClick_QuestListButton(3,"..i..")") -- Clicks the quest
				yrest(100)
				RoMScript("CompleteQuest()") -- Completes the quest
				break
			end
		end
	end
end
What came to my mind though.
Sometimes there are quests where you have to choose a reward.
Any idea on how to implement this?
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: accept quest by name

#2 Post by JackBlonder » Thu Feb 03, 2011 7:41 am

Thanks lisa.
Here's the userfunction file (is it possible now to name the userfunctions userfunction_xxx.lua instead of addon_xxx.lua?)
Attachments
addon_QuestByName.lua
(1.63 KiB) Downloaded 103 times

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: accept quest by name

#3 Post by lisa » Thu Feb 03, 2011 7:43 am

I've been testing this and it works great, just a few things that can be improved on.

1. The text for the quest name needs to be exact in every way. Wondering if we can work on making it work if not exact, like search for partial? So "stolen" would still work for "Stolen Tools" or atleast make it so doesn't need to be caps like "stolen tools"

2. Adding in a printf to print in MM window that the quest has been accepted.

3. Add in a printf for when there is no quest matching text.

4. The accept "All" seems to skip some and gets around half available, maybe add in a small pause after each accept?

Edit, yes you can use userfunction_xxx.lua (not plural) and we actually would prefer it =)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: accept quest by name

#4 Post by JackBlonder » Thu Feb 03, 2011 11:12 am

I've made some modifications.
1. The text for the quest name needs to be exact in every way. Wondering if we can work on making it work if not exact, like search for partial? So "stolen" would still work for "Stolen Tools" or atleast make it so doesn't need to be caps like "stolen tools"
The function now accepts "Stolen tools", "stolen tools", "sToLEN tOOlS", etc.
Furthermore "-" in questnames are ignored. I'll add other special characters later.
Not done yet: Accepting just a part of the questname (like "stolen").
2. Adding in a printf to print in MM window that the quest has been accepted.
Added.
3. Add in a printf for when there is no quest matching text.
Added.
4. The accept "All" seems to skip some and gets around half available, maybe add in a small pause after each accept?
I changed the routine of accepting and completing.
It now tries to accept until queststate is "incomplete" (means accepted)

Happy bug hunting ;)
Every feedback is welcome
Attachments
userfunction_QuestByName.lua
(2.98 KiB) Downloaded 107 times

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: accept quest by name

#5 Post by lisa » Thu Feb 03, 2011 11:41 am

Very nice work yet again, one flaw with the

Code: Select all

until (getQuestStatus(questOnBoard)=="incomplete")
If you already have the requirements to hand in the quest then it hangs indefinately. Might need to add in "or complete" aswell.

Code: Select all

until (getQuestStatus(questOnBoard)=="incomplete") or (getQuestStatus(questOnBoard)=="complete")
I just did it like this, works well.

Rock5 any chance we can have this function added to next revision??
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: accept quest by name

#6 Post by JackBlonder » Fri Feb 04, 2011 10:41 am

Added this and removed a little copy paste bug.

Code: Select all

until (getQuestStatus(questOnBoard)=="incomplete") or (getQuestStatus(questOnBoard)=="complete")
I'll try to implement word compare now

[Edit]
Word comparison implemented.
Next step: reward selection

Usage:
AcceptQuestByName() --Accept all available quests
AcceptQuestByName("word") --Accept first quest in list with "word" in it's name
CompleteQuestByName() --Complete all available quests
CompleteQuestByName("word") --Complete first quest in list with "word" in it's name
Attachments
userfunction_QuestByName.lua
(4.19 KiB) Downloaded 125 times

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: accept quest by name

#7 Post by lisa » Fri Feb 04, 2011 8:48 pm

Awesome work yet again
Tested and works perfectly, I'll be the first to admit it is a lot better then I could have done =)

This might be of interest to you
http://www.theromwiki.com/API:SpeakFram ... uestReward
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: accept quest by name

#8 Post by rock5 » Fri Feb 04, 2011 11:34 pm

A few comments I'd like to make on this thread.

1. JackBlonder should have started it. Lisa you should have suggested he start a new thread instead of starting it yourself.
2. It should probably be added to the repo page.
3. The first post should be used for releasing new versions.

I'm not sure what should be done. Should I try moving JackBlonders second post to the top? Should he just start a new thread for his "repo" version? Maybe I could just delete Lisas first post so JackBlonder is first?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: accept quest by name

#9 Post by lisa » Fri Feb 04, 2011 11:55 pm

You are absolutely right Rock5.

I think best way to go forward would be for Jackblonder to create a topic in the userfunctions section and attach his latest file to that post and go from there.
Adding it to the repository is also a very good idea and link it to the new topic in userfunctions section.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: accept quest by name

#10 Post by JackBlonder » Sat Feb 05, 2011 5:45 am

No problem. I'll start a new thread and set a link to it here and at the repo page.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests