RosettaCodeData/Task/Magic-8-ball/Craft-Basic/magic-8-ball.basic

165 lines
1.5 KiB
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
title "Magic 8 Ball"
resize 0, 0, 340, 150
center
bgcolor 0, 0, 255
cls graphics
formid 1
formtext "Think of a question and select the magic button."
staticform 10, 10, 310, 20
bgcolor 0, 0, 0
fgcolor 255, 0, 255
colorform
formid 2
formtext "Magic Button"
buttonform 115, 50, 100, 20
bgcolor 255, 0, 0
fgcolor 0, 0, 255
colorform
do
if forms = 2 then
gosub magicbutton
endif
button k, 27
wait
loop k = 0
end
sub magicbutton
let r = int(rnd * 20) + 1
if r = 1 then
alert "It is certain."
endif
if r = 2 then
alert "It is decidedly so."
endif
if r = 3 then
alert "Without a doubt."
endif
if r = 4 then
alert "Yes definitely."
endif
if r = 5 then
alert "You may rely on it."
endif
if r = 6 then
alert "As I see it", comma, " yes."
endif
if r = 7 then
alert "Most likely."
endif
if r = 8 then
alert "Outlook good."
endif
if r = 9 then
alert "Yes."
endif
if r = 10 then
alert "Signs point to yes."
endif
if r = 11 then
alert "Reply hazy", comma, " try again."
endif
if r = 12 then
alert "Ask again later."
endif
if r = 13 then
alert "Better not tell you now."
endif
if r = 14 then
alert "Cannot predict now."
endif
if r = 15 then
alert "Concentrate and ask again."
endif
if r = 16 then
alert "Don't count on it."
endif
if r = 17 then
alert "My reply is no."
endif
if r = 18 then
alert "My sources say no."
endif
if r = 19 then
alert "Outlook not so good."
endif
if r = 20 then
alert "Very doubtful."
endif
return