mIRC Homepage
Posted By: shaked scores - 12/03/05 03:33 PM
i want the following thing:
when user say variable %word (let say %word is "hello")
he gets a point and his points are posted
(msg # $nick have %usr. $+ $nick points )
eventually the user with the highest score is posted
(msg # user $nick won! he got %usr. $+ $nick score! )
i also wants a high score of top 10 users

this is for a trivia game, i tryed programming it for a few hours but i failed frown please help!
Posted By: DaveC Re: scores - 12/03/05 07:11 PM
Code:
#on_text_word on
on *:text:%word:#channel:{
  inc %usr. [ $+ [ $nick ] ]
  msg # User $nick won! he got %usr. [ $+ [ $nick ] ] score!
  disable #on_text_word
}
#on_text_word end
;
; When next clue given do follwoing two commands
; set %word word value here
; enable #on_text_word
;
alias top10 {
  unset %top10
  var %i = $var(%usr.*,0)
  while (%i) {
    %top10 = $gettok( $sorttok( %top10 $+([ [ $var(%usr.*,%i) ] ],$chr(160),$mid($var(%usr.*,%i),6)) ,32,nr) ,1-10,32)
    dec %i
  }
}
; top 10 names held in %top10 format is score*nick score*nick etc etc ( * represents $chr(160) )
; to get the 1st to 10th persons score*nick you use $gettok(%top10,X,32) X being 1 to 10
; to get that persons score you use $gettok( $gettok(%top10,X,32) ,1,160)
; to get that persons nick you use $gettok( $gettok(%top10,X,32) ,2-,160)
;
; msg # User $gettok( $gettok(%top10,1,32) ,2-,160) won! he got $gettok( $gettok(%top10,1,32) ,1,160) score!
;
; msg # Top Ten Users are $replacex(%top10,$chr(32),$+($chr(32),-,$chr(32)))
;
Posted By: shaked Re: scores - 13/03/05 06:15 PM
Code:
alias top10 {
  unset %top10
  var %i = $var(%usr.*,0)
  while (%i) {
    %top10 = $gettok( $sorttok( %top10 $+([ [ $var(%usr.*,%i) ] ],$chr(160),$mid($var(%usr.*,%i),6)) ,32,nr) ,1-10,32)
    dec %i
  }
}
  

please explain it
how do i make it work?
i want :
msg # number 1 is %nick.1 with %nick.1.pts
msg # number 2 is %nick.2 with %nick.2.pts
you get the point
© mIRC Discussion Forums