|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
I'm making a script for a game. What I want is if a person uses !shootwater twenty times in 25 seconds, they receive a message called "Congratulations, you win!" However, if that person does not type !shootwater twenty times in 25 seconds, then they receive a message called "You lose." Could someone help me with this?
Last edited by Sableye2; 08/08/06 12:11 AM.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Code amended per updated posting on *:text:!shootwater:#:{
inc $+(%,water,.,$nick)
$+(.timer,$nick) 1 25 shootwater $nick $chan $($+(%,water,.,$nick),2)
}
alias shootwater {
.msg $2 $1 $iif($3 > 19,wins,looses)
unset $+(%,water,.,$1)
}
Last edited by RusselB; 08/08/06 12:30 AM.
|
|
|
|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
I meant to say !shootwater instead of !openegg...sorry 
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Try the edited code. It should work without any problems.
|
|
|
|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
Thank you for the script. Now is there a way to make the message more complex? Instead of <nick> wins or <nick> loses, could I have something like "Good job! You have won the game!"?
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Just replace the word wins in the original script with what you want for the winning message, and likewise for looses.
Please note that due to the way I have it coded, you can not use a comma in the message, and multiple line messages have to use pipes or they won't work.
If you want to have one or more commas in the message, I can recode to allow that, likewise for multiple line messages.
|
|
|
|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
The messages are fine, but there's something wrong with the timer settings. Whenever I type in !shootwater 20 times it displays the Win message even if it has been more than 25 seconds. It also doesn't display a message immediately after 25 seconds. It's like a minute before I receive a message.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
OK, I see the problem, and here's the repaired code on *:text:!shootwater:#:{
inc $+(%,water,.,$nick)
if !$timer($nick) {
$+(.timer,$nick) 1 25 shootwater $nick $chan $($+(%,water,.,$nick),2)
}
}
alias shootwater {
.msg $2 $1 $iif($3 > 19,wins,looses)
unset $+(%,water,.,$1)
}
|
|
|
|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
Thanks. If I were to change the number of times I say !shootwater, what part would I change? Right now it's set for 20 times. How would I change it to 10 times?
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
in the shootwater alias, change the > 19 portion to > 9.
-KingTomato
|
|
|
|
Joined: May 2006
Posts: 87
Babel fish
|
OP
Babel fish
Joined: May 2006
Posts: 87 |
The thing says that I lose each time even though I have typed in !shootwater 10 times before 25 seconds. Perhaps it's the few changes I made that made the script stop working. on *:text:!shootwater:#:{
if (%esplay == null) {
notice $chan This game is currently for %esnick only!
halt
}
if (%seadra == null) {
notice $chan This game is currently for %esnick only!
halt
}
inc $+(%,water,.,$nick)
if !$timer($nick) {
$+(.timer,$nick) 1 25 shootwater $nick $chan $($+(%,water,.,$nick),2)
}
}
alias shootwater {
.msg $2 $1 $iif($3 > 9,good job! You killed Snorlax! Inside of him was a special Chansey egg Use !openegg to open it.,lose! You win nothing.)
unset $+(%,water,.,$1)
}
I really don't know why it won't display the winning message. Only displays the losing message. Help is appreciated.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
on *:text:!shootwater:#:{
if !%esplay && !%seadra {
notice $chan This game is currently for %esnick only!
}
else {
inc $+(%,water,.,$nick)
if !$timer($nick) {
$+(.timer,$nick) 1 25 shootwater $nick $chan
}
}
}
alias shootwater {
.msg $2 $1 $iif($($+(%,water,.,$1),2) > 9,good job! You killed Snorlax! Inside of him was a special Chansey egg Use !openegg to open it.,lose! You win nothing.)
unset $+(%,water,.,$1)
}
For some reason, and I'm not sure why, the 3rd parameter wasn't being passed to the alias properly. The above code works around that problem and has been tested.
|
|
|
|
|