A simple configurable 8ball that I put together. Simple and easy to use.
;Configurable 8ball
;Made by BlueThen on March 23, 2008.
;To install, copy and paste this script into your Remotes (Alt+R)
;To use, type /8ballconfig or right click a channel or status and click 8ball Config.
menu channel,status {
8ball Config: 8ballconfig
}
alias 8ballconfig {
dialog -m 8ball 8ball
}
on *:dialog:8ball:init:*: {
if %8ball.e == 1 state %8ball.e | did -c 8ball 21
if %8ball.e == 0 did -u 8ball 21
if %8ball.c != $null did -ra 8ball 2 %8ball.c
if %8ball.1 != $null did -ra 8ball 3 %8ball.1
if %8ball.2 != $null did -ra 8ball 6 %8ball.2
if %8ball.3 != $null did -ra 8ball 8 %8ball.3
if %8ball.4 != $null did -ra 8ball 10 %8ball.4
if %8ball.5 != $null did -ra 8ball 12 %8ball.5
if %8ball.6 != $null did -ra 8ball 14 %8ball.6
if %8ball.7 != $null did -ra 8ball 16 %8ball.7
if %8ball.8 != $null did -ra 8ball 18 %8ball.8
}
dialog 8ball {
title "8Ball Config"
size -1 -1 252 401
option pixels notheme
text "8Ball Command:", 1, 14 53 100 17
edit "!8ball", 2, 138 51 100 20, disable autohs
edit "Yes.", 3, 138 113 100 20, disable autohs
text "Answer1:", 4, 14 115 100 17
text "Answer2:", 5, 14 146 100 17
edit "No.", 6, 138 144 100 20, disable autohs
text "Answer3:", 7, 14 177 100 17
edit "I'm unsure.", 8, 138 175 100 20, disable autohs
text "Answer4:", 9, 14 208 100 17
edit "Maybe.", 10, 138 206 100 20, disable autohs
text "Answer5:", 11, 14 239 100 17
edit "Definately not.", 12, 138 237 100 20, disable autohs
text "Answer6", 13, 14 270 100 17
edit "Definately.", 14, 138 268 100 20, disable autohs
text "Answer7:", 15, 14 301 100 17
edit "I cannot answer.", 16, 138 299 100 20, disable autohs
text "Answer8:", 17, 14 332 100 17
edit "Who knows?", 18, 138 330 100 20, disable autohs
button "Done", 19, 173 363 65 25, ok
button "Cancel", 20, 14 363 65 25, cancel
check "Enabled", 21, 98 27 56 17
text "8Ball reply:", 22, 14 84 100 17
edit "[8ball] My answer is:", 23, 138 82 100 20, disable autohs
text "Made by:", 24, 14 5 45 14
button "BlueThen", 25, 173 3 65 18
}
on *:dialog:8ball:sclick:25: run http:\\bluethen.com\
on *:dialog:8ball:sclick:19: {
%8ball.e = $did(21).state
%8ball.r = $did(23)
%8ball.c = $did(2)
%8ball.1 = $did(3)
%8ball.2 = $did(6)
%8ball.3 = $did(8)
%8ball.4 = $did(10)
%8ball.5 = $did(12)
%8ball.6 = $did(14)
%8ball.7 = $did(16)
%8ball.8 = $did(18)
}
on *:text:*:#: {
if ($1 == %8ball.c) {
if (%8ball.e == 1) {
%r = $rand(1,8)
if %r == 1 msg $chan %8ball.r %8ball.1
if %r == 2 msg $chan %8ball.r %8ball.2
if %r == 3 msg $chan %8ball.r %8ball.3
if %r == 4 msg $chan %8ball.r %8ball.4
if %r == 5 msg $chan %8ball.r %8ball.5
if %r == 6 msg $chan %8ball.r %8ball.6
if %r == 7 msg $chan %8ball.r %8ball.7
if %r == 8 msg $chan %8ball.r %8ball.8
}
}
}
on *:dialog:8ball:sclick:21: {
state $did(21).state
}
alias state {
if ($1 == 1) {
did -e 8ball 2
did -e 8ball 3
did -e 8ball 6
did -e 8ball 8
did -e 8ball 10
did -e 8ball 12
did -e 8ball 14
did -e 8ball 16
did -e 8ball 18
did -e 8ball 23
}
else {
did -b 8ball 2
did -b 8ball 3
did -b 8ball 6
did -b 8ball 8
did -b 8ball 10
did -b 8ball 12
did -b 8ball 14
did -b 8ball 16
did -b 8ball 18
did -b 8ball 23
}
}
Well, it is a step-up to those many repetitive 8ball scripts out there, so I credit you for the originality, just a few suggestions:
1) In you /state alias, you can easily shorten it using $iif and taking all of those numbers and putting them into one command. Here is an example of what I mean:
alias state did $iif($1 = 1,-e,-b) 8ball 2,3,4,6,8,10,12,14,16,18,23
2) Why not use a listbox and have a user add different answers? You could store all these answers in a text file and use $read.
3) Your script also requires the dialog to be open in the text event, what if a user doesn\'t keep it open? This could also be solved by using my second suggestion.
Good luck, just try finding a way to store answers and shorten your code.
~Tsuiseki