This was a game that I tried to make when I was 12. I never really fully realized my thoughts and dreams with it because I did not retain the motivation; also, most of the characters were ripped from preexisting pop culture works (something I didn't realize was wrong until my dad said, "you won't be able to make any money that way!") Nonetheless, I have gotten around to messing with this platform again and I spliced/wrote/slammed together some working VBScript for randomizing a song that would play in a starting screen.
First, this must be in the VBScript Global Procedures.
- Code: Select all
Function RandomInt(lower,upper)
Randomize
RandomInt = int(rnd*(upper-lower+1))+lower
End Function 'RandomInt
Sub PlaySoundWin7(SoundFile, NumRepeat, ChannelNumber)
If ChannelNumber < 9 Then
'With VBScript it is currently not possible to interact with the 8 first audio channels.
MsgBox "The specified audio channel is invalid.", vbCritical, "Error"
Exit Sub
End If
If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
MsgBox "Unable to find the media player component.", vbCritical, "Error"
Else
If Action.DoesComponentExist("MediaPlayer" + CStr(ChannelNumber)) = false Then
AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer" + CStr(ChannelNumber)
End If
Component("MediaPlayer" + CStr(ChannelNumber)).Object.FileName = SoundFile
Component("MediaPlayer" + CStr(ChannelNumber)).Object.PlayCount = NumRepeat
Component("MediaPlayer" + CStr(ChannelNumber)).Object.Play
End If
End Sub
Secondly, there must be some VB Variables named rndnum and rnd_play. Both are integers.
Finally, here is what goes in the Frame itself for your project.
- Code: Select all
randomize
rnd_play = int( RND * 4 ) + 1
If rnd_play = 1 Then
PlaySoundWin7 GetPath(4) + "GMOD GMOD 1.mp3", 0, 9
End If
If rnd_play = 2 Then
PlaySoundWin7 GetPath(4) + "GMOD GMOD 2.mp3", 0, 9
End If
If rnd_play = 3 Then
PlaySoundWin7 GetPath(4) + "GMOD GMOD 3.mp3", 0, 9
End If
If rnd_play = 4 Then
PlaySoundWin7 GetPath(4) + "GMOD GMOD 4.mp3", 0, 9
End If
The file names that begin with "GMOD GMOD" change depending on the name of your sound files that you want to roll the dice on. This is helpful for making a starting screen where you want the music to be randomly played/selected. Or any screen, it doesn't necessarily have to be a STARTING screen.
I never really finished a game with this platform; I made a game with Scratch from MIT as part of a school assignment, but AM would have given me more freedom, if I could have used it.
I made this thread because I am reminiscing, and the platform seems, unfortunately, dead. Back in 2010 or 2012 maybe, I was really young, and I tried to make a game here. It was really bad, and in the forum thread, I got some constructive criticism, to which I overreacted and the thread ended up being deleted, lol. But this is a message to say thank you because I am going to college for Comp Sci where I hope I can further the passion that started here, for coding and programming and making beautiful projects.
Regards
J.P./Morsy