mIRC Home    About    Download    Register    News    Help

Print Thread
#155564 07/08/06 11:28 PM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
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.
#155565 07/08/06 11:51 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code amended per updated posting
Code:
 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.
#155566 08/08/06 12:11 AM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
Joined: May 2006
Posts: 87
I meant to say !shootwater instead of !openegg...sorry smirk

#155567 08/08/06 12:30 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Try the edited code. It should work without any problems.

#155568 08/08/06 01:57 AM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
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!"?

#155569 08/08/06 02:02 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
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.

#155570 08/08/06 02:25 AM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
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.

#155571 08/08/06 03:27 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK, I see the problem, and here's the repaired code
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 &gt; 19,wins,looses)
  unset $+(%,water,.,$1)
}
 

#155572 08/08/06 12:50 PM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
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?

#155573 08/08/06 03:20 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
in the shootwater alias, change the > 19 portion to > 9.


-KingTomato
#155574 08/08/06 05:54 PM
Joined: May 2006
Posts: 87
S
Babel fish
OP Offline
Babel fish
S
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.

Code:
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 &gt; 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.

#155575 08/08/06 10:40 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on *:text:!shootwater:#:{
  if !%esplay &amp;&amp; !%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) &gt; 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.


Link Copied to Clipboard