mIRC Home    About    Download    Register    News    Help

Print Thread
#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?

Joined: Dec 2002
Posts: 3,138
C
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))
}

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?

Joined: Dec 2002
Posts: 3,138
C
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))
}


Link Copied to Clipboard