mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Code:
on *:TEXT:*:#hhhsgs: {
  if ($me == seanturner70) && ($1 == !update) && ($2 == add) { write hrupdates.txt $3- (added by $nick at  $date $+ : $+ $time GMT) | notice $nick Added }
  elseif ($1 == !update) && ($2 == list) { /play -n $nick hrupdates.txt }
}
on *:Join:#hhhsgs: {
  if ($nick == seanturner70-1) { /play -n $nick hrupdates.txt  }
}


Notes:
#hhhsgs is a test channel for this script.
The channel this script will be used in is invite only.


What I am wondering:
I am wondering how I could make it, so that when they join, it notices them:
Quote:
-seanturner70- You have 12 new updates.

Thus, I am wondering how I can mark each update as read, and then count all the unread updates.
Ideally, I would like it to look like this:
Quote:

[00:00] * You joined #chan
[00:00] -seanturner70- You have 2 new updates.
[00:00] <me> !update list
[00:00] -seanturner70- test (added by seanturner70-1 at 13/03/2009:23:51:12 GMT)
[00:00] -seanturner70- test2 (added by seanturner70-1 at 13/03/2009:23:51:14 GMT)
[00:00] -seanturner70- End of updates.
[00:00] * You left #chan
[00:00] * You joined #chan
(no update message)


The idea is that anyone who isn't in the room will be updated when they enter.
This will really help us because we help out on a website that often moves very quickly, having an easy update system will help make sure everyone stays updated with minimal effort.

Thank you for any help or idea's you provide. smile

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try this:

Code:
alias -l markasread {
  tokenize 32 $1
  if ((*read) * !iswm $1-) { write -l $+ $1 hrupdates.txt (*read) $2- }
}
on *:TEXT:*:#hhhsgs: {
  if ($me == seanturner70) {
    if ($1-2 == !update add) { write hrupdates.txt $3- (added by $nick at  $date $+ : $+ $time GMT) | notice $nick Added }
    elseif ($1-2 == !update list) {
      filter -ffx hrupdates.txt hrupdates2.txt (*read) *
      play -n $nick hrupdates2.txt
    }
  }
}
on *:Join:#hhhsgs: {
  if ($nick == seanturner70-1) { 
    filter -ffx hrupdates.txt nul (*read) *
    msg $nick You have $iif($filtered,$v1,no) new update(s)
  }
}
on *:playend:{
  if ($nopath($filename) == hrupdates2.txt) { 
    .remove $v2 
    filter -cfkn hrupdates.txt markasread
  }
}

Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Thanks! Works Great!

Wondering if there is a way so it doesn't message someone if there are no updates?

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Sure is!

Code:
alias -l markasread {
  tokenize 32 $1
  if ((*read) * !iswm $1-) { write -l $+ $1 hrupdates.txt (*read) $2- }
}
on *:TEXT:*:#hhhsgs: {
  if ($me == seanturner70) {
    if ($1-2 == !update add) { write hrupdates.txt $3- (added by $nick at  $date $+ : $+ $time GMT) | notice $nick Added }
    elseif ($1-2 == !update list) {
      filter -ffx hrupdates.txt hrupdates2.txt (*read) *
      play -n $nick hrupdates2.txt
    }
  }
}
on *:Join:#hhhsgs: {
  if ($nick == seanturner70-1) { 
    filter -ffx hrupdates.txt nul (*read) *
    if ($filtered) msg $nick You have $v1 new update(s)
  }
}
on *:playend:{
  if ($nopath($filename) == hrupdates2.txt) { 
    .remove $v2 
    filter -cfkn hrupdates.txt markasread
  }
}


Something I failed to mention in the first post is that the way it decides if a message is read is by checking for (*read) at the start of each line in a file, so if an update contains the token (*read) then it will cause the script to believe it's read even though it isn't. I don't think one of your updates is likely to contain that though so it shouldn't be an issue smile


Link Copied to Clipboard