accept quest by name
Posted: 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:Not really. I'll change it.Do you really need to use a second argument?
OK, I'll change this, too.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.
[Edit]:
My changed version:What came to my mind though.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
Sometimes there are quests where you have to choose a reward.
Any idea on how to implement this?