I got this idea from a guessing game. I thought it would be cool to have a "secret" word type game. This is set up so you can message your bot and set the secret word. And if anyone says the secret word in any form, sentence, paragraph, it'll alert the user who said the word. It also unsets the secret word variable so each word can't be said twice.
How to use:
1. Save the code as S-word.mrc.
2. In your bot, type /load -rs S-word.mrc. It'll ask you if you want to run initialization commands, click yes. The script will automatically write a "prizes.txt" file with several prizes in it. You can add more later. After it's loaded, click the commands menu, and open the dialog to set the owner and add prizes.
3. Message your bot with "set s-word (word you want)" without quotes, or type /msg yourbot'sname set s-word (word you want). The bot will confirm the secret word is set to the word you want. Now all you have to do is wait for someone to say the word.
4. To add prizes just type !Prize add (your prize). It can be more than one word, like "Root Beer" or anything of the like. The bot will confirm the prize added to the prize bank.
(((((UPDATES:
As of January 2012, I have added some new stuff to this script. I've added in coding that will query the person who said the secret word and says something like "Send Maxwell a PM with another word to set as the secret word. Since you said the secret word, you get to choose the next one. But don't try saying the secret word once it's set, or you'll get a five minute ban. Let someone else get it. =)." This was my brother's idea, so I have to credit him for it.
Also I have set it so the person cannot say the secret word again once they suggest a new one. It administers a five minute ban for trying to win another prize. This was my idea to keep the "game" fair. It will reset the secret word so you can set it again.
I also have added a dialog that allows you to set the owner, secret word, and edit prizes directly from the dialog. I also left it so you can set the secret word remotely by sending a query to the bot as it was in the first version, as well as adding prizes remotely too. That way other ops can add prizes without having to be at the computer running the script.)))))
Examples:
Setting the secret word in query:
Maxwell: set s-word taco
[Game|Bot]: Secret word is now set as taco.
Winning:
~Maxwell : Man, I want a soft taco.
[Game|Bot]: Hey, Maxwell, you just said the secret word (taco), you get a prize!
! @[Game|Bot] hands Maxwell a Cheerwine
"Winning" again:
~Maxwell: This is crazy.
:: modes set(#GeekUnderground): +b Maxwell by [Game|Bot]
[Game|Bot]: Hey, Maxwell, you get a five minute ban for trying to win another prize. Cheaters never win. The secret word has been reset as well.
Dialog:
If anyone has any suggestions for this, let me know. I'm always up for adding stuff to any of my scripts.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
; Secret Word v2 ;
; By: Max Evans ;
; irc.geekshed.net ;
; #GeekUnderground & #Chris ;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
dialog s-word {
title "Secret Word Setup"
size -1 -1 168 124
option dbu
box "Prize Bank", 1, 5 4 86 98
box "Bot Owner", 2, 95 4 69 50
box "Secret Word", 3, 95 58 69 44
edit %sw-owner, 4, 104 20 50 10, center
button "Set", 5, 103 37 23 9
button "Reset", 6, 131 37 23 9
button "Reset", 7, 132 86 23 9
button "Set", 8, 104 86 23 9
edit %s-word, 9, 105 69 50 10, center
list 10, 8 12 80 65, size
button "Close", 11, 76 110 23 9, ok
button "Add", 13, 22 85 23 9
button "Delete", 15, 50 85 23 9
}
on 1:dialog:s-word:init:0:{
$iif($isfile(prizes.txt),loadbuf -o s-word 10 prizes.txt)
did $iif(%sw-owner,-m,-n) $dname 4
did $iif(%s-word,-m,-n) $dname 9
}
on *:dialog:s-word:sclick:*: {
if ($did == 13) { write prizes.txt $?="Add New Prize To Prize Bank") | did -r s-word 10 | loadbuf -o s-word 10 prizes.txt }
if ($did == 15) { write -dl $+ $did(10).sel prizes.txt | did -r s-word 10 | loadbuf -o s-word 10 prizes.txt }
if ($did == 5) { %sw-owner = $did(4) | did -m s-word 4 }
if ($did == 6) { unset %sw-owner | did -n s-word 4 | did -r s-word 4 }
if ($did == 8) { %s-word = $did(9) | did -m s-word 9 }
if ($did == 7) { unset %s-word | did -n s-word 9 | did -r s-word 9 }
}
on *:load: { var %p = Cheerwine|Twix|Pepsi|Dr. Pepper|7 Up|Hershey's Chocolate Bar | tokenize 124 %p | write prizes.txt $* }
on *:TEXT:!prize add *:#: {
if ($nick isop $chan) {
write prizes.txt $3-
.notice $nick Prize ( $+ $3- $+ ) has been added to the prize bank.
}
else {
.notice $nick Sorry, you must be an op in $chan to add prizes.
}
}
on *:TEXT:set s-word *:?: {
if ($nick == %sw-owner) {
set %s-word $3
.msg $nick Secret word is now set as %s-word $+ .
}
else {
.msg $nick Sorry, only %sw-owner can set the secret word.
}
}
on *:TEXT:*:#:{
if %s-word isin $1- {
if ($nick == %lastnick) {
ban -u300 $chan %lastnick
.msg $chan Hey, %lastnick $+ , you get a five minute ban for trying to win another prize. Cheaters never win. The secret word has been reset as well.
unset %lastnick
unset %s-word
}
else {
unset %lastnick
set %lastnick $nick
.msg $chan Hey, $nick $+ , you just said the secret word ( $+ %s-word $+ ), you get a prize!
.describe $chan hands $nick a(n) $read(prizes.txt)
unset %s-word
.msg %lastnick Send %sw-owner a PM with another word to set as the secret word. Since you said the secret word, you get to choose the next one. But don't try saying the secret word once it's set, or you'll get a five minute ban. Let someone else get it. =)
}
}
}
menu * {
.Secret Word set up: { secret }
}
alias secret { dialog -m s-word s-word }