mIRC Home    About    Download    Register    News    Help

Print Thread
#236338 19/02/12 08:15 AM
Joined: Feb 2012
Posts: 5
L
Ludvig Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2012
Posts: 5
Hello!

I tried to wright a Rock Paper Scissors script. That i wanted to do like this, Ill give u an example on how

[OP player]: !rps jane lars cat

Bot: jane vs lars - a cat in pot - Please /msg Bot !rock, !paper or !scissors now!

jane:/msg bot !rock
lars:/msg bot !paper

Bot: lars wins the cat over jane with paper against rock

Heres what ive written:

Php Code:
alias -l applyaction {
  msg %rollchan STATUS $2 : $3 : %roller1 : %roller2 : %roll1 : %roll2
  if ($2 == %roller1) {
	set %roll1 $3
  }
  elseif ($2 == %roller2) {
	set %roll2 $3
  }
  elseif (%rollchan != $null) { kick %rollchan $2 It is not your turn to play this game! }

  if ((%roll1 != $null) && (%roll2 != $null)) {
	if (%roll1 == %roll2) {
	  msg %rollchan Duel between %roller1 and %roller2 was a draw, both using %roll1
	  unset %*roll*
	}
	elseif (((%roll1 == rock) && (%roll2 == scissors)) || ((%roll1 == scissors) && (%roll2 == paper)) || ((%roll1 == paper) && (%roll2 == rock))) {
	  msg %rollchan %roller1 wins the %rollpot over %roller2 with %roll1 against %roll2
	  unset %*roll*
	}
	else {
	  msg %rollchan %roller2 wins the %rollpot over %roller1 with %roll2 against %roll1
	  unset %*roll*
	}
  }
}

on *:TEXT:!rps*:#:{
  if ($nick isop $chan) {
	if (($2 != $null) && ($3 != $null) && ($4 != $null)) {
	  set %roller1 $2
	  set %roller2 $3
	  set %rollpot $4
	  set %rollchan $chan
	  msg $chan %roller1 vs %roller2 - a %rollpot in Pot - Please /msg $me !rock, !paper or !scissors now!
	}
  }
}

on *:TEXT:!rock:?:{ applyaction $nick rock }
on *:TEXT:!paper:?:{ applyaction $nick paper }
on *:TEXT:!scissors:?:{ applyaction $nick scissors }
on *:NOTICE:!rock:?:{ applyaction $nick rock }
on *:NOTICE:!paper:?:{ applyaction $nick paper }
on *:NOTICE:!scissors:?:{ applyaction $nick scissors } 


But when i come to the part where the roller1 and roller2 types !rock or !paper or ! scissors the bot sends a message that everyone can read even the oppoment before choosing self...;

STATUS rock : : roller1 : boten : :

I would like it to hidd this text somehow. And after that when it has both players haved choosed it will say who won.

And then one more thing blush Is it possible to make the bot text with Bold. Like this text:
Bot: lars wins the cat over jane with paper against rock

Thanks!

Dear // Ludvig!

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
msg %rollchan <- this will send it to the channel.

This part below will add the nick names to the variables.
set %roller1 $2
set %roller2 $3

you need to change the %rollchan to the %roller1 - 2 variable you want to use, and you can try where it fit your needs.

For bold. press CTRL + B befor and after the text you want to be bold.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Feb 2012
Posts: 5
L
Ludvig Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2012
Posts: 5
Thanks for fast answer very nice of you:)

Do you mean i have to change this part;

Php Code:
alias -l applyaction {
  msg %rollchan STATUS $2 : $3 : %roller1 : %roller2 : %roll1 : %roll2
  if ($2 == %roller1) {
	set %roll1 $3 


Is there somehow i can make it to hide the status message about what they choosed. Hide it so the bot only can see it?

There's one more thing that i forgot to mention and the most important thing. After the both status are reported to the bot (both players choosed) it do not go further to the part where it should report who wins and so on. Can you please help me find whats wrong?

Thanks for all ur help Sparta!

// Ludde

Joined: Feb 2012
Posts: 5
L
Ludvig Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2012
Posts: 5
How can i delete this subject?


Link Copied to Clipboard