Page 3 of 4

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Mon Mar 04, 2013 7:23 pm
by lisa
haringpb wrote:doesn´t work anymore can we get an update or could anybody explain how i could update it?
Had a quick look and not only did the base address change a lot so did 2 of the pointers, it would be a pain to have to update this every patch.

I thought people said when the event dissappeared off screen the memory reads also failed, are you saying they used to still work for you when the event data on screen vanished?
Because if that is the case then the memory read isn't doing anything that a romscript couldn't do.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Tue Mar 05, 2013 10:16 am
by haringpb
Well the fact that you could read out the time in ms, till event start, was important for me, but if there is anouther way i would take this as well.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Tue Mar 05, 2013 6:36 pm
by lisa
make sure your PC clock is set to a time that is atleast close to when the event time is, event starts at :10 :30 :50
then you can use this function to rest until the time for event.
So basically you want your PC time set to server time.

Code: Select all

function restTilEvent()
	local curtime = os.date("*t")
	if curtime == nil then print("failed to get time from OS") return end	-- probably not needed
	local curmins = curtime.min
	local cursecs = curtime.sec
	if curmins > 50 then
		curmins = curmins - 50
	elseif curmins > 30 then
		curmins = curmins - 30
	elseif curmins > 10 then
		curmins = curmins - 10
	else
		curmins = curmins + 10
	end
	-- should now have value of 1 to 20
	local resttime = ((20 - curmins) * 60) - cursecs
	print("resting for "..resttime.." seconds")
	yrest(resttime*1000)
end
--=== Added ===--

I was actually hoping someone would have been able to work out that all you need is this

Code: Select all

repeat
yrest(700)
until os.date("*t").min%20 == 10
Oh well =(

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Wed Mar 06, 2013 6:17 am
by haringpb
glad that you helped out here thanks a lot

Important for those who want to work with this as you can see i didnt use 10; 30 and 50 because it is not allways the same after patch day. On top the part where it says: i curmins > x then curmins - y. Y has to be x-1 outher ways you could get a value of zero (why ever) and a yrest of -20s which would allude to an error. And you should also add a yrest(60000) at the top, to take care that not in the same minuite where the event starts it ends and you try to do it again.

Code: Select all

function restTilEvent()
   yrest(60000)
   local curtime = os.date("*t")
   local curmins = curtime.min
   local cursecs = curtime.sec
   if curmins > 48 then
      curmins = curmins - 47
   elseif curmins > 28 then
      curmins = curmins - 27
   elseif curmins > 8 then
      curmins = curmins - 7
   else
      curmins = curmins + 10
   end
   -- should now have value of 1 to 20
   local resttime = ((20 - curmins) * 60) - cursecs
   print("resting for "..resttime.." seconds")
   yrest(resttime*1000)
end

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 07, 2013 4:39 am
by haringpb
Ok after a day of testing this is my script i will use:

Code: Select all

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

function restTilEvent()
   local curtime = os.date("*t")
   if curtime == nil then print("failed to get time from OS") return end   -- probably not needed
   local curmins = curtime.min
   local cursecs = curtime.sec
   local curmins = curmins%20
   print(curmins)
   	if curmins > 7 then
		local resttime = ((27-curmins)*60) - cursecs
		if resttime > 0 then
	        print("resting for "..resttime.." seconds")
		yrest(resttime*1000)
		end
  	else
  		local resttime = ((7- curmins)* 60) - cursecs
		if resttime > 0 then
                print("resting for "..resttime.." seconds")
		yrest(resttime*1000)
		end
  	end
end

function isEventFinished()
      local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
      if Count ~= 2 then
         return true
      else
         return false
      end
end


function doquest()
	if isEventFinished() == true then
    		 restTilEvent()	
		 if isEventFinished() == false then
  		 inventory:useItem("Arrowhead Carved with Name")
   	       	 RoMScript("AcceptBorderQuest()")
  		 RoMScript("ScriptBorder:Hide()")
   		 player:target_NPC("Myan Kellas")
  	 	 CompleteQuestByName("Last Luck","public")
		 end
   	else
  		 inventory:useItem("Arrowhead Carved with Name")
  		 RoMScript("AcceptBorderQuest()")
  		 RoMScript("ScriptBorder:Hide()")
  		 player:target_NPC("Myan Kellas")
  		 CompleteQuestByName("Last Luck","public")
    	end
end

</onload>

   <!-- #  1 --><waypoint x="-2699" z="-17935" y="810">
    doquest()   
   </waypoint>
</waypoints>
this is for the event starting at .:07 ..:27 and ..:57. If you have outher timers on you server you got to change all the 27 and 7.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 07, 2013 4:45 am
by lisa
haringpb wrote:this is for the event starting at .:07 ..:27 and ..:57. If you have outher timers on you server you got to change all the 27 and 7.
You will probably find that your PC clock is 3 minutes different to the servers clock.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 07, 2013 6:51 pm
by newton666
this way point

Code: Select all

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

function restTilEvent()
   local curtime = os.date("*t")
   if curtime == nil then print("failed to get time from OS") return end   -- probably not needed
   local curmins = curtime.min
   local cursecs = curtime.sec
   local curmins = curmins%20
   print(curmins)
      if curmins > 7 then
      local resttime = ((27-curmins)*60) - cursecs
      if resttime > 0 then
           print("resting for "..resttime.." seconds")
      yrest(resttime*1000)
      end
     else
        local resttime = ((7- curmins)* 60) - cursecs
      if resttime > 0 then
                print("resting for "..resttime.." seconds")
      yrest(resttime*1000)
      end
     end
end

function isEventFinished()
      local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
      if Count ~= 2 then
         return true
      else
         return false
      end
end


function doquest()
   if isEventFinished() == true then
           restTilEvent()   
       if isEventFinished() == false then
         inventory:useItem("Arrowhead Carved with Name")
                 RoMScript("AcceptBorderQuest()")
         RoMScript("ScriptBorder:Hide()")
          player:target_NPC("Myan Kellas")
          CompleteQuestByName("Last Luck","public")
       end
      else
         inventory:useItem("Arrowhead Carved with Name")
         RoMScript("AcceptBorderQuest()")
         RoMScript("ScriptBorder:Hide()")
         player:target_NPC("Myan Kellas")
         CompleteQuestByName("Last Luck","public")
       end
end

</onload>

   <!-- #  1 --><waypoint x="-2699" z="-17935" y="810">
    doquest()   
   </waypoint>
</waypoints>
  
 
anyone else haveing a problem with this?
it hands in the 1st quest fine but then it won't retake the arrow quest again? anyone know's what wrong

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 07, 2013 9:52 pm
by lisa
I find that if you aren't sure why something isn't doing what you expect it to do then it is a good idea to add in prints so you can know for sure what it is doing, when you work out what is wrong then you can fix what ever it is =)

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Fri Mar 08, 2013 12:05 am
by rock5
Didn't I read something about the arrow giving alternately a daily quest and then a public quest? Maybe the second time you got the daily quest.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Fri Mar 08, 2013 2:38 am
by lisa
May aswell set it to do daily until all dailies are done anyway as you still get the event points when doing daily

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Tue Mar 19, 2013 1:25 pm
by haringpb
So with todays patch we got the upportunity to get a chat message when event starts and when it ends. So we could do wait for startmassage, doquest till endmassage. But im not able to make the 2 functions maybe someone could help ;)

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Fri Mar 22, 2013 12:46 am
by lisa

Code: Select all

--EventMonitorStart("eventchat", "SYSTEM_MESSAGE");

-- local time, moreToCome, name, msg = EventMonitorCheck("eventchat",1)

-- if name == getTEXT("SC_ZONE_PE_3TH_FAIL") then -- event ended

-- if name == getTEXT("SC_ZONE_PE_3TH_ST1START") then -- event started
Hopefully someone else can work out where each line needs to go.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Wed Mar 27, 2013 7:27 am
by haringpb
So i tried to do it on my own but failed this was the idea more or less stolen from the andor script but allways got an onload error:

Code: Select all

fuction doquest()					
		EventMonitorStart("eventchat", "SYSTEM_MESSAGE");
		local time, moreToCome, name, msg, _go
		repeat
			time, moreToCome, name, msg = EventMonitorCheck("eventchat",1)
			yrest(10)
			if name == getTEXT("SC_ZONE_PE_3TH_ST1START") then
				_go = true
			end
		until _go == true
		repeat
			time, moreToCome, name, msg = EventMonitorCheck("eventchat",1)
			yrest(10)
			quest()
			if name == getTEXT("SC_ZONE_PE_3TH_FAIL")
				_go = false
			end
	        until _go == false
end

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Wed Mar 27, 2013 8:36 am
by lisa
haringpb wrote:fuction doquest()
this made me lol

should be function

I do little typos like that all the time ;)

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Wed Mar 27, 2013 12:35 pm
by haringpb
Oh man ok correctet it and at least it starts but it doesnt do anything on event start

Code: Select all

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

function doquest()               
      EventMonitorStart("eventchat", "SYSTEM_MESSAGE");
      local time, moreToCome, name, msg, _go
      repeat
         time, moreToCome, name, msg = EventMonitorCheck("eventchat",1)
         yrest(10)
         if name == getTEXT("SC_ZONE_PE_3TH_ST1START") then
            _go = true
         end
      until _go == true
      repeat
         time, moreToCome, name, msg = EventMonitorCheck("eventchat",1)
         yrest(10)
         quest()
         if name == getTEXT("SC_ZONE_PE_3TH_FAIL") then
            _go = false
         end
           until _go == false
end

function quest()
  		 inventory:useItem("Arrowhead Carved with Name")
   	       	 RoMScript("AcceptBorderQuest()")
  		 RoMScript("ScriptBorder:Hide()")
   		 player:target_NPC("Myan Kellas")
  	 	 CompleteQuestByName("Last Luck","public")
end

</onload>

   <!-- #  1 --><waypoint x="-2699" z="-17935" y="810">
    doquest()   
   </waypoint>
</waypoints>
and yeah i got this fix for the timer ingame.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Wed Mar 27, 2013 6:22 pm
by lisa
At first glance it looks like it should work, since it isn't then it would be a good idea to add in prints so you can work out why it isn't working.

Something like this in both loops.

Code: Select all

if name then print("Name: "..name) end
if msg then print("Msg: "..msg) end
maybe pop a print between the 2 loops so you know if it has succeeded in leaving the first loop.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 28, 2013 8:10 am
by haringpb
Allright i tried and i tried and i tried and it seems like time, moreToCome, name, msg = EventMonitorCheck("eventchat",1) allways gets me a nil for name.
Or in outher worlds i cant read out the gomessage from ingame.

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 28, 2013 9:13 am
by rock5
I'll clarify the command for you.

Code: Select all

time, moreToCome, arg1, arg2 = EventMonitorCheck("monitorname", argfilter)
time and moreToCome are values returned from the function. All values after the first 2 values are the values returned from the event being monitored as defined by the argfilter.

For example we typically get chat messages like so

Code: Select all

time, moreToCome, name, msg = EventMonitorCheck("chatmonitor","4,1")
So that's the "time" and "moreToCome" values plus the 4th and 1st values returned from the event which are the "message" and "sender" respectively (different events return different values).

Code: Select all

EventMonitorCheck("eventchat",1)
This returns 3 values; time, moreToCome and the 1st argument from the event which should be the message so there is no point in using 4 variables as the last varaible will always be nil. So all you need is

Code: Select all

time, moreToCome, name = EventMonitorCheck("eventchat",1)
Although "name" is a confusing name for the message. Maybe you should use this instead

Code: Select all

time, moreToCome, msg = EventMonitorCheck("eventchat",1)
Note: You have been using the number 1. I don't see any problem using a number as long as only want one returned value, because it will be converted to a string, but if you want to return more than one then make sure to make it a string like in the "chat" example above.

Now, after all that is said, I'm not sure why you always got nil. You do realize that you will only get returned values when the event is actually triggered, don't you?

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 28, 2013 10:35 am
by haringpb
Allright, overworked it, and got an outher idea where it could struggle....
Is EventMonitorStart("eventchat", "SYSTEM_MESSAGE") SYSTEM_MESSAGE the right filter for this?

Re: Script to do a waypoint if the EOJ timer doesn't show?

Posted: Thu Mar 28, 2013 6:03 pm
by lisa
It should still technically be working, the set up is almost identical to what I did in Andor Training which works perfectly.

Code: Select all

--== monitor chat
EventMonitorStart("Tortevent", "SYSTEM_MESSAGE");
local time, moreToCome, name, msg, _go 
repeat
	time, moreToCome, name, msg = EventMonitorCheck("Tortevent",1)
	yrest(10)
	if name and string.find(name,goMessage) then
		_go = true
	end
until _go == true
EventMonitorStop("Tortevent")
The addon said the message is a SYSTEM_MESSAGE, hmmm unless it is saying that because the message saying the event from the addon is saying it using SendSystemChat.
I might have another look at it.

--=== Added ===--

I must have been half asleep when I did that post, it should actually be
"CHAT_MSG_SYSTEM"
or
"WARNING_MESSAGE"

Either will probably work as it is posted in both while you are in the zone.