mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2014
Posts: 8
A
AcerCZ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2014
Posts: 8
Hello, i need little help with my twitch mirc bot. I was already watching and reading lot of topics but i cant find solution.
My point system is working and writing data to Points.ini . Only think what i am looking for is to add command !pointlist and want to get back something like:
bot: Hello, there is list of points (nick 5 points, nick2 4 points, nick3 3 points)

It can be top 10 ordered by highest point, whole list can be long.

There is script of classic point system: http://pastebin.com/mzSsvrDm
or there whole code.
Code:
alias -1 addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not number. | halt }
  var %topic $+($chan,.,$nick)
  var %points $calc($readini(Points.ini,%topic,Points) + $1)
  writeini -n Points.ini %topic Points %points
  return %points
}
alias -1 lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,$topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum { echo 2 =st $3 není číslo. Hodnota musí být číslo. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points $points
  echo -a Added points for %topic
}
alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}
on *:TEXT:!points:#: { 
  msg # $nick má právě $readini(Points.ini,$+(#,.,$nick),Points) bodů. 
}
on *:TEXT:!pointlist:#: { 
  msg # I CANT EVEN MAKE THIS :( 
}
on $*:text:/!points (add|remove)/Si:#:{
  if  ($nick isop #) {
    if ($0 < 3) { msg # Špatný paremetr: p&#345;íkaz je !points <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3  má práv&#283; $readini(Points.ini,$+(#,.,$3),Points) bod&#367;. )
    }
  else {msg $chan Tento p&#345;íkaz je povolen pouze moderátor&#367;m. }
}

on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}

on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


There is example how its Points.ini looking.
Code:
[#acercz.acercz]
Points=149

[#acercz.luke_seventh]
Points=129

[#acercz.acercze]
Points=12

[#acercz.moobot]
Points=20

[#acercz.punkys91]
Points=388

[#acercz.lochnes]
Points=173

[#acercz.toxo115]
Points=91


Thank you for any tip or help.

Last edited by AcerCZ; 03/07/14 07:27 PM. Reason: added file example
Joined: Jul 2014
Posts: 8
A
AcerCZ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2014
Posts: 8
Ok i got it now !
For everyone else who will be looking for that, there is script. Just add it where u want. Just replace "broadcasternickname" with your nickname to make it works.

For broadcaster only
Code:
on *:TEXT:!top10:#:{
  if $nick == broadcasternickname { top10 # } 
  else { msg # You are not allowed to use !top10. }
}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.
}

For moderators only
Code:
on *:TEXT:!top10:#:{
  if  ($nick isop #) { top10 # } 
  else { msg # You are not allowed to use !top10. }
}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.
}

For all
Code:
on *:TEXT:!top10:#:{
  top10 # 
}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.
}

Last edited by AcerCZ; 03/07/14 11:03 PM.
Joined: Jan 2014
Posts: 107
M
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
Tested the script with "op/mod only"

Doesn't work - causes mIRC to freeze.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Working is this one.

https://forums.mirc.com/ubbthreads.php/topics/245630/Re:_How_to_display_a_top_10#Post245630


Link Copied to Clipboard