Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. property rockTrigger : "!ROCK"
  2. property paperTrigger : "!PAPER"
  3. property scissorsTrigger : "!SCISSORS"
  4.  
  5. property rockAnswerList : {"CookieBot plays Scissors. Rock beats Scissors! You have won!", "CookieBot plays Rock. Rock ties with Rock! It's a draw!", "CookieBot plays Paper. Paper beats Rock! You have lost!"}
  6. property paperAnswerList : {"CookieBot plays Rock. Paper beats Rock! You have won!", "CookieBot plays Paper. Paper ties with Paper! It's a draw!", "CookieBot plays Scissors. Scissors beats Paper! You have lost!"}
  7. property scissorsAnswerList : {"CookieBot plays Paper. Scissors beats Paper! You have won!", "CookieBot plays Scissors. Scissors ties with Scissors! It's a draw!", "CookeBot plays Rock. Rock beats Scissors! You have lost!"}
  8. using terms from application "Colloquy"
  9.    
  10.     on process incoming chat message theMessage from theUser in theView
  11.         set theText to HTML of theMessage as string
  12.        
  13.         if theText is equal to rockTrigger then
  14.             set c to count of rockAnswerList
  15.             set r to random number from 1 to c
  16.             set i to item r of rockAnswerList
  17.             tell theView
  18.                 send message "" & i & ""
  19.             end tell
  20.         end if
  21.        
  22.         if theText is equal to paperTrigger then
  23.             set c to count of paperAnswerList
  24.             set r to random number from 1 to c
  25.             set i to item r of paperAnswerList
  26.             tell theView
  27.                 send message "" & i & ""
  28.             end tell
  29.         end if
  30.        
  31.         if theText is equal to scissorsTrigger then
  32.             set c to count of scissorsAnswerList
  33.             set r to random number from 1 to c
  34.             set i to item r of scissorsAnswerList
  35.             tell theView
  36.                 send message "" & i & ""
  37.             end tell
  38.         end if
  39.     end process incoming chat message
  40. end using terms from
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement