EOJ farm function help

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
Maxalu
Posts: 19
Joined: Wed Jun 25, 2014 7:34 am

EOJ farm function help

#1 Post by Maxalu » Thu Sep 25, 2014 7:01 pm

Hi, i have found this function i want 2 chang it but i need some help as always :(

Code: Select all

   function EventStart()
      repeat
       TBES = RoMScript('getevmessage()')
      until (TBES ==  "|cffffff80Wydarzenie regionalne rozpocz\169te ponownie!|r")
      printf("Do dzie\136a !");
   end   
,as I understand it that fnc will do smth when it will get that event message right? So i woudl like 2 pause and unpause the bot i dont know if i need 2 func 2 do that or just 1 my thought of it was like

Code: Select all

   function EventEnd()
      repeat
       TBES = RoMScript('getevmessage()')
      until (TBES ==  "|cffffff80Ewent regionalny uko\241czony pomy\152lnie!|r")
      printf("stop !"); then player:sleep() 
     else
      until (TBES ==  "|cffffff80Wydarzenie regionalne rozpocz\169te ponownie!|r")
      printf("Do dzie\136a !");
     (dont know how 2 make it run again)
   end 
end  

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

Re: EOJ farm function help

#2 Post by rock5 » Thu Sep 25, 2014 11:50 pm

Am I right in understanding that you will run this function after you have finished your events and you want it to wait for the end of event message then wait for the start of event message before continuing? Then it would be something like this.

Code: Select all

function EventEnd()
    repeat
        yrest(100)
        TBES = RoMScript('getevmessage()')
    until (TBES ==  "|cffffff80Ewent regionalny uko\241czony pomy\152lnie!|r")
    printf("Event ended. Now waiting for event start.")
    repeat
        yrest(100)
        TBES = RoMScript('getevmessage()')
    until (TBES ==  "|cffffff80Wydarzenie regionalne rozpocz\169te ponownie!|r")
    printf("Do dzie\136a !");
end  
Note: I don't know what "getevmessage()" is from and don't know exactly what it does. I assume it's from some addon.
  • 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

Maxalu
Posts: 19
Joined: Wed Jun 25, 2014 7:34 am

Re: EOJ farm function help

#3 Post by Maxalu » Fri Sep 26, 2014 3:56 am

rock5 wrote:Am I right in understanding that you will run this function after you have finished your events and you want it to wait for the end of event message then wait for the start of event message before continuing? Then it would be something like this.

Code: Select all

function EventEnd()
    repeat
        yrest(100)
        TBES = RoMScript('getevmessage()')
    until (TBES ==  "|cffffff80Ewent regionalny uko\241czony pomy\152lnie!|r")
    printf("Event ended. Now waiting for event start.")
    repeat
        yrest(100)
        TBES = RoMScript('getevmessage()')
    until (TBES ==  "|cffffff80Wydarzenie regionalne rozpocz\169te ponownie!|r")
    printf("Do dzie\136a !");
end  
Note: I don't know what "getevmessage()" is from and don't know exactly what it does. I assume it's from some addon.
Yes you get it right i want to use this func to wait beetwen public events when they are finished faster. its looks like this im dooing public quests the amount of points to end the event is 5000 let's say i have 4700 and i have just finished my last quest that make the event finished. Now the message apears "Event ended" now i want 2 wait 4 the message "Event started". Actually i dont know also what "getevmessage()" is from I have found it in a script. Is there any other way 2 check messages in the chat?

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

Re: EOJ farm function help

#4 Post by rock5 » Fri Sep 26, 2014 4:23 am

There is a lot of posts about this topic. Let me see if I can scrounge around and come up with a simple function that waits for the event start message. BTW. I don't think there is any need to wait for the end message.

Code: Select all

function waitForEventStart()
	local gomsg = getTEXT("SC_ZONE_PE_3TH_ST1START")
	repeat
		yrest(500)
	until getLastWarning("|cffffff80"..gomsg.."|r", 2)
end
This is supposed to check every half second if the event start message has appeared in the last 2 seconds. I think it's a "warning" message that comes out and not an alert message and I think the color code is correct.
  • 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

Maxalu
Posts: 19
Joined: Wed Jun 25, 2014 7:34 am

Re: EOJ farm function help

#5 Post by Maxalu » Fri Sep 26, 2014 6:39 am

rock5 wrote:There is a lot of posts about this topic. Let me see if I can scrounge around and come up with a simple function that waits for the event start message. BTW. I don't think there is any need to wait for the end message.

Code: Select all

function waitForEventStart()
	local gomsg = getTEXT("SC_ZONE_PE_3TH_ST1START")
	repeat
		yrest(500)
	until getLastWarning("|cffffff80"..gomsg.."|r", 2)
end
This is supposed to check every half second if the event start message has appeared in the last 2 seconds. I think it's a "warning" message that comes out and not an alert message and I think the color code is correct.
ok it worked halfly it waited for the event message made 1 run and then waited once more till the event message so i think the end message is needed

Code: Select all

function EventEnd()
	local endmsg = getTEXT("Ewent regionalny ukończony pomyślnie!") 
        then waitForEventStart()= "true"
end
dont know is ASCI code are needed in the get message or it must get the same words. How 2 implent true and false into thous eventstart and event end fnc?
this is getting more messed up :cry:

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

Re: EOJ farm function help

#6 Post by rock5 » Fri Sep 26, 2014 7:57 am

Maxalu wrote:ok it worked halfly it waited for the event message made 1 run and then waited once more till the event message so i think the end message is needed
You're not making sense. You only run this function when you have finished with the current event. If it does 1 run then waits again and you expect it to keep going then you have run the function again when you shouldn't have. How do you know you have finished with the current event? Do you want to do something after the event has finished but before the next event starts?

Code: Select all

local endmsg = getTEXT("Ewent regionalny ukończony pomyślnie!") 
This is wrong. getTEXT only accepts key strings such as "SC_ZONE_PE_3TH_ST1START". Either use the correct key string or just use the string, eg.

Code: Select all

local endmsg = "Ewent regionalny ukończony pomyślnie!"
Note: the key strings for the end messages are
  • SC_ZONE_PE_3TH_FAIL="Wydarzenie regionalne zakończonyło się."
and
  • SC_ZONE_PE_3TH_ST1OVER="Event regionalny ukończony pomyślnie!"
One is for when the event completes successfully and the other is for when it fails.
  • 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

apacheflyer
Posts: 15
Joined: Sat Apr 05, 2014 7:24 pm

Re: EOJ farm function help

#7 Post by apacheflyer » Sun Oct 26, 2014 12:06 am

I have a somewhat related question. I have 2 characters on the same computer at the same time. One does EOJ's and never loses the countdown clock. Will continue as long as the cpu is on. The other always does. Will only run the one and is done. Loses the clock so it will not restart. I tried doing it on another computer and the same results. Any thoughts on this? Works better having both characters doing the quest.

Thank you!

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

Re: EOJ farm function help

#8 Post by rock5 » Sun Oct 26, 2014 12:22 am

If you monitor for the messages then it shouldn't matter if the clock goes.
  • 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

apacheflyer
Posts: 15
Joined: Sat Apr 05, 2014 7:24 pm

Re: EOJ farm function help

#9 Post by apacheflyer » Sun Oct 26, 2014 6:53 am

No worries and I guess I'll change for that one character. I was more curious why that character and no other. Sort of a head scratcher for me. Thanks

apacheflyer
Posts: 15
Joined: Sat Apr 05, 2014 7:24 pm

Re: EOJ farm function help

#10 Post by apacheflyer » Mon Oct 27, 2014 1:13 pm

Rock, please forgive my lack of knowledge in this. I'm an Army pilot not a code writer...lol

I use this for the EOJ gathering in the quest "keeping the veiled encampment disguised"

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>

--=== set to daily or public ===--
--=== depending which type you want to do. ===--
questtype = "public" -- "public" or "daily"


questname = RoMScript('TEXT("Sys425481_name")')
player:mount()
function doquest(accept)
	if accept then
		if questtype == "daily" then
			local dqCount, dqPerDay = RoMScript("Daily_count()")
			if dqCount ~= 10 then
				player:target_NPC(120577) -- forem mone
				AcceptQuestByName(questname,questtype)
			else
				inventory:update()
				if inventory:itemTotalCount(202434) > 0 then
					inventory:useItem(202434)
					yrest(2000)
					player:target_NPC(120577)
					AcceptQuestByName(questname,questtype)	
				else
					player:sleep()
				end
			end	
		else
			player:target_NPC(120577) -- forem mone
			AcceptQuestByName(questname,questtype)
		end
	else
		if questtype == "public" then
			local __,__,__,Score,Count = RoMScript("PE_GetInfo(1)")
			if Count ~= 2 then
				print("Waiting for event to start")
				yrest(1000)
				repeat
					local __,__,__,Score,Count = RoMScript("PE_GetInfo(1)")
					yrest(1000)
				until Count == 2
			end
		end
		player:target_NPC(120577) -- forem mone
		CompleteQuestByName(questname,questtype)
	end
end
__WPL:setWaypointIndex(1);
</onload>
	<!-- #  1 --><waypoint x="-2663" z="-17962" y="830">doquest() doquest(true)</waypoint>	
	<!-- #  2 --><waypoint x="-2810" z="-18156" y="831"></waypoint>
	<!-- #  3 --><waypoint x="-2932" z="-18027" y="830">inventory:useItem(241196)</waypoint>
	<!-- #  4 --><waypoint x="-2810" z="-18156" y="831">inventory:useItem(241196)</waypoint>
	<!-- #  5 --><waypoint x="-2663" z="-17962" y="830">inventory:useItem(241196)</waypoint>
</waypoints>
How do I convert it to use the msg instead of the clock?

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

Re: EOJ farm function help

#11 Post by rock5 » Mon Oct 27, 2014 10:06 pm

Try this. I created a new function for you called EventState(). It's untested so you'll have to test it.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>

--=== set to daily or public ===--
--=== depending which type you want to do. ===--
questtype = "public" -- "public" or "daily"

function EventState()
	local starttime = getLastWarning( getTEXT("SC_ZONE_PE_3TH_ST1START") )
	local fail = getLastWarning( getTEXT("SC_ZONE_PE_3TH_FAIL") )
	local success = getLastWarning( getTEXT("SC_ZONE_PE_3TH_ST1OVER") )
	local endtime
	if fail == nil then
		endtime = success
	elseif success == nil then
		endtime = fail
	else
		endtime = math.max(fail, success)
	end
	if starttime and (endtime == nil or starttime > endtime) then
		return "started"
	elseif endtime then
		return "ended"
	end
end

questname = RoMScript('TEXT("Sys425481_name")')
player:mount()
function doquest(accept)
	if accept then
		if questtype == "daily" then
			local dqCount, dqPerDay = RoMScript("Daily_count()")
			if dqCount ~= 10 then
				player:target_NPC(120577) -- forem mone
				AcceptQuestByName(questname,questtype)
			else
				inventory:update()
				if inventory:itemTotalCount(202434) > 0 then
					inventory:useItem(202434)
					yrest(2000)
					player:target_NPC(120577)
					AcceptQuestByName(questname,questtype)	
				else
					player:sleep()
				end
			end	
		else
			player:target_NPC(120577) -- forem mone
			AcceptQuestByName(questname,questtype)
		end
	else
		if questtype == "public" then
			if EventState() == "ended" then
				print("Waiting for event to start")
				yrest(1000)
				repeat
					yrest(1000)
				until EventState() == "started"
			end
		end
		player:target_NPC(120577) -- forem mone
		CompleteQuestByName(questname,questtype)
	end
end
__WPL:setWaypointIndex(1);
</onload>
	<!-- #  1 --><waypoint x="-2663" z="-17962" y="830">doquest() doquest(true)</waypoint>	
	<!-- #  2 --><waypoint x="-2810" z="-18156" y="831"></waypoint>
	<!-- #  3 --><waypoint x="-2932" z="-18027" y="830">inventory:useItem(241196)</waypoint>
	<!-- #  4 --><waypoint x="-2810" z="-18156" y="831">inventory:useItem(241196)</waypoint>
	<!-- #  5 --><waypoint x="-2663" z="-17962" y="830">inventory:useItem(241196)</waypoint>
</waypoints>
Note: The EventState function can return 3 values; "started", "ended" or nil. It returns nil when neither the start or end message has appeared yet for the first time. In this case the code will complete the quest anyway. If you want it to wait for the first start message before completing the quest then change this line

Code: Select all

			if EventState() == "ended" then
to

Code: Select all

			if EventState() ~= "started" then
  • 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

apacheflyer
Posts: 15
Joined: Sat Apr 05, 2014 7:24 pm

Re: EOJ farm function help

#12 Post by apacheflyer » Wed Oct 29, 2014 2:30 am

first off I thank you for your efforts.

ok...I got this msg:
[string "..."]:11: bad argument #1 to 'max' (number expected, got nil)

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

Re: EOJ farm function help

#13 Post by rock5 » Wed Oct 29, 2014 2:59 am

I edited the above post. Try it again.
http://solarstrike.net/phpBB3/viewtopic ... 149#p60149
  • 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

apacheflyer
Posts: 15
Joined: Sat Apr 05, 2014 7:24 pm

Re: EOJ farm function help

#14 Post by apacheflyer » Wed Oct 29, 2014 4:42 pm

Works quite well! Thank you! It never stops running....but the point is it runs! lol. Thank you very much!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests