mIRC Home    About    Download    Register    News    Help

Print Thread
query roll back #122478 11/06/05 03:32 AM
Joined: Mar 2005
Posts: 27
N
Name141 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2005
Posts: 27
me and my friend came up with this, but it's not excally working right.

ON *:TEXT:*:?:{
if (!$hget($nick $+ Pms)) { hmake $nick $+ Pms 10 }
hinc $nick $+ Pms count
hadd $nick $+ Pms message $+ $hget($nick $+ Pms,count) $timestamp < $+ $nick $+ > $1-
if ($hget($nick $+ Pms,count) == 5) {
hdel $nick $+ Pms count
}
}
ON *:INPUT:?:{
if (!$hget($active $+ Pms)) { hmake $nick $+ Pms 10 }
hinc $active $+ Pms count
hadd $active $+ Pms message $+ $hget($nick $+ Pms,count) $timestamp < $+ $me $+ > $1-
if ($hget($active $+ Pms,count) == 5) {
hdel $active $+ Pms count
}
}
alias readback {
if (!$1) { echo -a No Nickname Given. | halt }
else {
set %aliechoback1 1
set %aliechoback2 5
while (%aliechoback1 <= %aliechoback2) {
echo -a $hget($1 $+ Pms,message $+ %aliechoback1)
inc %aliechoback1
}
}
}

Re: query roll back #122479 11/06/05 08:34 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
helps if u say whats wrong, but i assume its if u get 7 lines of text you end up with a buffer like
line 6
line 7
line 3
line 4
line 5
(maybe only showing lines 6 & 7 with your READBACK alias)

try this...
[code]ON *:TEXT:*:?:{ load.Pms.buffer $nick $nick $1- }
ON *:INPUT:?:{ load.Pms.buffer $active $me $1- }
alias -l load.Pms.buffer {
;$1 = pmer
;$2 = pmer or you
;$3 = message
var %hashtable = $+(Pms.,$1)
var %count = $int($calc($hget(%hashtable,count) * 1))
if (%count >= 5) {
hadd %hashtable message1 $hget(%hashtable,message2)
hadd %hashtable message2 $hget(%hashtable,message3)
hadd %hashtable message3 $hget(%hashtable,message4)
hadd %hashtable message4 $hget(%hashtable,message5)
var %count = 4
}
inc %count
hadd -m %hashtable $+(message,%count) $timestamp < $+ $2 $+ > $3-
hadd %hashtable count %count
}
alias readback {
if (!$len($1)) { echo -a No Nickname Given. }
else {
var %hashtable = $+(Pms.,$1)
var %count = $int($calc($hget(%hashtable,count) * 1))
var %i = 1
while (%i <= %count) {
if ($hget(%hashtable,$+(message,%i))) { echo -a $v1 }
;^ replace $v1 with $ifmatch for pre 6.16 versions of mirc
inc %i
}
}
}[code]

Or even ruder but laughingly easy to code

[code]
ON *:TEXT:*:?:{ load.Pms.buffer $nick $nick $1- }
ON *:INPUT:?:{ if (!$istok(/ $readini($mircini, text, commandchar), $left($1, 1), 32)) { load.Pms.buffer $active $me $1- } }
alias -l load.Pms.buffer {
var %hashtable = $+(Pms.,$1)
hadd -m %hashtable message1 $hget(%hashtable,message2)
hadd -m %hashtable message2 $hget(%hashtable,message3)
hadd -m %hashtable message3 $hget(%hashtable,message4)
hadd -m %hashtable message4 $hget(%hashtable,message5) | ; Im to lazy to loop through 4 entries
hadd -m %hashtable message5 $timestamp < $+ $2 $+ > $3-
}
alias readback {
if (!$len($1)) { echo -a No Nickname Given. }
else {
var %hashtable = $+(Pms.,$1)
if ($hget(%hashtable,message1)) { echo -a $v1 }
if ($hget(%hashtable,message2)) { echo -a $v1 }
if ($hget(%hashtable,message3)) { echo -a $v1 }
if ($hget(%hashtable,message4)) { echo -a $v1 }
if ($hget(%hashtable,message5)) { echo -a $v1 } | ; or 5 for that matter
;^ replace $v1 with $ifmatch for pre 6.16 versions of mirc
}
}[code]

PS: second solution untested.


NB: I changed the hashtables from $nickPms to Pms.$nick becuase then i could /hfree -w Pms.*