mIRC Home    About    Download    Register    News    Help

Print Thread
Help with explaining #247988 13/09/14 11:04 AM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 109
I have downloaded a bot from here: http://deadcell.eu5.org/?p=mbot

I only want to use one of the scripts in my own bot: Top10.mrc and is using two files ChanStats.dat and TempStats.dat. If I extract the full bot to D:
the structure looks like this:
D:\DC mBOT
\sys
\mBOT the three files are located here. I do not understand this: if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1)

My bot Structure:
D:\mIRC\
\System the three files are located here. Need to change the above script to suit this structure.
the ($DC.Dir(mBOT\ChanStats.dat) does not make sense to me.
please advise how mine should be? Can't seem to get it right

Re: Help with explaining [Re: raycomp] #247990 13/09/14 11:28 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Try add this alias in your bot remotes, maybe will help.

Code:
alias dc.dir return D:\mIRC\system\


The
Code:
 if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1)
searching on the mBOT path that the ChanStats.dat file is and getting the total lines and return them back and compare if the return lines is higher than 1.

- Thanks!

Re: Help with explaining [Re: westor] #247991 13/09/14 11:39 AM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 109
ok will add - alias dc.dir return D:\mIRC\system\ - to the remote thanks what about the line

Quote:
if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1)


do i change that?

Re: Help with explaining [Re: raycomp] #247992 13/09/14 12:10 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
I don't know how your code is..

Re: Help with explaining [Re: westor] #247993 13/09/14 12:19 PM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 109
the full code as follows: My top10.mrc is in D:\mIRC\System

need to change all the ($DC.Dir(mBOT\TempStats.dat) to fit my structure

Code:
; ******************************************************
;                 DC mBOT - Top10 Bot
; ******************************************************
on *:Text:*:#: {
  if (%Extra-Set == OFF) || (%Top10 != ON) || ($nick == $me) return
  if ($1 == %Trigger $+ top10) {
    if (%Top10-Flood. [ $+ [ $chan ] ] >= 2) {
      if (!%Top10-Halted. [ $+ [ $chan ] ]) { msg $chan The Top10 can respond for only 2 trigger within a minute. | set -u30 %Top10-Halted. [ $+ [ $chan ] ] Yes }
      return
    }
    inc -u60 %Top10-Flood. [ $+ [ $chan ] ] 1
    if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1) {
      msg $chan $Top10.MakeTop10($network $+ @ $+ $chan)
      unset %stats_top10_*
      window -c @top10source
    }
    else { msg $chan There is no record in Top10's database. | return }
  }
  if ($1 == %Trigger $+ ttop10) {
    inc -u60 %Top10-Flood 1
    if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1) {
      msg $chan $Top10.MakeTodayTop10($network $+ @ $+ $chan)
      unset %stats_top10_*
      window -c @top10source
    }
    else { msg $chan There is no record in Today-Top10's database. | return }
  }
  if ($1 == %Trigger $+ stats) {
    if (%Top10-Flood. [ $+ [ $chan ] ] >= 2) {
      if (!%Top10-Halted. [ $+ [ $chan ] ]) { msg $chan The Top10 can respond for only 2 trigger within a minute. | set -u30 %Top10-Halted. [ $+ [ $chan ] ] Yes }
      return
    }
    inc -u60 %Top10-Flood. [ $+ [ $chan ] ] 1
    msg $chan $Top10.Getstats($network $+ @ $+ $chan $+ @ $+ $iif($2,$2,$nick))
  }
  if ($1 == %Trigger $+ tstats) {
    if (%Top10-Flood. [ $+ [ $chan ] ] >= 2) {
      if (!%Top10-Halted. [ $+ [ $chan ] ]) { msg $chan The Top10 can respond for only 2 trigger within a minute. | set -u30 %Top10-Halted. [ $+ [ $chan ] ] Yes }
      return
    }
    inc -u60 %Top10-Flood. [ $+ [ $chan ] ] 1
    msg $chan $Top10.GetTodayStats($network $+ @ $+ $chan $+ @ $+ $iif($2,$2,$nick))
  }
  if ($1 == %Trigger $+ delstats) && ($2) && ($nick == %Owner-DC.mBOT || $Cown-Check($nick) || $nick == $2) {
    Top10.RemoveNickStat $network $+ @ $+ $chan $+ @ $+ $2
    msg $chan Erasing entries for Nick: $2
  }
  if ($1 == %Trigger $+ clearstats) && ($nick == %Owner-DC.mBOT || $Cown-Check($nick)) {
    Top10.RemoveChannelStat $network $+ @ $+ $chan
    msg $chan $chan Stats has been erased.
  }
  if ($left($1,1) == %Trigger) {
    hinc -m totalcommands $network $+ @ $+ $chan $+ @ $+ $nick 1
    hinc -m todaytotalcommands $network $+ @ $+ $chan $+ @ $+ $nick 1
  }
  hinc -m totalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32)
  hinc -m totalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-)
  hinc -m totallines $network $+ @ $+ $chan $+ @ $+ $nick 1
  hinc -m todaytotalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32)
  hinc -m todaytotalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-)
  hinc -m todaytotallines $network $+ @ $+ $chan $+ @ $+ $nick 1
}
on *:Action:*:#: {
  if (%Top10 == ON) {
    hinc -m totalactions $network $+ @ $+ $chan $+ @ $+ $nick 1
    hinc -m totalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32)
    hinc -m totalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-)
    hinc -m todaytotalactions $network $+ @ $+ $chan $+ @ $+ $nick 1
    hinc -m todaytotalwords $network $+ @ $+ $chan $+ @ $+ $nick $numtok($1-,32)
    hinc -m todaytotalletters $network $+ @ $+ $chan $+ @ $+ $nick $len($1-)
  }
}
on *:Start: {
  Top10.LoadStats
  if (!%Top10) { set %Top10 ON }
  .timer.resettodaystats 0:00 1 1 /Top10.DailyStatsFlush
}
on *:Exit: { Top10.SaveStats }

alias Top10.SaveStats {
  hsave -i totalwords $DC.Dir(mBOT\ChanStats.dat) totalwords
  hsave -i totalletters $DC.Dir(mBOT\ChanStats.dat) totalletters
  hsave -i totalcommands $DC.Dir(mBOT\ChanStats.dat) totalcommands
  hsave -i totalactions $DC.Dir(mBOT\ChanStats.dat) totalactions
  hsave -i totallines $DC.Dir(mBOT\ChanStats.dat) totallines
}
alias Top10.ClearTodayStats {
  .hfree -w todaytotal*
  .hmake todaytotalwords 20
  .hmake todaytotalletters 20
  .hmake todaytotalcommands 20
  .hmake todaytotalactions 20
  .hmake todaytotallines 20
}
alias Top10.LoadStats {
  .hmake totalwords 20
  .hmake totalletters 20
  .hmake totalcommands 20
  .hmake totalactions 20
  .hmake totallines 20
  .hload -i totalwords $DC.Dir(mBOT\ChanStats.dat) totalwords
  .hload -i totalletters $DC.Dir(mBOT\ChanStats.dat) totalletters
  .hload -i totalcommands $DC.Dir(mBOT\ChanStats.dat) totalcommands
  .hload -i totalactions $DC.Dir(mBOT\ChanStats.dat) totalactions
  .hload -i totallines $DC.Dir(mBOT\ChanStats.dat) totallines
}
alias Top10.ClearStats {
  ;var %stats_clearconfirm = $input(Are you sure? you want to wipe whole Statistics Database?,yvqd,Channel Top10)
  ;if (%stats_clearconfirm == $yes) {
  .hfree -w total*
  .hmake totalwords 20
  .hmake totalletters 20
  .hmake totalcommands 20
  .hmake totalactions 20
  .hmake totallines 20
  Top10.ClearTodayStats
  ; }
}
alias Top10.RemoveNickStat {
  var %stats-remnick = $1 $+ *
  if ($hget(totalwords)) { hdel -w totalwords %stats-remnick }
  if ($hget(totalletters)) { hdel -w totalletters %stats-remnick }
  if ($hget(totalcommands)) { hdel -w totalcommands %stats-remnick }
  if ($hget(totalactions)) { hdel -w totalactions %stats-remnick }
  if ($hget(totallines)) { hdel -w totallines %stats-remnick }
  Top10.SaveStats
}
alias Top10.RemoveChannelStat {
  var %stats-remchan = $1 $+ *
  if ($hget(totalwords)) { hdel -w totalwords %stats-remchan }
  if ($hget(totalletters)) { hdel -w totalletters %stats-remchan }
  if ($hget(totalcommands)) { hdel -w totalcommands %stats-remchan }
  if ($hget(totalactions)) { hdel -w totalactions %stats-remchan }
  if ($hget(totallines)) { hdel -w totallines %stats-remchan }
  if ($hget(todaytotalwords)) { hdel -w todaytotalwords %stats-remchan }
  if ($hget(todaytotalletters)) { hdel -w todaytotalletters %stats-remchan }
  if ($hget(todaytotalcommands)) { hdel -w todaytotalcommands %stats-remchan }
  if ($hget(todaytotalactions)) { hdel -w todaytotalactions %stats-remchan }
  if ($hget(todaytotallines)) { hdel -w todaytotallines %stats-remchan }
  Top10.SaveStats
}
alias Top10.Getstats {
  if ($hget(totalwords, $1)) {
    if ($hget(totalwords, $1)) { var %t.words = $hget(totalwords, $1) }
    else { var %t.words = 0 }
    if ($hget(totalletters, $1)) { var %t.letters = $hget(totalletters, $1) }
    else { var %t.letters = 0 }
    if ($hget(totalcommands, $1)) { var %t.commands = $hget(totalcommands, $1) }
    else { var %t.commands = 0 }
    if ($hget(totallines, $1)) { var %t.lines = $hget(totallines, $1) }
    else { var %t.lines = 0 }
    if ($hget(totalactions, $1)) { var %t.actions = $hget(totalactions, $1) }
    else { var %t.actions = 0 }
    return [ $+ $gettok($1,3,64) $+ ] Spoken Words: %t.words ( $+ %t.letters Letters) Commands Used %t.commands $+ . %t.lines Lines and %t.actions Actions.
  }
  return I Have No Stats About $gettok($1,3,64)
}
alias Top10.GetTodayStats {
  if ($hget(todaytotalwords, $1)) {
    if ($hget(todaytotalwords, $1)) { var %t.words = $hget(todaytotalwords, $1) }
    else { var %t.words = 0 }
    if ($hget(todaytotalletters, $1)) { var %t.letters = $hget(todaytotalletters, $1) }
    else { var %t.letters = 0 }
    if ($hget(todaytotalcommands, $1)) { var %t.commands = $hget(todaytotalcommands, $1) }
    else { var %t.commands = 0 }
    if ($hget(todaytotallines, $1)) { var %t.lines = $hget(todaytotallines, $1) }
    else { var %t.lines = 0 }
    if ($hget(todaytotalactions, $1)) { var %t.actions = $hget(todaytotalactions, $1) }
    else { var %t.actions = 0 }
    return [ $+ $gettok($1,3,64) $+ ] Spoken Words Today: %t.words ( $+ %t.letters Letters) Commands Used Today %t.commands $+ . %t.lines Lines and %t.actions Actions.
  }
  return I have no stats about $gettok($1,3,64)
}
alias Top10.MakeTop10 {
  Top10.SaveStats
  window @top10source
  clear @top10source
  if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1) {
    var %stats_findbegin = $read($DC.Dir(mBOT\ChanStats.dat), s, [totalwords])
    var %stats_looppoint = $calc($readn + 1)
    while (!%stats_loophalt) {
      var %stats_putline = $read($DC.Dir(mBOT\ChanStats.dat), %stats_looppoint)
      if ($left(%stats_putline,1) != $chr(91)) && ($left(%stats_putline,$len($1)) == $1) {
        var %statscleanline = $gettok($read($DC.Dir(mBOT\ChanStats.dat), %stats_looppoint),3,64)
        aline @top10source %statscleanline
      }
      elseif ($left(%stats_putline,1) == $chr(91)) { var %stats_loophalt = true }
      inc %stats_looppoint
    }
    filter -cetuww 2 61 @top10source @top10source *
    var %stats_loop10 = 1
    while (!%statssecondloophalt) {
      if ($line(@top10source, %stats_loop10)) {
        set -e %stats_top10_ [ $+ [ %stats_loop10 ] ] $gettok($line(@top10source, %stats_loop10),1,61) ( $+ $gettok($line(@top10source, %stats_loop10),2,61) $+ )
        inc %stats_loop10
      }
      if (!$line(@top10source, %stats_loop10)) || (%stats_loop10 == 10) { var %statssecondloophalt = true }
    }
    if ($calc(%stats_loop10 - 1) == 0) return There is no record in Top10's database.
    return $+(Top,$calc(%stats_loop10 - 1),,$chr(32),Chatters by Total Spoken Words:,$chr(32)) $iif(%stats_top10_1, 1st: %stats_top10_1) $iif(%stats_top10_2, 2nd: %stats_top10_2) $iif(%stats_top10_3, 3rd: %stats_top10_3) $iif(%stats_top10_4, 4th: %stats_top10_4) $iif(%stats_top10_5, 5th: %stats_top10_5) $iif(%stats_top10_6, 6th: %stats_top10_6) $iif(%stats_top10_7, 7th: %stats_top10_7) $iif(%stats_top10_8, 8th: %stats_top10_8) $iif(%stats_top10_9, 9th: %stats_top10_9) $iif(%stats_top10_10, 10th: %stats_top10_10)
  }
}
alias Top10.MakeTodayTop10 {
  window @top10source
  clear @top10source
  hsave -i todaytotalwords $DC.Dir(mBOT\TempStats.dat) totalwords
  if ($lines($DC.Dir(mBOT\ChanStats.dat)) > 1) {
    var %stats_loopline = 1
    while (%stats_loopline <= $lines($DC.Dir(mBOT\TempStats.dat))) {
      if ($gettok($read($DC.Dir(mBOT\TempStats.dat),%stats_loopline),1,64) == $gettok($1,1,64)) && ($gettok($read($DC.Dir(mBOT\TempStats.dat),%stats_loopline),2,64) == $gettok($1,2,64)) {
        aline -p @top10source $gettok($read($DC.Dir(mBOT\TempStats.dat),%stats_loopline),3,64)
      }
      inc %stats_loopline
    }
    filter -cetuww 2 61 @top10source @top10source *
    var %stats_loop10 = 1
    while (!%statssecondloophalt) {
      if ($line(@top10source, %stats_loop10)) {
        set -e %stats_top10_ [ $+ [ %stats_loop10 ] ] $gettok($line(@top10source, %stats_loop10),1,61) ( $+ $gettok($line(@top10source, %stats_loop10),2,61) $+ )
        inc %stats_loop10
      }
      if (!$line(@top10source, %stats_loop10)) || (%stats_loop10 < 11) { var %statssecondloophalt = true }
    }
    .remove $DC.Dir(mBOT\TempStats.dat)
    if ($calc(%stats_loop10 - 1) == 0) return There is no record in Today-Top10's database.
    return $+(Today's Top,,$calc(%stats_loop10 - 1), ,$chr(32),Chatters by Total Spoken Words:,$chr(32)) $iif(%stats_top10_1, 1st: %stats_top10_1) $iif(%stats_top10_2, 2nd: %stats_top10_2) $iif(%stats_top10_3, 3rd: %stats_top10_3) $iif(%stats_top10_4, 4th: %stats_top10_4) $iif(%stats_top10_5, 5th: %stats_top10_5) $iif(%stats_top10_6, 6th: %stats_top10_6) $iif(%stats_top10_7, 7th: %stats_top10_7) $iif(%stats_top10_8, 8th: %stats_top10_8) $iif(%stats_top10_9, 9th: %stats_top10_9) $iif(%stats_top10_10, 10th: %stats_top10_10)
  }
}
alias Top10.DailyStatsFlush {
  .timer.resettodaystats 0:00 /Top10.DailyStatsFlush
  Top10.ClearTodayStats
  if ($server) { amsg Resetting Today's Top10 statistics - It's Midnight here... }
}

Re: Help with explaining [Re: raycomp] #247994 13/09/14 12:27 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
if the ChanStats.dat is into the D:\mIRC\System direction you must change all the $DC.Dir(mBOT\ChanStats.dat) to $DC.Dir(ChanStats.dat) the same and with the other files..