Page 5 of 5

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Oct 05, 2015 12:46 pm
by noobbotter
Thanks Lisa. I updated my changing between 2 channels using your code.

I also went through and revised it a bit and made it work properly. With the little testing I did, the new script seems to work properly.

Regardless of your starting channel it will complete on one channel then switch to the other (if you happen to be on the non-channel of 3, it will go to 2 next). After finishing the second round, it will wait for new start then complete on that channel again then change to the other.

For some reason, the code I had for revision 1.9 kept erroring out with an XML parsing error in the comments section so I took most of my comments out. Anyway, the new 2.0 version is posted on the first post of this thread.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Oct 05, 2015 7:24 pm
by Sasuke
there is a way to ensure that at the end of each event the player changes the channel immediately and finish the event in the other channel and then return to the first ? What would I change in the script?

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload> 
	--=============================================================================================--
	--===  						NoobBotter's Research Expert EOJ script							===--
	--===  									Version 1.8d											===--
	--===  															  							===--
	--===  	This script will farm Energy of Justice	in Kashaylan using the Research 			===--
	--===   Expert public quest.				  	  											===--
	--===  															  							===--
	--===  	The script will start farming immediately when script starts regardless of 			===--
	--===  	where the event is (started, finished, etc...). After it gets a message that 		===--
	--===  	the event is finished that first time, it will wait for an event start message.		===--
	--===  	Once the Event starting message appears, it will farm until event is complete. 		===--
	--===  	Then if there is more than 5 minutes left in the event, it will change channel 		===--
	--===  	and then farm there until it gets an ending message.								===--
	--===   																					===--   
	--===   This Waypoint has user settings to tell it when to stop, by either max EOJ in 		===--
	--===   inventory, or by amount of time the script has been running. It can stop and rest 	===--
	--===   for an amount of time, and then resume, or run continuously.						===--
	--===   																					===--
	--===   Additionally, I am using Rock5's checkRelog() function to allow you to either end  	===--
	--===   the script, change characters, or load a different waypoint file once this one 		===--
	--===   completes.																			===--
	--===  															  							===--
	--===  	Revision Notes: Added a counter so it will only do 3 channels during a 20 			===--
	--===	minute event. previously, if it was working fast enough, it would go back to the 	===--
	--===	original channel and start doing it there and wouldn't stop until after the next 	===--
	--===	event would start, then it would rest until the complete next event, thus losing 	===--
	--===	lots of time.																		===--
	--===  															  							===--
	--=============================================================================================--
	--===  	*** USER INSTRUCTIONS ***								  							===--
	--===															  							===--
	--===  	1. This script depends on having the DailyNotes Addon activated for auto accepting  ===--
	--===      the Research Expert public quest.												===--
	--===  	2. This script also requires the LoginNextChar userfunction by Rock5.				===--
	--===															  							===--
	--===  	3. Set preferences in the following User Settings section.							===--
	--===															  							===--
	--=============================================================================================--
	
	--===  User Settings  ===--
	local objectClickRest = 200 -- this is the delay time (in milliseconds) that it wait when clicking on one of the flasks. Higher ping time may need a higher value.
	local disableSkills = true 	-- set to true to disable skills, or false to keep skills enabled
	local maxEoj = 4000			-- set to the maximum amount of eoj's you want to have. Script will stop when you reach this amount. I believe in-game maximum is 4000.
	local maxMinutes = 50		-- Maximum amount of time (in minutes) to run the script for. 999 (or greater) will run indefinitely.
								-- the time check is performed between event rounds so if max time is passed during an event, it will complete that event before stopping. 
	
	local restTime = 120			-- this is how many minutes the bot will rest after reaching maxMinutes. A setting of 0 will cause the bot to never start back up after reaching max minutes.
		--=== Examples:					
			-- if you want the bot to run for 2 hours and then take a 3 hour break, set the following settings:
			-- local maxMinutes = 120
			-- local restTime = 180
			
			-- if you want the bot to run for 12 hours and then stop until you manually restart it, set the following:
			-- local maxMinutes = 720
			-- local restTime = 0
	
	When_Finished = "end"
		-- "end" to end script, "relog" to log next character, "charlist" to log next in 'charlist', or filename for next waypoint to load (without .xml).							
	
	CharList = {
	
	}
		-- Character list to use when using the "charlist" option above. Requires Rock5's "userfunction_LoginNextChar" userfunction.
		-- Find it here. http://www.solarstrike.net/phpBB3/viewtopic.php?p=10350
		--		eg.
		--		CharList = {
		--			{account=4,chars={}},
		--			{account=8,chars={1}},
		--			{account=7,chars={1,2,5}}
		--		}
		
	
	-- NO NEED TO EDIT BELOW THIS LINE.

	startChannel = RoMScript("GetCurrentParallelID()")
	yrest(500)
	if startChannel ~= 1 then
		RoMScript("ChangeParallelID(1)")
		repeat
			yrest(4000)
		until RoMScript("GetCurrentParallelID()") == 1
	end
	
	--============= FUNCTIONS ===============--
	
	--============= function to check player location +==============--
	local function locationCheck()
		local myitem = player:findNearestNameOrId(123561) -- Jenn Shadoli
		if myitem then
			if distance(myitem, player) > 50 then
				print("%s is not close enough to start location for this eoj quest.\n")
				checkRelog()
			end
		else
			print("Cannot locate eoj quest giver Jenn Shadoli (ID: 123561).\n")
				checkRelog()
		end
	end
	
	
	--============= function to disable pet and skills for this quest ===============--
	
	function setSkills()
		if disableSkills == true then
			settings.profile.options.EGGPET_ENABLE_ASSIST = false
			for k,v in pairs(settings.profile.skills) do
				v.AutoUse = false
			end
		end
	end
	
	--=== relog function from Rock5's scripts ===--
	function checkRelog()
		
		-- Log result
		local filename = getExecutionPath() .. "/logs/eoj.log";
		local file, err = io.open(filename, "a+");
		if file then
			file:write("Acc: "..RoMScript("GetAccountName()").."\tName: " ..string.format("%-10s",player.Name ).." \tDate: " .. os.date() ..
			"\tEnergy of Justice Gained:"..totalEojEarned.." \tTotal EoJ on character: "..getCurrency("eoj").."\n")
			file:close();
		end

		if When_Finished == "relog" then
			ChangeChar()
			waitForLoadingScreen();
			yrest(3000)
			loadProfile()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "charlist" then
			SetCharList(CharList)
			LoginNextChar()
			loadProfile()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "end" then
			error("EOJ Script is complete")
		else
			loadProfile() -- Because we messed with the skills
			loadPaths(When_Finished)
		end
	end
	
	--=== Function to change channels when needed ===--
	function changeChannel()
		local currentChannel = RoMScript("GetCurrentParallelID()")
		yrest(1000)
		printf("Current Channel is %s\n",currentChannel)
		if currentChannel == 3 then
			currentChannel = 1
		else
			currentChannel = currentChannel + 1
		end
		printf("Changing to channel %s.\n",currentChannel)
		RoMScript("ChangeParallelID("..currentChannel..")")
		repeat
			yrest(4000)
		until RoMScript("GetCurrentParallelID()") == currentChannel
		yrest(4000)
	end
	
	
	--===  Function to target the objects very quickly in succession ===--
	function fastTarget(_objid, waittime)
		obj = player:findNearestNameOrId(_objid)
		player:target(obj.Address)
		yrest(100)
		Attack()
		yrest(waittime)
	end
	
	
	--== main function that loops over, and over, and over ===--
	local function mainfunction()
		setSkills()
		--============= create variables ===============--
		local gomsg = getTEXT("SC_ZONE_PE_3TH_ST1START")
		local endmsg = getTEXT("SC_ZONE_PE_3TH_FAIL")
		local endmsg2 = getTEXT("SC_ZONE_PE_3TH_ST1OVER")
		local startTime = os.time()
		local nextRound = 0
		local roundTime = 0
		local eventFinished = false
		local firstRun = true
		local timerIncorrect = true
		local changedChannels = false
		local eojs = getCurrency("eoj") 
		yrest(500)
		local neweoj = eojs
		local gained = neweoj-eojs
		local totalEojEarned = 0
		local roundendedtime = os.time()
		local roundCount = 1
		repeat				-- Loops once per event.
			eojs = getCurrency("eoj") 
			if firstRun == false then
				eventFinished = false
				roundTime = (os.time()-startTime)/60
				
				nextRound = 20-roundTime
				if nextRound > 5 and 3 > roundCount and timerIncorrect == false then -- if more than 5 minutes remaining in round, change channel:
					cprintf(cli.yellow,"\r%0.1f minutes until next round starts... Changing channel.", nextRound)
					roundCount = roundCount + 1
					changeChannel()
					firstRun = false
					timerIncorrect = false
					changedChannels = true
				else
					repeat
						roundTime = (os.time()-startTime)/60
						if timerIncorrect == false then
							nextRound = 20-roundTime
							
							--============= insert option to change channel and continue =====--
							if 1 > nextRound then
								roundCount = 1
								changedChannels = false
								cprintf(cli.yellow,"\rTime till next round start: %0.1f seconds.",nextRound/60)
							else
								local currentChannel = RoMScript("GetCurrentParallelID()")
								if currentChannel ~= 1 then
									print("Changing to channel 1.\n")
									RoMScript("ChangeParallelID(1)")
									repeat
										yrest(4000)
									until RoMScript("GetCurrentParallelID()") == 1
									yrest(2000)
								end
								roundCount = 1
								changedChannels = false
								cprintf(cli.yellow,"\rTime till next round start: %0.1f minutes.",nextRound)
							end
						else
							changedChannels = false
							--cprintf(cli.red,"timerIncorrect = %s.\t\tfirstRun = %s.",timerIncorrect, firstRun)
							cprintf(cli.yellow,"\rWaiting on next round to start.")
						end
						yrest(500)
					until getLastWarning("|cffffff80"..gomsg.."|r", 10)
				end
				
				if changedChannels == false then
					startTime = os.time()
				end
				if 5 > nextRound then
					print("Event has started...\n")
				else
					print("Continuing event...\n")
				end
				if firstRun == false and timerIncorrect == true then
					cprintf(cli.red,"Finished first round. Now going to wait for official start of a round, staying on Channel 1.\n")
					timerIncorrect = false
					
				end
				cprintf(cli.red,"timerIncorrect = %s.\t\tfirstRun = %s.\n",timerIncorrect, firstRun)
				print("Event has started...\n")
			else
				timerIncorrect = true
				cprintf(cli.yellow,"\rStarting immediately...\n")
			end
			repeat
				player:target_NPC(123561) -- Jenn Shadoli
				yrest(200)
				fastTarget(123369,objectClickRest);
				fastTarget(123368,objectClickRest);
				fastTarget(123508,objectClickRest);
				yrest(200)
				player:target_NPC(123561) -- Jenn Shadoli
				yrest(200)
				if getLastWarning("|cffffff80"..endmsg.."|r", 10) then
					eventFinished = true
				end
				if getLastWarning("|cffffff80"..endmsg2.."|r", 10) then
					eventFinished = true
					
				end			
				printf("Been running for %0.1f minutes.\n", (os.time()-scriptStartTime)/60)
			until eventFinished == true 
			inventory:update()
			yrest(1000)
			neweoj = getCurrency("eoj")
			gained = neweoj-eojs
			totalEojEarned = totalEojEarned + gained
			roundendedtime = os.time()
			roundTime = (roundendedtime-startTime)/60
			cprintf(cli.red,"Round took %s Minutes. EOJ's Gained this round: %s.\t\tCurrent Energy of Justice: %s. \n",roundTime, gained, neweoj)
			
			--=== At start of script, I don't have a timer for when the event will start.                   ===--
			--=== but after first event completes, this variable is set to false so it can display a timer  ===--
			--=== for when the next event will start, located in waitevent() function.                      ===--
			if firstRun == true then  
				firstRun = false
			end
			if neweoj >= maxEoj then
				print("You have reached your maximum number of EoJ's as per the maxEoj variable.\n")
				checkRelog()
			end
			--== section to determine max run time, and rest time ==--
			if 999 > maxMinutes then
				if (roundendedtime-scriptStartTime)/60 >= maxMinutes then
					if restTime == 0 then
						print("Maximum run time has been exceeded.")
						checkRelog()
					else
						printf("Now resting for %s minutes.\n", restTime)
						repeat
							local doneResting = ((roundendedtime/60)+restTime)-os.time()/60
							yrest(6000)
							cprintf(cli.yellow,"\rTime till done resting: %0.1f minutes.",doneResting)
						until 0 >= doneResting
						
						scriptStartTime = os.time()
					end
				end
			end
		until false
	end
	
	locationCheck()
	scriptStartTime = os.time() 	-- to determine total script run time
	mainfunction()

</onload>
</waypoints>

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Oct 05, 2015 8:03 pm
by Sasuke
i have a prob with research rev 20.xml.rombot say me this ...................
kokkkkkkkkkkkkkkkk.jpg

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Oct 05, 2015 8:10 pm
by lisa
It seems to be the & in the commented section, just delete it.

Code: Select all

--===	Does only channels 1, 2, will start on whichever channel you're on 			===--

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Oct 05, 2015 8:27 pm
by noobbotter
Thanks Lisa. It was really bugging me that the commented area was causing that problem. I couldn't figure out why.

Sasuke, make sure you download and use the new 2.0 version. In that version, if you want it to change channels between every single round, you'll see the following on lines 163 and 164:

Code: Select all

cprintf(cli.yellow,"\r%0.1f minutes until next round starts... Changing channel.", nextRound)
					changeChannel()
if you copy those 2 lines in between the "else" on 166 and the "repeat" on 167 that should make it change channels on each round.

After your changes, lines 161 thru 185 will look like this:

Code: Select all

			if firstRun == false then
				if nextRound > 5 and EventComplete == false then -- if more than 5 minutes remaining in round, change channel:
					cprintf(cli.yellow,"\r%0.1f minutes until next round starts... Changing channel.", nextRound)
					changeChannel()
					
				else
					cprintf(cli.yellow,"\r%0.1f minutes until next round starts... Changing channel.", nextRound)
					changeChannel()
					repeat
						roundTime = (os.time()-roundStartTime)/60
						nextRound = 20-roundTime
							
						--============= insert option to change channel and continue =====--
						if 1 > nextRound then
							roundCount = 1
							cprintf(cli.yellow,"\rTime till next round start: %0.1f seconds.",nextRound/60)
						else
							
							cprintf(cli.yellow,"\rTime till next round start: %0.1f minutes.",nextRound)
						end
						
						yrest(500)
					until getLastWarning("|cffffff80"..gomsg.."|r", 10)
				end
			end
let me know if that does it.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Tue Oct 06, 2015 2:56 am
by rock5
noobbotter wrote:Thanks Lisa. It was really bugging me that the commented area was causing that problem. I couldn't figure out why.
If you want to be as expressive as you like without any xml special character limitations you can use the CDATA code, eg.

Code: Select all

<onload><![CDATA[
-- Any characters special to xml will be ignored here such as < and &.
]]></onload>

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Tue Oct 06, 2015 9:49 am
by Stormriser
hey,
tested your new version.
the bot played channel1 -> changed to channel 2 -> played the event on channel 2 -> changed back to channel 1 and wait until next round-> started the event after waiting in channel 1 -> changed to channel 2 after that the bot stoped and i got the message "Time till next round start: -0.1 secounds"
what i have to do that the bot now play the event on channel 2 and after finishing, change back to ch 1 and wait until next round starts?

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Tue Oct 06, 2015 10:31 am
by noobbotter
Hmm... not sure. I'll have to take a look and figure out why it's doing that.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Wed Oct 07, 2015 8:07 am
by Sasuke
i change line but i have the same problem

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Wed Oct 07, 2015 9:05 am
by noobbotter
Looks like you're missing the userfunction for turning on/off DailyNotes' autoquesting. Try adding this userfunction to your userfunctions and see if it works:
userfunction_DN_AutoQuest.lua
DN_AutoQuest userfunction
(1.83 KiB) Downloaded 347 times

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Wed Oct 07, 2015 10:14 am
by Sasuke
ty

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Tue Oct 20, 2015 1:11 am
by Barzoy
Is there a complete workable script available ?? :mrgreen:
I tried many versions and tried to edit myself using keeping in mind all those guidelines you guys have told but always end up fcking something up. :cry:

The script I am using does the event in 1 channel and keeps on doing it for next 20 mins, doesnt even change the channel

Help some1 ??

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Tue Oct 20, 2015 4:13 am
by rock5
If you are wondering, yes, I did crop your picture. :D Learn to crop please.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Sun Nov 01, 2015 4:34 pm
by specialist
Hello everyone.
I'm new here and first thank you for creating such good opportunities for us gamers. :) I'm working for most of my time so I have very little time to play RoM so I was searching a macro to help me farm eoj faster end I ended up here.
I'm really not familiar with coding and C++ or anything else. My only programming experience was Fortran when I was a freshman at university so I'm really lost here.
I started game, downloaded micromacro, started it then load the script on this thread (2nd version) and I keep getting

unexpected symbol near '<'

error.
I checked < symbols in code but I didnt find anything wrong (just compared symbols near < in commands :) )
Also checked other threads to see If I should do something else to run micromacro but as far as I can understand, they were for using other scripts or creating a script. So I decided to ask for help.
With considering that I'm a complete noob and dummy about this, Is there anyway you can help me or should I just quit trying and go on playing manually? :)

Thanks in advance.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Sun Nov 01, 2015 9:11 pm
by BlubBlab
specialist wrote:Hello everyone.
I'm new here and first thank you for creating such good opportunities for us gamers. :) I'm working for most of my time so I have very little time to play RoM so I was searching a macro to help me farm eoj faster end I ended up here.
I'm really not familiar with coding and C++ or anything else. My only programming experience was Fortran when I was a freshman at university so I'm really lost here.
I started game, downloaded micromacro, started it then load the script on this thread (2nd version) and I keep getting

unexpected symbol near '<'

error.
I checked < symbols in code but I didnt find anything wrong (just compared symbols near < in commands :) )
Also checked other threads to see If I should do something else to run micromacro but as far as I can understand, they were for using other scripts or creating a script. So I decided to ask for help.
With considering that I'm a complete noob and dummy about this, Is there anyway you can help me or should I just quit trying and go on playing manually? :)

Thanks in advance.
I think you loaded an XML/waypoint file if it is an < then properly the line above isn't closed properly.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Nov 02, 2015 2:31 am
by specialist
I dont know blubblab.
I downloaded second version of the file in the first message and loaded that. Tried changing its name to .lua and didnt work too. What else can i do?

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Mar 07, 2016 7:13 am
by Sasuke
i have this problem guys....what i must change?i set 1000 where macro said

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Mar 07, 2016 8:18 am
by noobbotter
I'm not sure.. you said you set 1000 where macro said? What do you mean? If you mean the max amount of eojs to earn, it looks like you already have 4994 of them. The defulat setting for maxEoj is 4000, so if you want to keep going, you'll have to set that setting higher (Line 10 of the script). I'm not sure why totalEojEarned turned up nil, but that is only used for the logging portion after the character is done, so that didn't contribute to why it quit running the script.

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Mar 07, 2016 8:33 am
by Sasuke
i set xml as default .i download version 2.0 at the first page of discussion,i change only one section where you asnwer me(check up on this page)
"Sasuke, make sure you download and use the new 2.0 version. In that version, if you want it to change channels between every single round, you'll see the following on lines 163 and 164:"
but macro stop after each event .......can you help?

Re: NoobBotter's Kashaylan Research Expert EoJ Script

Posted: Mon Mar 07, 2016 8:40 am
by noobbotter
nuk, according to the picture you posted 3 posts up, it looks like you're at 4992 eojs. Check the maxEoj variable in script (line 10 I believe) and make sure it is above that value. Maybe change it to "maxEoj = 8000" and see if it runs more than 1 round.