!pointlist command for twitch bot

By cadanj on Jul 01, 2014

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, whole list can be long.

There is script of classic point system: http://pastebin.com/mzSsvrDm

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 # Žebříček bodů: $readini(Points.ini,$+(#,.,$nick),Points) bodů. 
}
on $*:text:/!points (add|remove)/Si:#:{
  if  ($nick isop #) {
    if ($0 < 3) { msg # Špatný paremetr: pří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ě $readini(Points.ini,$+(#,.,$3),Points) bodů. )
    }
  else {msg $chan Tento příkaz je povolen pouze moderátorů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)
}

Comments

Sign in to comment.
cadanj   -  Jul 03, 2014

Ok got it.

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 @.
}
Nephurus  -  Aug 26, 2014

Would you be so kind as to re post the point system post? dead link.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.