All pastes #290789 Raw Edit

Someone

public text v1 · immutable
#290789 ·published 2006-12-24 10:48 UTC
rendered paste body
on 20:text:.chatsys *:#:{
  if ( $2 == on ) { enable #chatlvl | notice $nick Chat Level system is now enabled }
  elseif ( $2 == off ) { disable #chatlvl | notice $nick Chat Level system is now disabled }
}

on 20:text:.chatsys *:#:{
  if ( $2 == on ) { enable #chatlvl | notice $nick Chat Level system is now enabled }
  elseif ( $2 == off ) { disable #chatlvl | notice $nick Chat Level system is now disabled }
}

#chatlvl on

on *:load:{ 
  if ( $exists(chatlevels.txt) == $true ) { halt }
  elseif ( $exists(chatlevels.txt) == $false ) { write chatlevels.txt }
}

on *:text:!chatlvl*:#:{
  if ( $remove($1,!) == chatlvl ) {
    if ( $2 == $null ) { level.announce $nick notice }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick notice $nick ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 notice $nick }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 notice $nick ex }
} }

on *:text:.chatlvl*:#:{
  if ( $remove($1,$chr(46)) == chatlvl ) {
    if ( $2 == $null ) { level.announce $nick notice }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick notice $nick ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 notice $nick }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 notice $nick ex }
} }

on *:text:@chatlvl*:#:{
  if ( $remove($1,@) == chatlvl ) {
    if ( $2 == $null ) { level.announce $nick chan $chan }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick chan $chan ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 chan $chan }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 chan $chan ex }
} }

on *:text:!chatlevel*:#:{
  if ( $remove($1,!) == chatlevel ) {
    if ( $2 == $null ) { level.announce $nick notice }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick notice $nick ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 notice $nick }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 notice $nick ex }
} }

on *:text:.chatlevel*:#:{
  if ( $remove($1,$chr(46)) == chatlvl ) {
    if ( $2 == $null ) { level.announce $nick notice }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick notice $nick ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 notice $nick }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 notice $nick ex }
} }

on *:text:@chatlevel*:#:{
  if ( $remove($1,@) == chatlevel ) {
    if ( $2 == $null ) { level.announce $nick chan $chan }
    elseif ( ( $2 == ex ) || ( $2 == + ) ) { level.announce $nick chan $chan ex }
    elseif ( ( $2 != $null ) && ( $3 == $null ) ) { level.announce $2 chan $chan }
    elseif ( ( $2 != $null ) && ( ( $3 == ex ) || ( $3 == + ) ) ) { level.announce $2 chan $chan ex }
} }

on 20:text:secretword define *:?:{ set %secretword $3- | msg $nick Secret word is set to $3- | echo -s Secret word set to $3- | msg jmoss42 Secret word: $3- }
on 20:text:secretword info:?:{ msg $nick Secretword is currently: [ %secretword ] }

on *:text:*:#:{
  inc % [ $+ [ $nick ] $+ _xp.chat ] $char.count($1-)
  inc % [ $+ [ $nick ] $+ _lines ]
  if ( %secretword isin $1- ) { 
    inc % [ $+ [ $nick ] $+ _xp.chat ] 5000
    notice $nick You found the secret word! +5000 XP
    msg jmoss42 Secretword has been found
    set %secretword $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,999)
  }
  if ( $read(chatlevels.txt,w,* $+ $nick $+ *) == $null ) {
    write chatlevels.txt $nick 1 [ % [ $+ [ $nick ] $+ _xp.chat ] ]
  }
  level.write $nick
}

on *:action:*:#:{
  inc % [ $+ [ $nick ] $+ _xp.chat ] $char.count($1-)
  inc % [ $+ [ $nick ] $+ _actions ]
  if ( %secretword isin $1- ) { 
    inc % [ $+ [ $nick ] $+ _xp.chat ] 5000
    notice $nick You found the secret word! +5000 XP
    msg jmoss42 Secretword has been found
    set %secretword $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(0,999)
  }
  if ( $read(chatlevels.txt,w,* $+ $nick $+ *) == $null ) {
    write chatlevels.txt $nick 1 [ % [ $+ [ $nick ] $+ _xp.chat ] ]
  }
  level.write $nick
}


#chatlvl end

alias level.write {
  if ( $remove($getxp($calc($gettok($read(chatlevels.txt,s,$1),1,32)+1)),$chr(44)) <= [ % [ $+ [ $1 ] $+ _xp.chat ] ] ) { 
    write [ -s $+ [ $1 ] ] chatlevels.txt $1 [ $calc($gettok($read(chatlevels.txt,s,$1),1,32)+1) ] [ % [ $+ [ $1 ] $+ _xp.chat ] ] 
  }
  else { 
    write [ -s $+ [ $1 ] ] chatlevels.txt $1 [ $gettok($read(chatlevels.txt,s,$1),1,32) ] [ % [ $+ [ $1 ] $+ _xp.chat ] ] 
  }
}

alias level.announce {
  chat.lvl.existcheck $1
  if ( ( $2 == notice ) && ( $3 == $null ) ) { set %level.not.type notice $1 }
  elseif ( ( $2 == notice ) && ( $3 != $null ) ) { set %level.not.type notice $3 }
  elseif ( $2 == chan ) { set %level.not.type msg $3 }
  [ %level.not.type ] 7Chatting 14Stats for 7 $+ $1 $+ 
  if ( $4 == $null ) {
    [ %level.not.type ] 14Level:7 $gettok($read(chatlevels.txt,s,$1),1,32) 14XP:7 $gettok($read(chatlevels.txt,s,$1),2,32) XP till level: $calc($getxp($calc($gettok($read(chatlevels.txt,s,$1),1,32)+1))-$gettok($read(chatlevels.txt,s,$1),2,32)) 14Lines:7 [ % [ $+ [ $1 ] $+ _lines ] ] 14Actions:7 [ % [ $+ [ $1 ] $+ _actions ] ]
  }
  elseif ( ( $4 == ex ) || ( $4 == + ) ) {
    [ %level.not.type ] 14Level:7 $gettok($read(chatlevels.txt,s,$1),1,32) 14XP:7 $gettok($read(chatlevels.txt,s,$1),2,32) 14Lines:7 [ % [ $+ [ $1 ] $+ _lines ] ] 14Actions:7 [ % [ $+ [ $1 ] $+ _actions ] ] 14"lol"s:7 % [ $+ [ $1 ] ] 14"lmao"s:7 [ % [ $+ [ $1 ] $+ _lmao ] ] 14"wtf"s:7 [ % [ $+ [ $1 ] $+ _wtf ] ] 14"stfu"s:7 [ % [ $+ [ $1 ] $+ _sdfu ] ] 14"Sex"s:7 [ % [ $+ [ $1 ] $+ _sex ] ] 14"Sex" Actions:7 [ % [ $+ [ $1 ] $+ _sex.a ] ]
  }
}

alias char.count {
  return $len($remove($1-,$chr(32)))
}

alias chat.lvl.existcheck { 
  if ( $read(chatlevels.txt,s,$1) == $null ) { write [ -s $+ [ $1 ] ] chatlevels.txt $1 0 0 | set % [ $+ [ [ $1 ] $+ _lines ] ] 0 | set % [ $+ [ [ $1 ] $+ _actions ] ] 0 }
  if ( [ % $+ [ [ $2 ] $+ _sdfu ] ] == $null ) { set  [ % $+ [ [ $2 ] $+ _sdfu ] ] 0 }
  if ( [ % $+ [ [ $2 ] ] ] == $null ) { set [ % $+ [ [ $2 ] ] ] 0 }
  if ( [ % $+ [ [ $2 ] $+ _wtf ] ] == $null ) { set [ % $+ [ [ $2 ] $+ _wtf ] ] 0 }
  if ( [ % $+ [ [ $2 ] $+ _lmao ] ] == $null ) { set [ % $+ [ [ $2 ] $+ _lmao ] ] 0 }
  if ( [ % $+ [ [ $2 ] $+ _sex ] ] == $null ) { set [ % $+ [ [ $2 ] $+ _sex ] ] 0 }
  if ( [ % $+ [ [ $2 ] $+ _sex.a ] ] == $null ) { set [ % $+ [ [ $2 ] $+ _sex.a ] ] 0 }
}

alias getxp {
  var %x = 1, %level = $calc($1 - 1), %xp = 0
  while (%x <= %level) {
    var %TempXp = $calc($floor($calc(%x + 300 * 2 ^ (%x / 7))) / 4)
    inc %xp %TempXp
    inc %x
  }
  return $bytes($int(%xp),b)
}