mIRC Home    About    Download    Register    News    Help

Print Thread
#114134 12/03/05 03:33 PM
Joined: Mar 2005
Posts: 14
S
shaked Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2005
Posts: 14
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!

#114135 12/03/05 07:11 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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)))
;

#114136 13/03/05 06:15 PM
Joined: Mar 2005
Posts: 14
S
shaked Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Mar 2005
Posts: 14
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


Link Copied to Clipboard