this is a great 8ball script. i hope you all enjoy it. this is a simple script and i want to keep it that way -_- just copy and paste into your remotes. and right click and click Magic 8-Ball.
dialog M-8-BALL {
Title "Magic 8-Ballz"
size -1 -1 160 35
option dbu
button "Ask Question!",1, 1 1 40 15
text "", 2, 1 20 158 9, center
text "Question", 3, 43 3 23 10
edit "", 4, 65 3 90 10
}
on *:DIALOG:M-8-BALL:Close:0:{ .timer.8.ball* off }
on *:DIALOG:M-8-BALL:sclick:1:{
if (!$did(4).text) { noop $input(No Question Was Entered,udho,!Error!) }
else {
did -r $dname 2,4
.timer.8.ball1 1 1 did -a $dname 2 shaking.
.timer.8.ball2 1 2 did -ra $dname 2 shaking..
.timer.8.ball3 1 3 did -ra $dname 2 shaking...
.timer.8.ball4 1 5 did -ra $dname 2 and the answer is....
var %R = ask one more time|definitely|no|i'm not going to answer that :)|NEVER!!!|i don't know|maybe|yes
.timer.8.ball5 1 7 did -ra $dname 2 $gettok(%R,$r(1,8),124)
}
}
alias m { dialog $iif($dialog(M-8-BALL),-v,-md) M-8-BALL M-8-BALL }
menu status,channel {
Magic 8-Ball:/m
}
to start with i would silence the timer's, and also make a close event so you can shut the timer's off incase you closed out while the timers are going.
try adding a error check if $did(4).text has somthing init or not when you click the button.
you can also use tokens to cut down on the answers timers.
maybe you should also think of centering the timed text you have going to the dialog.
also try useing $dname instead of the dialog name.
but all in all you are getting better at dialogs so keep at it...
any time you want help you can swing by the server im on. the addy is on my profile.
maybe something like...
dialog M-8-BALL {
Title "Magic 8-Ballz"
size -1 -1 160 35
option dbu
button "Ask Question!",1, 1 1 40 15
text "", 2, 1 20 158 9, center
text "Question", 3, 43 3 23 10
edit "", 4, 65 3 90 10
}
on *:DIALOG:M-8-BALL:Close:0:{ .timer.8.ball* off }
on *:DIALOG:M-8-BALL:sclick:1:{
if (!$did(4).text) { noop $input(No Question Was Entered,udho,!Error!) }
else {
did -r $dname 2,4
.timer.8.ball1 1 1 did -a $dname 2 shaking.
.timer.8.ball2 1 2 did -ra $dname 2 shaking..
.timer.8.ball3 1 3 did -ra $dname 2 shaking...
.timer.8.ball4 1 5 did -ra $dname 2 and the answer is....
var %R = ask one more time|definitely|no|i'm not going to answer that :)|NEVER!!!|i don't know|maybe|yes
.timer.8.ball5 1 7 did -ra $dname 2 $gettok(%R,$r(1,8),124)
}
}
alias m { dialog $iif($dialog(M-8-BALL),-v,-md) M-8-BALL M-8-BALL }
menu status,channel {
Magic 8-Ball:/m
}
Going to change some parts...
dialog M-8-BALL {
Title "Magic 8-Ball"
size -1 -1 160 35
option dbu
button "Ask a question!",1, 1 1 40 15
text "", 2, 20 20 145 30
text "Question", 3, 43 3 23 10
edit "", 4, 65 3 90 10
}
on *:DIALOG:M-8-BALL:sclick:1:{
did -ra M-8-BALL 4
.timer 1 1 /did -ra M-8-BALL 2 Shaking.
.timer 1 2 /did -ra M-8-BALL 2 Shaking..
.timer 1 3 /did -ra M-8-BALL 2 Shaking...
.timer 1 5 /did -ra M-8-BALL 2 and the answer is....
var %R $rand(1,8)
.timer 1 7 if (%R == 1) /did -ra M-8-BALL 2 Ask one more time...
.timer 1 7 if (%R == 2) /did -ra M-8-BALL 2 Definitely
.timer 1 7 if (%R == 3) /did -ra M-8-BALL 2 NO
.timer 1 7 if (%R == 4) /did -ra M-8-BALL 2 I am not going to answer that :)
.timer 1 7 if (%R == 5) /did -ra M-8-BALL 2 NEVER!!!
.timer 1 7 if (%R == 6) /did -ra M-8-BALL 2 I don't know
.timer 1 7 if (%R == 7) /did -ra M-8-BALL 2 Maybe
.timer 1 7 if (%R == 8) /did -ra M-8-BALL 2 YES
}
alias m {
dialog -m M-8-BALL M-8-BALL
}
menu status,channel {
Magic 8-Ball:/m
}
The script works but,
You don't need all those /'s...
You can silence timers replacing the /'s with .'s...
You can use a local variable, instead of setting and unsetting...
Try to spell 'definitely' correctly...
Why don't you add a few more buttons, like a clear button?