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");Code: Select all
printf("\a\a\a");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>
Code: Select all
scripts\rom\bot.lua:436: onLoad error: [string "..."]:5 Error: Non-function type passed to registerTimer() where a funtion is expected.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>
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>Code: Select all
until moreToCome ~= trueCode: 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
Code: Select all
if moreToCome ~= nil and name ~= "Newbie Pet" then
printf("Someone whispered!\n");