Dailies as Functions

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Dailies as Functions

#1 Post by beanybabe » Sat Jul 25, 2015 6:18 pm

Working with travelTo for a bit I have found it handy to convert daily to functions. I'm thinking if all daily's are made into functions they could then be added into a main program easily. we could them customize them for the chars we have sending each car to the right daily very easily.
The daily's would need to be scripted to start and end at a portal so travelTo can get to them. they would all have to be in the onload section so the waypoints need to be hand coded.
If we can get a library of daily's this way from level 3 to 92 it would be simple to have 1 script for all chars.
For starters Im gonna try to make just a few of the popular daily's this way.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#2 Post by beanybabe » Sat Jul 25, 2015 7:18 pm

I am having trouble with the logic on this. You have stacks of dailys and move from portal to npc then turn in the dailys and move back to portal. But the code needs to work if you have enough to complete or partly complete or complete and have extras.
Im not sure why but every way I work this it gets stuck in a loop talking to the npc.
...
...

Code: Select all

if dailys not done
     if you have min amount to do a daily
        talk to npc
        turn in dailys
        if out of dailys or dailys are done   
            return
       end
   end
end
                       ---------------another try
  
 questnpcid = npc id
 dailyitem=quest drop id
while inventory:itemTotalCount(dailyItem) >= 5 and dqCount ~= 10 do 
 	player:target_NPC(questnpcid);
	AcceptQuestByName("quest description");
 	player:target_NPC(questnpcid);
	CompleteQuestByName("quest description");
 	local dqCount, dqPerDay = RoMScript("Daily_count()");
end

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

Re: Dailies as Functions

#3 Post by rock5 » Sat Jul 25, 2015 11:17 pm

That looks like it should work except dqCount doesn't have an initial value. It would have to be something like

Code: Select all

local dqCount, dqPerDay = RoMScript("Daily_count()");
while inventory:itemTotalCount(dailyItem) >= 5 and dqCount ~= 10 do 
   ...
   dqCount, dqPerDay = RoMScript("Daily_count()");
end
Or because dqCount is the first value returned and you only use it once you can do

Code: Select all

while inventory:itemTotalCount(dailyItem) >= 5 and RoMScript("Daily_count()") ~= 10 do 
   ...
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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#4 Post by beanybabe » Sun Jul 26, 2015 12:54 am

Im thinking I had trouble with partial situations. each of the following needs to be satisfied as it drops through the code. I think on some of the partials it will get stuck and loop.

Code: Select all

senaros  need 10 to do a daily

 daily complete			   0 items 
dailys complete 		  10 items
dailys complete			 200 items
dailys half complete		    0 items
dailys half complete		   10 items
dailys half complete		 200 items
dailys undone   			     0 items
dailys undone			   50 items
dailys undone			 200 items 
 

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

Re: Dailies as Functions

#5 Post by rock5 » Sun Jul 26, 2015 3:08 am

With

Code: Select all

while inventory:itemTotalCount(dailyItem) >= 5 and RoMScript("Daily_count()") ~= 10 do
daily complete 0 items
  • Skips because daily count == 10
dailys complete 10 items
  • Skips because daily count == 10
dailys complete 200 items
  • Skips because daily count == 10
dailys half complete 0 items
  • Skips because items are < 5
dailys half complete 10 items
  • Does loop because dailies incomplete and have some items to turn in.
dailys half complete 200 items
  • Does loop because dailies incomplete and have some items to turn in.
I don't know what you mean by "dailys undone".
  • 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
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#6 Post by beanybabe » Sun Jul 26, 2015 5:11 am

I just need figure a way to get it to pass thru and not loop. I tried different combinations of if and/or i had it working in regular wp file but cannot seem to get it to work this way. Ill draw a picture and see if I can figure the logic needed. If this works i can convert a bunch of daily's into functions then.

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

Re: Dailies as Functions

#7 Post by rock5 » Sun Jul 26, 2015 7:12 am

The way I wrote it it should work. The way you wrote it it wont work because you declare dqCount and dqPerDay local within the loop after it is checked. So they are treated as separate local variables. When it does the while again the original dqCount is used which hasn't changed. Try one of the examples I showed you.
  • 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
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#8 Post by beanybabe » Mon Jul 27, 2015 12:51 am

RoMScript("Daily_count()") ~= 10 I used this and it worked perfect.
Now I can try and make a few daily functions then make a wp that handles daily's of many levels.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#9 Post by beanybabe » Mon Jul 27, 2015 2:38 am

rogue/warrior is getting a class error.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#10 Post by beanybabe » Wed Nov 25, 2015 7:50 pm

Unfortunately I lost all my work on this do to hard drive data loss. I am searching the forum for the code I needed to work on this again.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#11 Post by beanybabe » Thu Dec 24, 2015 4:32 am

function for scorpion daily in stronghold start at quest board.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
--    scorpian daily   uses 15 scorpain tail spine per daily
--   This is level 40 quest

function dothedaily()	
	local dqCount = RoMScript("Daily_count()")
	print ("dailys =",dqCount)
	if RoMScript("Daily_count()") ~= 10 and inventory:itemTotalCount(201126) >= 5 then
		print ( "Scorpian Tail Spine = ",inventory:itemTotalCount(201126))
		if  inventory:itemTotalCount(201126) >= 15 then  -- scorpian tail spine
		travelTo("GlorySquare")		
			while inventory:itemTotalCount(201126) >= 15 and RoMScript("Daily_count()") ~= 10 do  -- scorpian tail spine
			yrest(300);	
				player:moveTo(CWaypoint(-23172,4509), true)
				player:target_Object(110806) -- Obsidian Stronghold Bulletin Board
					AcceptQuestByName(420444) -- Scorpion
				player:target_Object(110805) -- Maylen
				travelTo("CraftingSquare")
				player:moveTo(CWaypoint(-23591,5836), true)
				player:moveTo(CWaypoint(-22899,6378), true)
				player:moveTo(CWaypoint(-22894,6398), true)
				player:moveTo(CWaypoint(-22956,6660), true)
				player:target_Object(110841) -- Albion
					CompleteQuestByName("Scorpion")
				local dqCount, dqPerDay = RoMScript("Daily_count()");
				player:moveTo(CWaypoint(-22956,6660), true)
				player:moveTo(CWaypoint(-22894,6398), true)
				player:moveTo(CWaypoint(-22899,6378), true)
				player:moveTo(CWaypoint(-23591,5836), true)
				travelTo("GlorySquare")	
			end
		end	
	end
end

dothedaily()
print ( "Scorpian Tail Spine = ",inventory:itemTotalCount(201126))
error("finished")
</onLoad>
</waypoints>
Attachments
dly os scorpian mod.xml
(1.57 KiB) Downloaded 202 times

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#12 Post by beanybabe » Thu Dec 24, 2015 7:36 am

Note.this one fails I need to recreate it.

Quest: Crucial Ingredient for a Legendary Recipe -- Need item: Sweet Demon Bloom Honey
starts at xaviera ruins portal

need to edit and comment the ver1 to --ver1
Attachments
dly xav b swe demon bloom mod.xml
ver 1
(1.9 KiB) Downloaded 205 times

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#13 Post by beanybabe » Sat Jan 09, 2016 8:46 pm

I run into problem with restarting way point from middle on longer way-points. I need some functions like travelto uses to know were the player is and start playing from that location.

Also on class swapping daily's I need function to check if classes are correct for quest and you are on high or low side as needed for path you are moving on.

Its coming down to needing a set of functions specific to daily much like travelto has. Currently I have to start in a specific location and class, if it crashes on swapped class I have to manually finish that part till it is back to the main.

I know standard way points can recover this but they are so hard to create. If I can get these functions to work then daily's can be creates for most way points pretty fast.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: Dailies as Functions

#14 Post by beanybabe » Sun Jan 10, 2016 2:02 pm

This may be what I needed. It a snipit of code from course of terror waypoint. I just need figure how to make it work with my data I use in daily function.

Code: Select all

if zoneid ~= 353 then -- not in Course of Terror
		if 50 > player.Level and (player.Level2 >= 50 or player.Level3 >= 50) then
			-- Wait for user to change class
			cprintf(cli.yellow,"If you want to earn Phirius Shells, change to your 50+ class before continuing.\n")
			player:sleep()
		end
		if inventory:itemTotalCount(240181) > 950 then
			-- Wait for user to use some shells.
			cprintf(cli.yellow,"Reaching the maximum number of Phirius Shells (1000). Please spend some before continuing.\n")
			player:sleep()
			numshells = inventory:getItemCount(240181)
		end
		local empties = inventory:itemTotalCount(0)
		if 10 > empties then
			-- Wait for user to make some space in inventory.
			cprintf(cli.yellow,"Not much space left in inventory. Are you sure you want to continue with only %d spaces left?\n",empties)
			player:sleep()
		end
		if 30 > inventory:itemTotalCount(203038) then
			print("Not enough Phirius Token Coins.")
			logentry = "Not enough Phirius Token Coins."
			checkRelog()
			return
		end

		-- Try to find Malatina and teleport in
		if player:target_NPC(Malatina) then
			yrest(1000)

			if 2 > RoMScript("GetNumSpeakOption()") then -- try again
				player:target_NPC(Malatina) yrest(1000)
			end

			sendMacro("ChoiceOption(2);");
			yrest(2000)

			if RoMScript("GetNumSpeakOption()") > 0 then -- enter game
				sendMacro("ChoiceOption(1);");
				if not waitForLoadingScreen(30) then
					print("Failed to teleport into Course of Terror")
					logentry = "Failed to teleport into Course of Terror."
					checkRelog()
				end
				yrest(1000)
				__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z))
			else
				print("This character already did Course of Terror.")
				logentry = "Already did Course of Terror."
				checkRelog()
			end
		else
			print("You are too far from Malatina")
			logentry = "Too far from Malatina."
			checkRelog()
		end
	end

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest