egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need help with change the output

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Bahasa
Voice


Joined: 27 Jul 2008
Posts: 19

PostPosted: Sun Jul 27, 2008 6:30 pm    Post subject: need help with change the output Reply with quote

Code:
if {![info exists userinfover] } {
 putlog "*** Can't load Counter 2.0 -- Userinfo v1.01 required"
 return 0
}

bind pub f|f !totaljoins pub:totaljoins
bind dcc f|f totaljoins dcc:totaljoins
bind join -|- * joincounter
bind pub f|f !totalkicks pub:totalkicks
bind dcc f|f totalkicks dcc:totalkicks
bind kick -|- * kickcounter
set khits 0
set jhits 0

proc convert {number} {
 set one st
 set two nd
 set three rd
 set others th
 set numlength [string length $number]
 incr numlength -2
 set num2ndchar [string index $number $numlength]
 switch $num2ndchar {
  1 { set number $number$others }
  default {
   incr numlength
   set numchar [string index $number $numlength]
   switch $numchar {
    1 { set number $number$one }
    2 { set number $number$two }
    3 { set number $number$three }
    default { set number $number$others }
   }
  }
 }
 return $number
}

proc dcc:totaljoins {hand idx arg} {
 if {$arg == ""} {
  set temp 0
  set chan [lindex [console $idx] 0]
  set rchan [string tolower $chan]
  if {[file exists ./scripts/$rchan.jcount.txt]} {
   set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putdcc $idx "$temp orang yang sudah berkunjung ke $rchan"
   return 0
  } else {
   putdcc $idx "Sorry, no one has visited $rchan yet"
  }
 } else {
  set temp 0
  set rchan [string tolower $arg]
  if {[file exists ./scripts/$rchan.jcount.txt]} {
   set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putdcc $idx "$temp orang yang sudah berkunjung ke $rchan"
   return 0
  } else {
   putdcc $idx "Sorry, no one has visited $rchan yet"
  }
 }
}

proc pub:totaljoins {nick host hand chan arg} {
 if { $arg == "" } {
  set temp 0
  set rchan [string tolower $chan]
  if {[file exists ./scripts/$rchan.jcount.txt]} {
   set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putserv "PRIVMSG $chan :$temp orang yang sudah berkunjung ke $chan"
   return 0
  } else {
   putserv "PRIVMSG $chan :Sorry, no one has visited $rchan yet"
  }
 } else {
  set temp 0
  set rchan [string tolower $arg]
  if {[file exists ./scripts/$rchan.jcount.txt]} {
   set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putserv "PRIVMSG $chan :$temp orang yang sudah berkunjung ke $rchan"
   return 0
  } else {
   putserv "PRIVMSG $chan :Sorry, no one has visited $rchan yet"
  }
 }
}

proc joincounter {nick host hand chan} {
 global jhits
 set temp 0
 set rchan [string tolower $chan]
 if {[file exists ./scripts/$rchan.jcount.txt]} {
  set o_fid [open "./scripts/$rchan.jcount.txt" "RDONLY"]
  gets $o_fid temp
  close $o_fid
 } else {
  set o_fid [open "./scripts/$rchan.jcount.txt" "CREAT RDWR"]
  puts $o_fid temp
  close $o_fid
 }
 set jhits $temp
 incr jhits
 putserv "NOTICE $nick :selamat datang. kamu adalah orang ke [convert $jhits] yang sudah berkunjung ke $chan"
 set o_id [open "./scripts/$rchan.jcount.txt" "WRONLY"]
 puts $o_id $jhits
 close $o_id
}


proc dcc:totalkicks {hand idx arg} {
 if {$arg == ""} {
  set temp 0
  set chan [lindex [console $idx] 0]
  set rchan [string tolower $chan]
  if {[file exists ./scripts/$rchan.kcount.txt]} {
   set o_fid [open "./scripts/$rchan.kcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putdcc $idx "$temp people have been kicked from $rchan"
   return 0
  } else {
   putdcc $idx "Sorry, no one has been kicked from $rchan yet"
  }
 } else {
  set temp 0
  set nick [string tolower $arg]
  if {[validuser $nick]} {
   if {[getuser $nick XTRA KICKS] == ""} {
    putdcc $idx "$arg hasn't kicked anyone yet"
   } else {
    set tkicks [getuser $nick XTRA KICKS]
    putdcc $idx "$arg has kicked $tkicks lamers"
   }
  } else {
   putdcc $idx "I do not know who $arg is"
  }
 }
}       

proc pub:totalkicks {nick host hand chan arg} {
 if {$arg == ""} {
  set temp 0
  set rchan [string tolower $chan]
  if {[file exists ./scripts/$rchan.kcount.txt]} {
   set o_fid [open "./scripts/$rchan.kcount.txt" "RDONLY"]
   gets $o_fid temp
   close $o_fid
   putserv "PRIVMSG $chan :$temp people have been kicked from $rchan"
   return 0
  } else {
   putserv "PRIVMSG $chan :Sorry, no one has been kicked from $rchan yet"
  }
 } else {
  set temp 0
  set nick [string tolower $arg]
  if {[validuser $nick]} {
   if {[getuser $nick XTRA KICKS] == ""} {
    putserv "PRIVMSG $chan :$arg hasn't kicked anyone yet"
   } else {
    set tkicks [getuser $nick XTRA KICKS]
    putserv "PRIVMSG $chan :$arg has kicked $tkicks lamers"
   }
  } else {
   putserv "PRIVMSG $chan :I do not know who $arg is"
  }
 }
}

proc kickcounter {nick host hand chan knick reason} {
 global khits
 set temp 0
 set rchan [string tolower $chan]
 if {[file exists ./scripts/$rchan.kcount.txt]} {
  set o_fid [open "./scripts/$rchan.kcount.txt" "RDONLY"]
  gets $o_fid temp
  close $o_fid
 } else {
  set o_fid [open "./scripts/$rchan.kcount.txt" "CREAT RDWR"]
  puts $o_fid temp
  close $o_fid
 }
 set khits $temp
 incr khits
 if {[validuser [nick2hand $nick $chan]]} {
  if {[getuser $hand XTRA KICKS] == ""} {
   setuser $hand XTRA KICKS 0
  }
  set tkicks [getuser $hand XTRA KICKS]
  incr tkicks
  setuser $hand XTRA KICKS $tkicks
  putserv "PRIVMSG $chan :$nick udah ngekick $tkicks nickname. siapa selanjutnya? hehehe"
 }
 putserv "NOTICE $knick :kamu adalah orang ke [convert $khits] yang sudah di kick dari $chan"
 putserv "PRIVMSG $chan :$knick adalah orang ke [convert $khits] yang sudah di kick dari $chan"
 set o_id [open "./scripts/$rchan.kcount.txt" "WRONLY"]
 puts $o_id $khits
 close $o_id
}

selamat datang. kamu adalah orang ke 62nd yang sudah berkunjung ke #channelname

how to change/remove the nd behing the counter number so it will show jus number w/out st, nf, or th
_________________
Bahasa Indonesia
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Jul 27, 2008 10:59 pm    Post subject: Reply with quote

Code:
proc convert {number} {
 set one st
 set two nd
 set three rd
 set others th
 set numlength [string length $number]
 incr numlength -2
 set num2ndchar [string index $number $numlength]
 switch $num2ndchar {
  1 { set number $number$others }
  default {
   incr numlength
   set numchar [string index $number $numlength]
   switch $numchar {
    1 { set number $number$one }
    2 { set number $number$two }
    3 { set number $number$three }
    default { set number $number$others }
   }
  }
 }
 return $number
}

This procedure does that, change it to this
Code:
proc convert {number} {
   return $number
}

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Bahasa
Voice


Joined: 27 Jul 2008
Posts: 19

PostPosted: Mon Jul 28, 2008 2:41 am    Post subject: Reply with quote

its working, thanks Smile speechles
_________________
Bahasa Indonesia
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber