EventMonitor does not work (but no error msg)

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
mortimer
Posts: 14
Joined: Thu Dec 22, 2011 7:13 am

EventMonitor does not work (but no error msg)

#1 Post by mortimer » Thu Dec 22, 2011 10:06 am

Hello ppl,

before i start to explain my problem:
Thank all of you for this amazing project and the script-producing here.
I love this bot. It's kind a sandbox for old people to play with and gives a huge variety of possiblities :)
Thx for sharing!


now the main reason for this post as seen in the topic: I dont get any values from EventMonitor

I tried to build some userfunctions with usage of "EventMonitor" with EventMonitorStart(...) and EventMonitorCheck(...), here is one of this as blueprint:

Code: Select all

invplayername = "dummyname"

function AutoAcceptInvite()
    repeat
		local time, moreToCome, name = EventMonitorCheck("Pinv", "1")
		if time ~= nil then
			if name == invplayername then
				--Do some acceptinvite here
				cprintf(cli.yellow, "Accepted Party-Invite from %s at %d", name, os.time());
				yrest(100);
			end
        end
    until moreToCome ~= true
end

function startAutoAcceptInvite()
	unregisterTimer("autoaccept");
	printf("Auto Accept Party invite started\n");
	EventMonitorStart("Pinv", "PARTY_INVITE_REQUEST");
	registerTimer("autoaccept", secondsToTimer(5), AutoAcceptInvite);
end
which i start with "startAutoAcceptInvite()" in the "on load"-section of a WP-File. But i dont get the EventMonitor monitoring events.

In Detail the part

Code: Select all

local time, moreToCome, name = EventMonitorCheck("Pinv", "1")
gives back "nil" for time, moreToCome and name every time.

After my own userfunctions with Events didn't work, i tried the "eventmonitortest.xml" posted from lisa in another thread in this forum. With teh eventtester from lisa i also didn't get any events triggered and the time and other values stayed "nil".

My first suggestion was, that maybe some of my addons is causing this, so i cleaned the "interface/addon" folder and only left ingamefunctions there. This also did not solve the problem.

Then i tried some stuff with the CommandLine and checked the Messages i got from ingamefunctions\igf_events.lua:
Starting a Monitor = does not give back any error message (so it's working how it should i guess. additional: it produces an "igf_events:StartMonitor("usual stuff here") in one macro)
Starting a Monitor and stopping after also does not give any error mesage
Resuming a Monitor which is stopped triggers an error message (how it should do)
Checking a Monitor after Starting it also dont give back any error (additional: it produces an "igf_events:GetLogEvent("usual stuff here") in the macro where the StartMonitor was before)
But still only "nil"s for time, moretocome, ...

I tried a bit degguging and found that this code in igf_events.lua is true all the time:

Code: Select all

	-- Check if log entries exist
	if EventLog[monitorName] == nil then
		SendSystemChat("If you see this message there are no entries in EventLog") --this line put in by me
		return
	end
so the EventLogs are nil all the time. That means i get no logs at all!?

I read a lot of threads in this forum but could not find anything similar to my problem.
Now i dont know how to proceed.

Tested the EventMonitor-Stuff with:
MM 1.02, Rombot rev. 684 and rev. 685 on Windows 7, 64 bit.
Tested Events:
PARTY_INVITE_REQUEST, CHAT_MSG_SAY, CHAT_MSG_WHISPER

It would be really nice if somebody can help me or maybe has an idea about.

Best
Mort

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

Re: EventMonitor does not work (but no error msg)

#2 Post by rock5 » Thu Dec 22, 2011 10:50 am

That code worked for me. This is what I did.

1. Started 2 accounts and players, lets call them player1 and player2.
2. Edited your code by changing the name to "player2".
3. Started the commandline and attached it to the player1 game.
4. Entered the following to start the monitoring.

Code: Select all

Command> startAutoAcceptInvite()
5. In the player2 game I entered

Code: Select all

/script InviteByName("player1")
6. In the micromacro window I typed

Code: Select all

yrest(100)
It then printed out

Code: Select all

Accepted Party-Invite from player2 at 1324567888
In case you didn't know, I have to do a yrest because registered timers need to be yeilded to. micromacro is not a true multithreaded environment. In normal botting yrests should be happening all the time but if you create a loop somewhere that could last an indefinate length of time, you should make sure it has a yrest, even if it's just 1 millisecond. I don't know if this is what is happening to you or not.

Here is an image of the output. The reason there are 2 yrests is because I did one before the invite and one after.
Attachments
aapi.jpg
  • 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

mortimer
Posts: 14
Joined: Thu Dec 22, 2011 7:13 am

Re: EventMonitor does not work (but no error msg)

#3 Post by mortimer » Thu Dec 22, 2011 1:30 pm

Thanks for your answer,

but well, i thought the code will work, thats not the problem. The problem is, that the EventMonitorCheck gives back nil, also if i am doing like you suggested.
Is there anything if have to do before EventMonitorStart ? Maybe some ingame-menu-thing or something else? I dont know why i only get nils.

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

Re: EventMonitor does not work (but no error msg)

#4 Post by rock5 » Thu Dec 22, 2011 2:45 pm

If you did like I did, it should work. Is the bot otherwise working? Do other scripts work ok?

Maybe you have a spelling mistake in the name or you used an unusual character?
  • 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

mortimer
Posts: 14
Joined: Thu Dec 22, 2011 7:13 am

Re: EventMonitor does not work (but no error msg)

#5 Post by mortimer » Thu Dec 22, 2011 5:42 pm

yes i dit it exactly like you said. And it cannot be some misspelling because i also tested the Eventmonitor with "lisa"s "eventmonitortester.xml", which one works at other people. Thats why i am so confused. i checked everything twice and more. in the ingamefunctions/igs_events.lua within the GetLogEvent(...) the EventValues are never written and stay nil, also after some loop with yrests in it.

the last test i did with this modified "eventmonitortester" from lisa:

Code: Select all

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

	<onLoad>
	
	while (true) do
		loopval = 0
		start_time = os.time()
		printf("%d\n", start_time)
		EventMonitorStart("Test", "CHAT_MSG_SAY");
		sendMacro("SendChatMessage('LOL','SAY');")
		yrest(1000)	
		sendMacro("SendChatMessage('LOL','SAY');")
		yrest(100)
		sendMacro("SendChatMessage('LOL','SAY');")
		yrest(100)

		repeat
			yrest(100)
			local time, moreToCome, msg = EventMonitorCheck("Test", "1")
			yrest(100)
			if time == nil then
				printf("time is nil\n");
			else
				printf("time = %d\n", time);
			end
			if msg == nil then
				printf("msg is nil\n");
			else
				printf("msg = %s\n", msg);
			end
			if moreToCome == nil then
				printf("moreToCome is nil\n");
			else
				printf("moreToCome = %d\n", moreToCome);
			end
			printf("loopval "..loopval.." \n");
			loopval = loopval +1
		until loopval >= 30
		
		if time ~= nil then
			repeat
				if string.find(msg,"LOL") then
					printf("Event monitoring works fine.\n")
					player:sleep()
				end
			
			until moreToCome == false	
	
		end
	repeat
		printf("-")
	until os.time() >= (start_time + 5) -- add in a 5 second pause between tries.
	printf("\n")
	end

	</onLoad>

</waypoints>

Maybe it's because of the german client and MMs incompatibility with ä's ö's and ü's?

this was the output in MM(stopped after some loops by hand):
Attachments
Output of eventmonitortester
Output of eventmonitortester

mortimer
Posts: 14
Joined: Thu Dec 22, 2011 7:13 am

Re: EventMonitor does not work (but no error msg)

#6 Post by mortimer » Thu Dec 22, 2011 5:56 pm

sry for double-post but i forgot to say:
The bot is working well, only the EventMonitor does not work.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: EventMonitor does not work (but no error msg)

#7 Post by lisa » Thu Dec 22, 2011 8:40 pm

you do have an addon like d303fix to set the in game time right?
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

mortimer
Posts: 14
Joined: Thu Dec 22, 2011 7:13 am

Re: EventMonitor does not work (but no error msg)

#8 Post by mortimer » Fri Dec 23, 2011 6:24 am

oh dear, i thought i have something inside pbinfo for ingametime.
shame on me. i was to fast in the space-time-continuum and forgot to check the most basic fundamentals like the ingame-time. Now i feel as dumb as a post. Sry for your loss in time and thx, the d303fix solved the problem.

Now i'll stand in the corner until i repent for my dumbness :)

Best
Mort

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest