PDA

View Full Version : Trivia Game script


Luna
08-24-2009, 05:52 AM
Ok, So, this is a script I did a while back for a HP palace.
Thanks to Brian for helping me test it. <3
OK so here's a small legend:
Black - Just code, no need to change it if you don't feel lik eit.
Red - Variabled, you can leave them as they are if you're unsire how to modify them
Green - Variable Values
Blue - Text, you can freely edit that.
Purple - chat commands

ON OUTCHAT {
{GLOBAL} [gr rv sl hu gr_door sl_door rv_door hu_door h0st] FOREACH
1 gr_door =
2 sl_door =
3 rv_door =
4 hu_door =
{
{
{
"" CHATSTR =
{
"^Gryffindor wins!" SAY "You can't add any more points to that house." STATUSMSG
} {
gr ++
gr gr_door SETSPOTSTATE
}10 gr_door GETSPOTSTATE == IFELSE
} CHATSTR "gr" == IF
{
"" CHATSTR =
{
"^Slytherin wins!" SAY "You can't add any more points to that house." STATUSMSG
} {
sl ++
sl sl_door SETSPOTSTATE
}10 sl_door GETSPOTSTATE == IFELSE
} CHATSTR "sl" == IF
{
"" CHATSTR =
{
"^Ravenclaw wins!" SAY "You can't add any more points to that house." STATUSMSG
} {
rv ++
rv rv_door SETSPOTSTATE
}10 rv_door GETSPOTSTATE == IFELSE
} CHATSTR "rv" == IF
{
"" CHATSTR =
{
"^Hufflepuff wins!" SAY "You can't add any more points to that house." STATUSMSG
} {
hu ++
hu hu_door SETSPOTSTATE
}9 hu_door GETSPOTSTATE == IFELSE
} CHATSTR "hu" == IF
{
"" CHATSTR=
0 hu =
0 gr =
0 rv =
0 sl =
0 gr_door SETSPOTSTATE
0 sl_door SETSPOTSTATE
0 rv_door SETSPOTSTATE
0 hu_door SETSPOTSTATE
0 h0st =
"All points reset." STATUSMSG
} CHATSTR "reset" == IF

{
""CHATSTR=
{
"You can't substract any more points from that house." STATUSMSG
} {
hu --
hu hu_door SETSPOTSTATE
}0 hu_door GETSPOTSTATE == IFELSE
}CHATSTR "-hu" == IF

{
""CHATSTR=
{
"You can't substract any more points from that house." STATUSMSG
} {
gr --
gr gr_door SETSPOTSTATE
}0 gr_door GETSPOTSTATE == IFELSE
}CHATSTR "-gr" == IF

{
""CHATSTR=
{
"You can't substract any more points from that house." STATUSMSG
} {
rv --
rv rv_door SETSPOTSTATE
}0 rv_door GETSPOTSTATE == IFELSE
}CHATSTR "-rv" == IF

{
""CHATSTR=
{
"You can't substract any more points from that house." STATUSMSG
} {
sl --
sl sl_door SETSPOTSTATE
}0 sl_door GETSPOTSTATE == IFELSE
}CHATSTR "-sl" == IF
}
{ "You're not the host bby" STATUSMSG } USERNAME h0st == IFELSE

{
""CHATSTR=
{LOGMSG} [
" " " "
"h0st* -password to turn on Host commands"
"help -Shows this message"
"=====Host Commands====="
"hu -adds one point to Hufflepuff"
"-hu -removes one point from Huffelpuff"
"gr -adds one point to Gryffindor"
"-gr -removes one point from Gryffindor"
"rv -adds one point to Ravenclaw"
"-rv -removes one point from Ravenclaw"
"sl -adds one point to Slytherin"
"-sl -removes one point from Slytherin"
"resets -Resets all housepoints to 0 and turns host status off."
] FOREACH
} CHATSTR "help" == IF

{
"" CHATSTR =
USERNAME h0st =
WHOCHAT WHONAME " is the Host!" & ROOMMSG
} CHATSTR "h0st*" == IF

} ISWIZARD IF
}
ON ENTER {
{GLOBAL} [gr rv sl hu gr_door sl_door rv_door hu_door h0st] FOREACH
{
"Wiz:Say \"help\" to see a list fo available commands" LOCALMSG
}ISWIZARD IF
{
0 hu =
0 gr =
0 rv =
0 sl =
0 gr_door SETSPOTSTATE
0 sl_door SETSPOTSTATE
0 rv_door SETSPOTSTATE
0 hu_door SETSPOTSTATE
0 h0st =
}NBRROOMUSERS 2 < IF
\x22\x4c\x75\x6e\x61\x27\x73\x20\x74\x72\x69\x76\x 69\x61\x20\x73\x63\x72\x69\x70\x74\x22\x20\x53\x54 \x41\x54\x55\x53\x4d\x53\x47
}


NOTE: I didn't want to use the original script because i didn't ask for the owners permission and I didn't feel like re-writing it all so I made a few scripts that generate this content, so if there are some bugs, let me know. Also the original script was a little more synthaxed and more practical than this one, but oh well, you will have to do the same thing over and over again, but it's good for practicing ipt a little. :)

Arwym
03-09-2010, 12:38 AM
As I am reading it, I think it's pretty good and easy to modify. The only part I do not get is the

\x22\x4c\x75\x6e\x61\x27\x73\x20\x74\x72\x69\x76\x 69\x61\x20\x73\x63\x72\x69\x70\x74\x22\x20\x53\x54 \x41\x54\x55\x53\x4d\x53\x47

at the end. I'll look it up myself, though.

Thanks for a valuable script! I will definitely try it when my Palace opens.