Rock5's DN_AutoQuest userfunction

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Rock5's DN_AutoQuest userfunction

#1 Post by rock5 » Wed May 27, 2015 12:55 am

Description:
  • This userfunction sets up DailyNotes to auto complete/accept the supplied quest Id.
Syntax:
  • DN_AutoQuest(questid)
Requirements:
Attachments
userfunction_DN_AutoQuest.lua
Version 1
(1.35 KiB) Downloaded 343 times
  • 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

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: Rock5's DN_AutoQuest userfunction

#2 Post by noobbotter » Tue Jun 09, 2015 7:25 am

Rock5,

I found the need to be able to disable autoquesting in Dailynotes. (for being able to do separate quests from a bulletin board for example) so I modified your Autoquest userfunction to allow me to do so. Feel free to take a look and make any changes to suit your preferences and re-share/update the post.

Added optional argument of "on" or "off" to enable automated turning off of autoaccepting quests:
DN_AutoQuest(questid, [state]) -- optional state should be "on" or "off". Default is "on". Anything other than ("off" or "Off" or "OFF") will turn the autoaccept of the specified quest on, including nil.

So at the beginning of my waypoint file, I will do

Code: Select all

QuestID = 123456  -- ID of Quest
DN_AutoQuest(QuestID) 	-- activate DailyNotes Autoquest 
then at the end of the waypoint, I will use

Code: Select all

DN_AutoQuest(QuestID,"off")
to turn off auto accepting of that quest.

NoobBotter


Update: Come to think about it, I never did do a check to see if my update actually disables the autoquest of a particular quest. It doesn't throw an error so I assumed it works. Maybe tonight I'll verify if it actually does what I intended.
Attachments
userfunction_DN_AutoQuest.lua
(1.85 KiB) Downloaded 205 times

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

Re: Rock5's DN_AutoQuest userfunction

#3 Post by rock5 » Wed Jun 10, 2015 2:45 am

I did think about adding a cancelling feature, I was thinking of a separate function, but, funnily enough, I couldn't decide on a name. That, and I wasn't sure of the necessity, so I didn't bother. Your solution is elegant enough. A few comments though.

This is not proper lua code

Code: Select all

	if state == ("off" or "Off" or "OFF") then
It should be

Code: Select all

	if state == "off" or state == "Off" or state == "OFF" then
Because onoff has 2 possible values I would probably used booleans and in case users expect to use booleans I would add that too. Eg.

Code: Select all

	if state == "off" or state == "Off" or state == "OFF" or state == false then
onoff starts as 1 so all you need to do is decide if you need to change it to 0. You never have to change it to 1. So

Code: Select all

	local onoff = 1
	if state == nil then
		onoff = 1
	end
	if state == "off" or state == "Off" or state == "OFF" or state == false then
		onoff = 0
	else
		onoff = 1
	end
Could be abbreviated to

Code: Select all

	local onoff = 1
	if state == "off" or state == "Off" or state == "OFF" or state == false then
		onoff = 0
	end
Otherwise it's good to go.
  • 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's DN_AutoQuest userfunction

#4 Post by rock5 » Wed Jun 10, 2015 2:57 am

I just realized you don't even need 2 variables. You can do this.

Code: Select all

function DN_AutoQuest(questid, onoff)

...

	if onoff == "off" or onoff == "Off" or onoff == "OFF" or onoff == false then
		onoff = 0
	else
		onoff = 1
	end
  • 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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest