Advertisement
OrFeAsGr

chatgpt writes mIRC games.

Feb 23rd, 2023
2,191
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.50 KB | None | 1 0
  1. write mIRC code for a rock scissors paper game. Write an alias "choose" that returns rock, scissors or paper using $rand(1,3) to play the respective choice against the player. When a game is triggered set a variable "play" with the value of the"choose" alias and then figure out who won by comparing the players choice to the value that choose returned.
  2.  
  3. Here's the mIRC code for a rock-paper-scissors game using an "alias" named "choose" to randomly select the computer's choice:
  4.  
  5. perl
  6.  
  7. ; Rock-paper-scissors game
  8.  
  9. alias choose {
  10.   var %choice = $rand(1,3)
  11.   if (%choice == 1) {
  12.     return rock
  13.   }
  14.   elseif (%choice == 2) {
  15.     return paper
  16.   }
  17.   else {
  18.     return scissors
  19.   }
  20. }
  21.  
  22. on *:TEXT:!rps*:#: {
  23.   set %play $choose
  24.   msg # You chose $2-
  25.   msg # The computer chose %play
  26.   if ($2 == rock && %play == scissors || $2 == paper && %play == rock || $2 == scissors && %play == paper) {
  27.     msg # You win!
  28.   }
  29.   elseif ($2 == %play) {
  30.     msg # It's a tie!
  31.   }
  32.   else {
  33.     msg # The computer wins!
  34.   }
  35. }
  36.  
  37. To use the game, simply type "!rps rock" (or "paper" or "scissors") in a channel where the bot is present, and it will play a round of rock-paper-scissors against you. The "on TEXT" event triggers whenever someone types "!rps" followed by a choice, and sets the "%play" variable to the computer's random choice using the "choose" alias. The script then compares your choice to the computer's choice to determine the winner and sends a message to the channel indicating the outcome of the game.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement