HELP @ EventMonitor & EventMonitorCheck needed

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
puto_velho
Posts: 5
Joined: Fri Jun 22, 2012 4:25 pm

HELP @ EventMonitor & EventMonitorCheck needed

#1 Post by puto_velho »

Hello there first of all let me just say THANK YOU Lisa and Rock5 for the work and explanations done, not to me directly but to all that read the forum.

Now to the business... I'm trying to make a script to make a script for a Dwarf quest (with no good results atm) called "Here Comes the Rain!" that its to "repair" a gate.

After accept the quest, the npc Valent Blackscar start saying out of 2 tools 1 to use...
[Say] [Valent Blackscar]: Now! Grab your hammer!
click hammer and then click gate

[Say] [Valent Blackscar]: Now! Grab your pliers!
click pliers and then click gate

[Say] [Valent Blackscar]: Now! Grab your hammer!
click hammer and then click gate
...and so on until quest is done...

I realise that its possible to have this work with EventMonitor & EventMonitorCheck
this is my last try.. i know it might be all f.. messed up but i really tried :S

Code: Select all

<onload>
	function black()
		local time, moretocome, msg = EventMonitorCheck("blacksay","1")
		if msg ~= nil then
			if string.find(msg, "Now! Grab your hammer!") then 
				stuff to do
			elseif if string.find(msg, "Now! Grab your pliers!") then
				other stuff to do
			end
		end
	end
</onload>

<!-- #  1 --><waypoint x="-11" z="374" y="1561">
	EventMonitorStart("blacksay","CHAT_MSG_SAY",",,,Valent Blackscar");
</waypoint>
<!-- #  2 --><waypoint x="-371" z="321" y="1638">
	player:target_NPC("Valent Blackscar"); AcceptQuestByName("Here Comes the Rain!"); yrest(5000);

	while (getQuestStatus("Here Comes the Rain!") == "incomplete") do
		black()
	end

	player:target_NPC("Valent Blackscar"); CompleteQuestByName("Here Comes the Rain!"); yrest(2000);

	EventMonitorStop("blacksay");

	loadPaths("next_stuff");
</waypoint>
the Valent is in the top of a stair, i made waypoint 1 away from them starting the event monitor and the waypoint 2 its near him to do the quest with a rest of 5 for the time he takes giving orders.
I kill two dwarves in da morning, I kill two dwarves at night,
I kill two dwarves in the afternoon, and then I feel alright.
I kill two dwarves in time of peace and two in time of war,
I kill two dwarves before I kill two dwarves, and then I kill two more.

Troll /funny from The Toyes song "Smoke Two Joints", which was covered by Sublime.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: HELP @ EventMonitor & EventMonitorCheck needed

#2 Post by lisa »

I actually have done this quest manually and something I noticed was the tool only appeared on the ground when it was needed to be used.

Maybe just do a check for the tool and then click it, then click the 3 little orb thingies you need to "repair"

If you really want to use the event monitoring though check out Rock's Invader script he posted in the userfunction/WP section. More specifically the one that does the repair thing, it monitors for similar things.

can also try this

Code: Select all

local time, moreToCome, name, msg = EventMonitorCheck("blacksay", "4,1")

instead of

local time, moretocome, msg = EventMonitorCheck("blacksay","1")
Points to note,
Your msg arg is the 3rd arg, which is actually the name argument.
you only check for "1" in the monitor, can't remember the meaning of those numbers off hand but yeah try "4,1"
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
puto_velho
Posts: 5
Joined: Fri Jun 22, 2012 4:25 pm

Re: HELP @ EventMonitor & EventMonitorCheck needed

#3 Post by puto_velho »

thanx for the repply, i tryed his CoO-invaders for the elite skills with no luck...

i'm stuck with the eventMonitor&check. i really cant get it to work...

there 2 have a small(tiny) diference... the quest, the npc "speak" in SYSTEM chat and in the quest Val speak in SAY chat.

each tool appear when he "say so"...

use the hammer... the hammer appear... click on it and repair
use the pliers... the apliers appears... click on it and repair

and so on... 3 times for each tool and quest done...
I kill two dwarves in da morning, I kill two dwarves at night,
I kill two dwarves in the afternoon, and then I feel alright.
I kill two dwarves in time of peace and two in time of war,
I kill two dwarves before I kill two dwarves, and then I kill two more.

Troll /funny from The Toyes song "Smoke Two Joints", which was covered by Sublime.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: HELP @ EventMonitor & EventMonitorCheck needed

#4 Post by lisa »

I have a habbit of editing my posts, problem is probably you have msg as 3rd argument.

arg is prob not best word, variable/value is probably better, either way same story =)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
puto_velho
Posts: 5
Joined: Fri Jun 22, 2012 4:25 pm

Re: HELP @ EventMonitor & EventMonitorCheck needed

#5 Post by puto_velho »

hehe np.

for what i managed to understand the Arg.4 is the "sender" and the Arg.1 is the "message"

as i start the monitor filtering the 4th Arg. to Valent...

Code: Select all

EventMonitorStart("blacksay","CHAT_MSG_SAY",",,,Valent Blackscar");
...i thought it wasn't needed to "re-use it" in EventMonitorCheck because the "messages", in my point of view, are all from Valent, filtered in the eventmonitorstart()

and no... didnt worked also :|

PS.: found the link from rock5 about the "filter"
I kill two dwarves in da morning, I kill two dwarves at night,
I kill two dwarves in the afternoon, and then I feel alright.
I kill two dwarves in time of peace and two in time of war,
I kill two dwarves before I kill two dwarves, and then I kill two more.

Troll /funny from The Toyes song "Smoke Two Joints", which was covered by Sublime.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: HELP @ EventMonitor & EventMonitorCheck needed

#6 Post by lisa »

I went to go check out this quest by all 8 of my accounts are full of chars, deleted half a dozen but have to wait 24hours before I can make some dwarves to play around with this.

I personally would go with checking for the items and just click it then click the orbs, you can click all 3 orbs in a single round, so should be able to do the quest quickly enough.


If you want to you can do a print of nearby objects and then work on a script to work with the item Id's.

You can make up a userfunction and run bot using the commandline WP
rom/bot path:commandline

Code: Select all

function objname()
	local objectList = CObjectList();
	objectList:update();
	local objSize = objectList:size()
	filename = getExecutionPath() .. "/logs/npc.txt";
	file, err = io.open(filename, "a+");
	if( not file ) then
		error(err, 0);
	end
	player:update()
		for i = 0,objSize do 
			obj = objectList:getObject(i);
			player:update()
			file:write("<NPC name=\""..obj.Name.."\" 	id="..obj.Id.." x=\""..obj.X.."\"  z=\""..obj.Z.."\"  y=\""..obj.Y.."\" zoneid=\""..getZoneId().."\"	/>\n")
		end
	file:close();
end
When you call that function it will save the data to a log file called npc.txt in the log folder.
Alternatively you can just run
rom/getid
and then point the mouse at the objects, I like to use my function though =)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
puto_velho
Posts: 5
Joined: Fri Jun 22, 2012 4:25 pm

Re: HELP @ EventMonitor & EventMonitorCheck needed

#7 Post by puto_velho »

mmm... :geek:

never thought on that...

something like..... ??

Code: Select all

	<!-- #  1 --><waypoint x="-368" z="327" y="1637">
		player:target_NPC("Valent Blackscar"); AcceptQuestByName("Here Comes the Rain");

		while (getQuestStatus("Here Comes the Rain") == "incomplete") do
			-- if pliers exist
			if player:findNearestNameOrId(120242) then
				player:target_Object(120242); yrest(1000);
				player:target_Object(120388); yrest(1000);
				player:target_Object(120388); yrest(1000);
				player:target_Object(120388); yrest(1000);
			end			
			-- if hammer exist
			if player:findNearestNameOrId(120241) then
				player:target_Object(120241); yrest(1000);
				player:target_Object(120243); yrest(1000);
				player:target_Object(120243); yrest(1000);
				player:target_Object(120243); yrest(1000);
			end
		end

		loadPaths("break");
	</waypoint>
PS1.: code updated... working now.. using player:findNearestNameOrId() to check if hammer or pliers are near... if so.. use it 3 times :) thank you so much lisa
PS2.: didnt knew the --comment inside waypoints :) re-updated and now in 1 WP. thanx again. btw..

this is part of a self leveling dwarf... auto gear choose by class and getting help from guildies for TPs :)
Last edited by puto_velho on Fri Jun 22, 2012 9:10 pm, edited 2 times in total.
I kill two dwarves in da morning, I kill two dwarves at night,
I kill two dwarves in the afternoon, and then I feel alright.
I kill two dwarves in time of peace and two in time of war,
I kill two dwarves before I kill two dwarves, and then I kill two more.

Troll /funny from The Toyes song "Smoke Two Joints", which was covered by Sublime.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: HELP @ EventMonitor & EventMonitorCheck needed

#8 Post by lisa »

something like that

Code: Select all

<!-- if pliers exist -->
that will probably error out MM as it is within a waypoint tag so the code is concidered a function.

So you could either leave the comment out or just use

Code: Select all

-- if pliers exist
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
User avatar
puto_velho
Posts: 5
Joined: Fri Jun 22, 2012 4:25 pm

Re: HELP @ EventMonitor & EventMonitorCheck needed

#9 Post by puto_velho »

the quest is by with other means than with EventMonitorCheck but i would like to know why it wasn't with the original script...

NPC "Valent Blackscar" say 2 things..
a) get the hammer -> [Say] [Valent Blackscar]: Now! Grab your hammer!
b) get the pliers -> [Say] [Valent Blackscar]: Now! Grab your pliers!

point of situation...
what i know...
1)start the monitor
first end the monitor to remove probable recorded events and we start a new empty event record

Code: Select all

<!--- # 1 --><waypoint x="xxx" z="zzz" y="yyy" tag="cometherain">
   EventMonitorEnd("blacksay");
   EventMonitorStart("blacksay","CHAT_MSG_SAY",",,,Valent Blackscar");
</waypoint>
2)check the monitor for event
i used thought that using a function would be fine for this but didn't worked and i can't seem to know why it that.
probable cause: some code error and i dont know enough to fix it

Code: Select all

<onload>
   function black()
      local time, moretocome, msg = EventMonitorCheck("blacksay","1")
      if msg ~= nil then
         if string.find(msg, "Now! Grab your hammer!") then 
            click hammer then click thing (no problem here)
         elseif if string.find(msg, "Now! Grab your pliers!") then
            click plier then click thing (no problem here)
         end
      end
   end
</onload>

<!--- # 1 --><waypoint x="xxx" z="zzz" y="yyy">
   EventMonitorEnd("blacksay");
   EventMonitorStart("blacksay","CHAT_MSG_SAY",",,,Valent Blackscar");
</waypoint>

<!--- # 2 --><waypoint x="xxx" z="zzz" y="yyy">
   -- working
   player:target_NPC("Valent Blackscar"); AcceptQuestByName("Here Comes the Rain");
</waypoint>

<!--- # 3 --><waypoint x="xxx" z="zzz" y="yyy">
   while (getQuestStatus("Here Comes the Rain!") == "incomplete") do
      black()
   end
</waypoint>

<!--- # 4 --><waypoint x="xxx" z="zzz" y="yyy">
   -- no problems here
   player:target_NPC("Valent Blackscar"); sendMacro("CompleteQuest()");
</waypoint>
I kill two dwarves in da morning, I kill two dwarves at night,
I kill two dwarves in the afternoon, and then I feel alright.
I kill two dwarves in time of peace and two in time of war,
I kill two dwarves before I kill two dwarves, and then I kill two more.

Troll /funny from The Toyes song "Smoke Two Joints", which was covered by Sublime.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: HELP @ EventMonitor & EventMonitorCheck needed

#10 Post by lisa »

My deleted alts should be off their timer tomorrow at some stage, I'll make some dwarves and do some testing.
It might be possible that even though the NPC text comes up on screen as "say" it may not be in the actual say channel. Since everyone would see the same text from the NPC about the text and that would just be silly.

So yeah I'll load up a few chars and see what I can see.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Post Reply