The following is a set of scripts that I created a while ago for a trivia
bot. I hope it helps. The scripts contain methods for moving the bot and
having it ask and take in answers.
I hope this helps. Feel free to take as much or as little as you need.
BTW, this script was created before you could setalarms on yourself. This
added feature could greatly help with these types of scripts.
Bruce
Surgeon General's Warning from EricD:
This script isn't intended for everybody. I recommend this script only
for knowledgable Iptscrae programmers who know what they are doing. If
you are a beginner and don't know what you are doing, it may
screw up your Cyborg.ipt file.
;------------------------------------------------
; Sample Trivia Script - Cyborg.ipt
ON INCHAT
; all commands to the bot are handled via Inchat - only specific people can
; tell the bot where to go and what to do.
{
counter GLOBAL
counterstate GLOBAL
gamename GLOBAL
gamequest GLOBAL
gameans GLOBAL
gametimer GLOBAL
gamestate GLOBAL
{
{
CHATSTR STRTOATOM EXEC
SETPOS
"" CHATSTR =
} CHATSTR "botgo" SUBSTR IF
{
CHATSTR STRTOATOM EXEC
"" CHATSTR =
GOTOROOM
} CHATSTR "botroom" SUBSTR IF
{
"$1" GREPSUB saystr =
"" CHATSTR =
saystr SAY
SAY
} CHATSTR "botsay (.*)$" GREPSTR IF
{
"$1" GREPSUB gques =
gques gamequest =
"" CHATSTR =
"The current question has been set to:\x0d" gamequest + LOGMSG
} CHATSTR "game q: (.*)$" GREPSTR IF
{
"$1" GREPSUB gans =
gans gameans =
"" CHATSTR =
"The current answer has been set to:\x0d" gameans + LOGMSG
} CHATSTR "game a: (.*)$" GREPSTR IF
{
"$1" GREPSUB gname =
gname gamename =
} CHATSTR "name game (.*)$" GREPSTR IF
{
"on" gamestate =
"" CHATSTR =
")debut !"
gamename ":\x0d" + +
"Next question:\x0d\x0d" + gamequest +
"\x0d\x0dGO!" + ROOMMSG
} CHATSTR "game on" == IF
{
"off" gamestate =
"" CHATSTR =
"!Question is over." ROOMMSG
} CHATSTR "game off" == IF
{
"GAME: " gamename +
"\x0dcQ: " gamequest + +
"\x0dcA: " gameans + +
"\x0dcSt: " gamestate + +
LOGMSG
"" CHATSTR =
} CHATSTR "game stat" == IF
{
"Where was Princess Leia from?" gamequest =
"Alderaan" gameans =
"" CHATSTR =
} CHATSTR "Q1" == IF
{
"What spaceport was the cantina in?" gamequest =
"Mos Eisley" gameans =
"" CHATSTR =
} CHATSTR "Q2" == IF
{
"What creatures did the sandpeople ride?" gamequest =
"Banthas" gameans =
"" CHATSTR =
} CHATSTR "Q3" == IF
{
"What kind of a creature was Chewwie?" gamequest =
"Wookie" gameans =
"" CHATSTR =
} CHATSTR "Q4" == IF
{
"Who caused Darth Vader to go spinning off in the battle of
the Death Star?" gamequest =
"Han Solo" gameans =
"" CHATSTR =
} CHATSTR "Q5" == IF
{
0 counter =
} CHATSTR "reset counter" == IF
{
2728 GOTOROOM
"" CHATSTR =
} CHATSTR "wizstudy" == IF
{
"true" counterstate =
"counter: " counterstate + LOGMSG
} CHATSTR "counter on" == IF
{
"false" counterstate =
2 MACRO
"counter: " counterstate + LOGMSG
} CHATSTR "counter off" == IF
{
"$1" GREPSUB counttemp =
counttemp ATOI counter =
} CHATSTR "set counter (.*)$" GREPSTR IF
} WHOCHAT WHONAME "Bruce" SUBSTR == WHOCHAT ISWIZARD OR IF
{
"The current game is: " gamename + WHOCHAT PRIVATEMSG
} CHATSTR "game name" == IF
{
"Welcome to Palace Trivia - Current Game: " gamename +
"\x0d\x0dThe rules for the game and other information will appear in
your log" +
WHOCHAT PRIVATEMSG
";--- Palace Trivia Rules ---"
"\x0dThe questions will appear in the upper-left of the screen." +
"AFTER the question is given the timer is on and anyone can answer.
But," +
"\x0d\x0d (1) Answers must start with A: (e.g. A: answer)" +
"\x0d (2) Answers must be spelled correctly - sorry" +
WHOCHAT PRIVATEMSG
} CHATSTR "game rules" == IF
{
{ WHOCHAT WHONAME ", the current question is:\x0d\x0d" gamequest + +
WHOCHAT PRIVATEMSG}
{ WHOCHAT WHONAME ", there is no current question." + WHOCHAT PRIVATEMSG}
gamestate "on" == IFELSE
} CHATSTR "?" == IF
{
"$1" GREPSUB ans =
{
{ ")yes !" WHOCHAT WHONAME ", has entered the correct answer: "
gameans + + + ROOMMSG
"off" gamestate = }
{ ")no " ans ", is not the correct answer" + + WHOCHAT PRIVATEMSG }
gameans LOWERCASE ans LOWERCASE == IFELSE }
{ WHOCHAT WHONAME ", there is no current question." + WHOCHAT PRIVATEMSG}
gamestate "on" == IFELSE
} CHATSTR LOWERCASE "a: (.*)$" GREPSTR IF
{
"The current question is: " gamequest ATOI + WHOCHAT PRIVATEMSG
} CHATSTR "question number" == IF
{
counter ++
counter ITOA "Counter: " SWAP + " Counterstate: "
counterstate + + LOGMSG
{
{ 0 counter =
")amen !Counter Is Fliping, Nice Chatting Dudes!" SAY
} counter 999 > IF
counter 10 % ITOA prop1 =
prop1 LOGMSG
{
counter 10 / 10 % 10 * ITOA tens = tens
{ "00" } tens "0" == IF
prop10 =
} { "blank" prop10 = } counter 9 > IFELSE
prop10 LOGMSG
{ counter 100 / 100 * ITOA prop100 = }
{ "blank" prop100 = } counter 99 > IFELSE
prop100 LOGMSG
prop1 "," prop10 "," prop100 + + + + LOGMSG
[ prop1 prop10 prop100 ] SETPROPS
} counterstate "true" == IF
} CHATSTR "cool" SUBSTR IF
}
ON OUTCHAT
{
;use only for puppets
}
ON SIGNON
{
counter GLOBAL
counterstate GLOBAL
gamename GLOBAL
gamequest GLOBAL
gameans GLOBAL
gametimer GLOBAL
gamestate GLOBAL
0 counter =
"false" counterstate =
"No Current Game" gamename =
"No Current Question" gamequest =
"No Current Answer" gameans =
"No Current Time" gametimer =
"off" gamestate =
}
               (
geocities.com/siliconvalley/network/8524)                   (
geocities.com/siliconvalley/network)                   (
geocities.com/siliconvalley)