mIRC Home    About    Download    Register    News    Help

Print Thread
Hint process on a trivia bot #4218 31/12/02 12:20 PM
Joined: Dec 2002
Posts: 2
E
Ewan Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: Dec 2002
Posts: 2
I'm writing a triviabot and having a hard time with the hints section. I would like that, when people calls for a hint (with !hint or something alike), it starts to give one letter each 5 secs. Example: if the answer was 'mIRC', it would start giving '****" then after 5 secs, "m***", and so on. Can anyone help me?

Re: Hint process on a trivia bot #4219 31/12/02 12:32 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Here is my version, replace %answer with the name of the variable where you are storing the answer..

on *:TEXT:!hint:#:{
set %hint 0
hint # %answer
.timerhint 0 5 hint # %answer
}
alias hint {
if ( %hint < $len($$2) ) {
msg $$1 Hint: $hintt($$2,%hint)
}
inc %hint
if ( %hint == $len($$2) ) {
msg $$1 No more hints!
timerhint off
}
}
alias hintt {
return $left($$1,$$2) $+ $str(*,$calc($len($$1) - $$2))
}

Re: Hint process on a trivia bot #4220 31/12/02 03:44 PM
Joined: Dec 2002
Posts: 2
E
Ewan Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: Dec 2002
Posts: 2
Ok thanks!

It works perfectly how I wanted but it does only for answers with 1 word. What should I do to apply that to more than 1 word answer?

Re: Hint process on a trivia bot #4221 31/12/02 04:29 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Whoops, didn't think of that, fixed:

on *:TEXT:!hint:#:{
set %hint 0
hint # %answer
.timerhint 0 5 hint # %answer
}
alias hint {
if ( %hint < $len($$2-) ) {
msg $$1 Hint: $hintt($$2-,%hint)
}
inc %hint
if ( %hint == $len($$2-) ) {
msg $$1 No more hints!
timerhint off
}
}
alias hintt {
return $left($$1,$$2) $+ $str(*,$calc($len($$1) - $$2))
}