#N88BASIC
#include <api_mmsys.sbp>

Dim kuji[4] = ["大吉","基地","凶","大凶"] As *Byte
Dim
Dim I$ As String
Dim c As DWord

Randomize
Print "お み く じ"
Print "今日の運勢は……"
BGM("C:\Windows\media\onestop.mid")'占い結果によって曲が変わって楽しい
c = Int(Rnd()*4)
Color 6-c
Sleep(1500)
Print MakeStr(kuji[c])
Color 7,0
Sleep(3000)
Input "リターンキーを押してください", I$
BGM(NULL)
End

Dim mop As MCI_OPEN_PARMS
Sub BGM(bgmfile As *Byte)
If bgmfile <> NULL Then
mop.lpstrElementName = bgmfile
mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, mop)
If mop.wDeviceID Then mciSendCommand(mop.wDeviceID, MCI_PLAY, 0, ByVal 0)
Else
If mop.wDeviceID Then mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, ByVal 0)
mop.wDeviceID = 0
End If
End Sub