mIRC Home    About    Download    Register    News    Help

Print Thread
#102054 04/11/04 05:12 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
i have this value: 05:27:59 yes its a time set.. how can i calc the time between that value and the curent time? :tongue: or is it any easyer way to do it? i working on a seen script, and need to get the time when the nick was last seen quitting.. :tongue: never dont this befor so all help is welcome, i have been writing all the parts it needs, only this part left..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#102055 04/11/04 05:24 AM
Joined: Dec 2002
Posts: 127
F
Vogon poet
Offline
Vogon poet
F
Joined: Dec 2002
Posts: 127
while i'm sure it is possible to calculate the time difference given your data, it would be much easier to use $ctime and then subtract that from the current $ctime. use $duration($calc(%var - $ctime))


------
deep down, i'm really superficial.
#102056 04/11/04 10:25 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Since a time is being handled I'd go with $duration here: $duration($abs($calc($duration($time(HH:nn:ss)) - $duration(05:27:59))))

You can alter the format of $time() to measure the time until or the time since the specific time

#102057 04/11/04 06:49 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
No i haver this value stored in a text file:

nick (ident@host) was last seen changing nick on to newnick 1099593370

but how would i go about to calc the right numbers? $read cant filter out the part where it says '1099593370' ?

echo $read(info.txt, s, mirc) wont do me any good.. cos
1: i never know what the line beggins with..
2: the address can contain a number..

and that would screw everything up :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#102058 04/11/04 08:32 PM
Joined: Apr 2003
Posts: 414
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
You can use regex to get 1099593370 from "nick (ident@host) was last seen changing nick on to newnick 1099593370"

Code:
  var %reg = /.*(\d{10})/
  var %str = nick (ident@host) was last seen changing nick on to newnick 1099593371
  echo zz $regex(%str,%reg)
  echo zazibu $regml(1)


mIRC Chm Help 6.16.0.3 Full Anchored!
#102059 04/11/04 08:54 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
the red line:
Code:
var %reg = /.*(\d{10})/
var %str = nick (ident@host) [color:red] was last seen changing nick on to newnick[/color]  1099593371 
echo zz $regex(%str,%reg)
echo zazibu $regml(1)

changes, so its not shure it looks like that, how ever the 1099593371will be at the end of all the line, the 1099593371 changes tho.. so im not shure how that line would work? :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#102060 04/11/04 09:10 PM
Joined: Apr 2003
Posts: 414
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
For that regular expresion have matter only the last 10 digitals from end of the line..
So it must work fine with..

var %str = nick (ident@host) 1099593371
var %str = nick (ident@host) blalvla 1099593371
or just
var %str = 1099593371

Hope that help..


mIRC Chm Help 6.16.0.3 Full Anchored!
#102061 04/11/04 09:22 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
nope.. i guess i just have to give up this.. been trying everything i can think about now, also the codes provided by you..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#102062 05/11/04 03:12 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
couldent edit my old post so here we go..
Code:
on *:text:*:#:{
  if ($1 == $seentrigger) {
    var %x $read(" $+ $mircdirmap/seen.text $+ ", w,* $+ $2 $+ *)
    set %tmp.seen $readn
    ;if (%tmp.seen == 1) { goto next } <<-- will be working later if nick not seen..
    var %reg = /.*(\d{10})/
    var %str = $2 (ident@host) was last seen changing nick on to newnick 1099593371
  }
}

i cant get it to give the time in days/houers/minutes/seconds .. it only send it as '1099593371' , and i have been trying to calc that diffrent ways, still same result.. it gives the wrong value.. so im totaly stuck here.. somone that ether can point me to the right way.. or maybe even show me how its done? :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#102063 05/11/04 05:14 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
To get the last token, just use $0 to find the number of space delimited tokens (in $1- ).

Thus, the time figure will be [ $ $+ $0 ],
e.g. /var %timeString = [ $ $+ $0 ]

Because this works with "$1-", the way to make it work efficiently is:

alias GetLastToken {
return [ $ $+ $0 ]
}


and in your main script:

var %timeTicksString = $GetLastToken($read(<whatever your read command is>))


Cheers,

DK

p.s. untested.


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
#102064 05/11/04 08:24 AM
Joined: Apr 2003
Posts: 414
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
Code:
on *:text:*:#:{
  if ($1 == $seentrigger) {
    var %x $read(" $+ $mircdirmap/seen.text $+ ", w,* $+ $2 $+ *)
    set %tmp.seen $readn
    ;if (%tmp.seen == 1) { goto next } &lt;&lt;-- will be working later if nick not seen..
    var %reg = /.*(\d{10})/
    var %str = $2 (ident@host) was last seen changing nick on to newnick 1099593371
    if ($regex(%str,%reg)) {
      var %stime = $regml(1)
      var %difference = $duration($calc($ctime - %stime))
      msg $chan Last seen: %difference ago
    }
    else {
      echo ERROR.. Can't find last seen time..
    }
  }
}


Try that ? Untested..


mIRC Chm Help 6.16.0.3 Full Anchored!
#102065 05/11/04 08:51 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
You're on the right track here but the actual syntax would be $ [ $+ [ $0 ] ] since [ $ $+ $0 ] simply joins $ and $0 to yield $$0 and evaluates that. However, when using $0 within a custom alias called as an identifier, it returns the number of parameters, so when using $myalias(words here) $0 would return 1 with $1 returning "words here"

I'd just use $gettok for this particular script:

on *:text:$($seentrigger *):#:{
if ($gettok($read($mircdirmap/seen.txt,s,$2),-1,32)) msg # $2 was last seen $duration($calc($ctime -$ifmatch)) ago
else msg # I have not seen $2
}


Link Copied to Clipboard