Beep when whispered

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
zephir
Posts: 8
Joined: Fri Sep 02, 2011 7:43 pm

Beep when whispered

#1 Post by zephir » Fri Sep 02, 2011 8:53 pm

Hello,
I would like that when i'm whispered, my pc beeps.
I would like the code, to work a bit like the 'gmMonitor' http://www.solarstrike.net/phpBB3/viewt ... =detection
A code that when detects whispers, run this code:

Code: Select all

printf("\a\a\a");
Hope you can help me :) Thanks and regards.

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

Re: Beep when whispered

#2 Post by lisa » Fri Sep 02, 2011 9:14 pm

if onload have

Code: Select all

<onload>
	EventMonitorStart("Whispers", "CHAT_MSG_WHISPER");
	registerTimer("beepwhispers", secondsToTimer(5), beepwhispers);
	local function beepwhispers()
		repeat
		local time, moreToCome, name, msg = EventMonitorCheck("Whispers", "4,1")
			if time ~= nil then
			printf("\a\a\a");
			end
		until moreToCome == false
	end
</onload>
Something like that will probably do the trick.
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

zephir
Posts: 8
Joined: Fri Sep 02, 2011 7:43 pm

Re: Beep when whispered

#3 Post by zephir » Sat Sep 03, 2011 4:35 am

Thank you for you quick reply.
but It now appears the following error:

Code: Select all

scripts\rom\bot.lua:436: onLoad error: [string "..."]:5 Error: Non-function type passed to registerTimer() where a funtion is expected.

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

Re: Beep when whispered

#4 Post by lisa » Sat Sep 03, 2011 4:43 am

Try this, it is probably because I had the function after the timer, so MM hadn't read the code for the function yet.

Code: Select all

<onload>
   function beepwhispers()
      repeat
      local time, moreToCome, name, msg = EventMonitorCheck("Whispers", "4,1")
         if time ~= nil then
         printf("\a\a\a");
         end
      until moreToCome == false
   end
   EventMonitorStart("Whispers", "CHAT_MSG_WHISPER");
   registerTimer("beepwhispers", secondsToTimer(5), beepwhispers);
</onload>
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

zephir
Posts: 8
Joined: Fri Sep 02, 2011 7:43 pm

Re: Beep when whispered

#5 Post by zephir » Sat Sep 03, 2011 7:16 am

Now it beeps when whispered like it should :)
the problem is that 'RB Command' macro starts being pressed like crazy
and it stops executting the code, stopping at some point
and I cant even press END to pause it

probably something in the 'repeat'

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

Re: Beep when whispered

#6 Post by lisa » Sat Sep 03, 2011 8:16 am

I guess it depends how often u get whispered, if it is lots then could probably add in a time check so it only beeps at you once for messages every 30 secs or something, can be tricky to get timing working nicely though.

It will stay in the loop beeping for aslong as you get whispers, if you get 5 then it will beep 3 times for each whisper for total of 15 times, then it will go back to the macro usage every 5 seconds.
Assuming nothing else is going on. Are you getting bot to run anything else?
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

zephir
Posts: 8
Joined: Fri Sep 02, 2011 7:43 pm

Re: Beep when whispered

#7 Post by zephir » Sat Sep 03, 2011 8:52 am

the only code I'm using is:

Code: Select all

	<onLoad>
		function beepwhispers()
		repeat
			local time, moreToCome, name, msg = EventMonitorCheck("Whispers", "4,1")
			if time ~= nil then
				printf("\a\a\a");
			end
			until moreToCome == false
		end
		EventMonitorStart("Whispers", "CHAT_MSG_WHISPER");
		registerTimer("beepwhispers", secondsToTimer(5), beepwhispers);
	</onLoad>

	<onLeaveCombat>	
	</onLeaveCombat>
	
	<onDeath>
		RoMScript("BrithRevive();");
		waitForLoadingScreen()
		yrest(settings.profile.options.WAIT_TIME_AFTER_RES);
		player:update();
		player:rest(1);
 		printf("\a\a\a");
		error("You died", 0);
	</onDeath>

	<onLevelup>
	</onLevelup>

	<onSkillCast>
	</onSkillCast>

	<onHarvest>
	</onHarvest>

	<!-- Lua code to execute when MAX_UNSTICK_TRIALS is reached. -->
	<onUnstickFailure>
		player:logout(nil,true);
	</onUnstickFailure>
and something strange happens:
I press DEL and activates code
it walks 5 waypoints, but then it stops the code (the macromicro stops code excution, and I can't press DEL or END)
and I happened to press the party button, and the chat opened and it typed '0' and closed the chat and walked to the next waypoint

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

Re: Beep when whispered

#8 Post by lisa » Sat Sep 03, 2011 8:58 am

sounds like an issue with the WP or possibly an addon.
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

spawni
Posts: 100
Joined: Wed Sep 28, 2011 11:21 am

Re: Beep when whispered

#9 Post by spawni » Wed Sep 28, 2011 11:27 am

:D Hi there,
great bot - great board. I´m a totaly newbie - at least i have coded other script-languages.
I tried diffrent things with the bot - all works fine - but the whisper-beep-script will not run.

Would be nice, if you can give me a tip - where do I have to fill in the code-snippet?
I tried out profile and scripts - in all cases it stops the waypoint-script from running....

Hope you can help me :geek:

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

Re: Beep when whispered

#10 Post by rock5 » Wed Sep 28, 2011 12:01 pm

Why don't you show us your code so we can see if there is something wrong with it? So there was no error message?
  • 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

spawni
Posts: 100
Joined: Wed Sep 28, 2011 11:21 am

Re: Beep when whispered

#11 Post by spawni » Wed Sep 28, 2011 12:17 pm

wow - fast reply

unfortunately no error msg. What i have tried first was a simple copy n paste thing with your Rock5's Millers Ranch Chickens run and the beep-code snippet

Try and errors:
1. code-snippet in profile-xml - onload-section- result: chicken run won´t work - no error message
2. code-snippet in your eggs-script - result: chicken run won´t work - no error message

In your script i put the snippet in one try on top of onload-section in another try at the end fo the script.

Used code:
<onLoad><![CDATA[
-- edit by spawni 27.09 beep by whisper ----
function beepwhispers()
repeat
local time, moreToCome, name, msg = EventMonitorCheck("Whispers", "4,1")
if time ~= nil then
printf("\a\a\a");
end
until moreToCome == false
end
EventMonitorStart("Whispers", "CHAT_MSG_WHISPER");
registerTimer("beepwhispers", secondsToTimer(5), beepwhispers)
]]></onLoad>

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

Re: Beep when whispered

#12 Post by rock5 » Wed Sep 28, 2011 12:47 pm

Ok I think I got it.

'moreToCome' only returns true or false if EventMonitorCheck actually returns a log entry. If it doesn't, ie. there is nothing to return, then moreToCome will be nil. Actually all the vlues, "time, moreToCome, name, msg" will be nil.

Try this instead.

Code: Select all

until moreToCome ~= true
That should work.
  • 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

spawni
Posts: 100
Joined: Wed Sep 28, 2011 11:21 am

Re: Beep when whispered

#13 Post by spawni » Wed Sep 28, 2011 12:53 pm

ty - will try it out and give feedback (tomorrow) :-)

spawni
Posts: 100
Joined: Wed Sep 28, 2011 11:21 am

Re: Beep when whispered

#14 Post by spawni » Thu Sep 29, 2011 10:26 am

:D your tip made the difference - no it beeps - thx for your help

mike
Posts: 7
Joined: Wed Jan 26, 2011 3:27 pm

Re: Beep when whispered

#15 Post by mike » Fri Oct 21, 2011 9:43 am

Hi

I'm trying to implement this as follows:

Code: Select all

if (soundLoad) then
	notifysound = soundLoad(getExecutionPath() .. "/alarm.wav");
	if (notifysound == nil) then
		warning("Failed to load sound file \'alarm.wav\'");
	end
end

function beepwhispers()
      repeat
      	local time, moreToCome, name, msg = EventMonitorCheck("WhisperNotify", "4,1")
         if time ~= nil and name ~= "Newbie Pet" then
		 printf("Someone whispered!\n");
		 if (notifysound == nil) then
         		printf("\a\a\a");
		else
			if (soundGetState(notifysound) ~= "playing") then
				soundPlay(notifysound);
			end
		end
         end
      until moreToCome ~= true
end

function enablenotifications()
	EventMonitorStart("WhisperNotify", "CHAT_MSG_WHISPER");
   	registerTimer("beepwhispers", secondsToTimer(5), beepwhispers);
	printf("Enabled notifications.\n");
end
	
However it seems time is always nil so the sound is never played. Any ideas?

Thanks,

Mike

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

Re: Beep when whispered

#16 Post by rock5 » Fri Oct 21, 2011 9:59 am

'time' uses 'os.time()' which was removed from the game awhile back. You will need an addon like d303fix to add it again or maybe check by 'moretocome'. That should always return true or false if an entry was found so this should work

Code: Select all

if moreToCome ~= nil and name ~= "Newbie Pet" then
       printf("Someone whispered!\n");
  • 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

mike
Posts: 7
Joined: Wed Jan 26, 2011 3:27 pm

Re: Beep when whispered

#17 Post by mike » Fri Oct 21, 2011 10:17 am

Ah offcourse! Thanks for helping a noob Rock5.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Beep when whispered

#18 Post by BlubBlab » Sat Sep 21, 2013 8:11 pm

Is there an order in moreToCome or will it response random?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Beep when whispered

#19 Post by rock5 » Sun Sep 22, 2013 2:54 am

It should send you the messages in order from oldest to newest.
  • 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

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Beep when whispered

#20 Post by BlubBlab » Sun Sep 22, 2013 12:48 pm

Then it should work as intended thx
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

Post Reply

Who is online

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