mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2009
Posts: 3
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Aug 2009
Posts: 3
Hello there.

The timer function always outputs a message when it is used.
E.g.:

timer 1 5 { msg #abc ololo }

It will say
* Timer 123 activated
and 5 seconds later
* Timer 123 halted

It does that output in the server window when I call that function in on *:TEXT:*:*:, but in the respective channel's
window when I call it in on *:INPUT:#:.

Any chance I can make it shut up entirely?
Thanks in advance!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
use
Code:
.timer 1 5 { msg #abc ololo }


The . silences most, if not all, mIRC commands.

Joined: Aug 2009
Posts: 3
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Aug 2009
Posts: 3
Awesome, thanks! =)
One more thing. I got this portion of code in remote.ini:

Code:
on *:INPUT:#XYZ: {
  if ($1 != /*) {
    inc %pdeactivity
    timer 1 10800 { dec %pdeactivity }
  }
}


It seems that if-statement always returns true, because of the / I presume. I basically want to count all messages sent to a channel by people, including me, and then when someone types !activity have me say how many messages were sent in the last 3 hours. Since on INPUT reacts to almost everything, including commands starting with a slash, I have to sort those out somehow.

Last edited by Silencer1238457; 22/08/09 10:00 PM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Your if-statement will be true as long as the first word of your input is not literally "/*". To use the *-char as a wildcard, use for example the "iswm" operator.
Also note that "on input" will cover only your own messages - you need some "on text" event to cover the messages of other users.

Example for your /timer approach:
Code:
; text send by yourself
; "ison" prevents counting of messages sent while disconnected
on *:input:#xyz: {
  if (/* !iswm $1) && ($me ison #xyz) {
    inc %pdeactivity
    .timer 1 10800 dec %pdeactivity
  }
}

; text send by other users
on *:text:*:#xyz: {
  if ($1 == !activity) { msg # I recorded %pdeactivity messages on # in the last 3 hrs. }
  else { 
    inc %pdeactivity
    .timer 1 10800 dec %pdeactivity
  }
}

; timers started without the -o switch and while connected will stop on disconnect.
; you therefore should "reset" the variable on disconnect [or use the -o switch]
on *:disconnect: { set %pdeactivity 0 }


Here's an alternative approach, setting hash table items (a random number to create unique items) which unset after 3hrs. It allows you to use the script for multiple networks / multiple channels as the hash tables are named dynamically.
Code:
on *:input:#: {
  if (/* !iswm $1) && ($me ison #) { hadd -mu10800 $+(activity,$cid,#) $+($ticks,$rand(1,999)) }
}
on *:text:!activity:#: { msg # I recorded $hget($+(activity,$cid,#),0).item messages on # in the last 3 hrs. }

on *:text:*:#: { hadd -mu10800 $+(activity,$cid,#) $+($ticks,$rand(1,999)) }



Last edited by Horstl; 22/08/09 10:54 PM.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
It returns true always because that event will only trigger if you type #XYZ.

on *:INPUT:#XYZ: {

So if you type /#xyz this event wouldn't evaluate the if statement. mIRC would simply skip it.

Joined: Aug 2009
Posts: 3
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Aug 2009
Posts: 3
Thanks for the help!
I now have this, and it works:
Code:
on *:START: {
  set %pdeactivity 0
  set %pdewait 1
  set %rawblocked 0
  .timerremovewait 1 10800 { %pdewait = 0 }
}

on *:INPUT:#PDE: {
  if (/* !iswm $1) {
    inc %pdeactivity
    .timer 1 10800 { dec %pdeactivity }
  }
}

on *:TEXT:*:#PDE: {
  if ($nick != ChanServ) {
    inc %pdeactivity
    .timer 1 10800 { dec %pdeactivity }
  }
  if ($1- == !activity && !%rawblocked) {
    if (!%pdewait) {
      %rawblocked = 1
      if (%pdeactivity < 1) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (No activity)
      }
      elseif (%pdeactivity < 30) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Very very low activity)
      }
      elseif (%pdeactivity < 75) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Very low activity)
      }
      elseif (%pdeactivity < 100) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Low activity)
      }
      elseif (%pdeactivity < 200) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Average activity)
      }
      elseif (%pdeactivity < 350) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (High activity)
      }
      elseif (%pdeactivity < 500) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Very high activity)
      }
      elseif (%pdeactivity < 700) {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (Very very high activity)
      }
      else {
        notice $nick 14[12Automated message14] In the last 3 hours I recorded %pdeactivity messages being sent to this channel. (WALLOFTEXT)
      }
      .timer 1 2 { %rawblocked = 0 }
    }
    else {
      notice $nick 14[12Automated message14] Sorry, but I have been in this channel for less than 3 hours, so I cannot hand out precise activity information, yet. I have logged %pdeactivity messages being sent to this channel so far, though.
    }
  }
}


Link Copied to Clipboard