Page 1 of 1

Play a Audio at Mouseclick in ML

Posted: 26 May 2015, 17:23
by Flighthigh
Hi all

This row in my Manialink work.

Code: Select all

<audio posn="-25 34 0" sizen="10 10" looping="0" music="1" data="http://myWebSpace.com/Folder/bong.ogg" play="1" ScriptEvents="1"/>

But it has the Playbutton. Is it possible that i can change this ugly Button with an own Screen?

Re: Play a Audio at Mouseclick in ML

Posted: 26 May 2015, 17:40
by undef.de
EDIT: Fully working example, followed code is broken.

Example

Code: Select all

<quad posn="-25 34 0" sizen="10 10" bgcolor="0099FF88" id="ButtonBong" ScriptEvents="1"/>
<script><!--
declare SoundBong = CreateSound("http://myWebSpace.com/Folder/bong.ogg", 1.0, False, False, False);

SoundBong.Volume = 0.3;
main {
	while (True) {
		yield;
		if (!PageIsVisible || InputPlayer == Null) {
			continue;
		}

		// Check for MouseEvents
		foreach (Event in PendingEvents) {
			switch (Event.Type) {
				case CMlEvent::Type::MouseClick : {
					if (Event.ControlId == "ButtonBong") {
						SoundBong.Play();
					}
				}
			}
		}
	}
}

//--></script>
http://www.uaseco.org/Maniascript/2015- ... 3597fd42a2

Re: Play a Audio at Mouseclick in ML

Posted: 26 May 2015, 18:50
by Flighthigh
Thanks undef :thumbsup:

but its to complicate for me.

Re: Play a Audio at Mouseclick in ML

Posted: 26 May 2015, 19:03
by undef.de
That was a full working example (hopefully) for you, just include it into your Manialink and click on it.

Re: Play a Audio at Mouseclick in ML

Posted: 29 May 2015, 06:59
by Flighthigh
Thanks to undef

After some PMs and a Teamviewersession it works :thumbsup:

Code: Select all

<quad posn="-30 -34 2" sizen="28 28" image="http://yourWEB.com/folder/screen1.png" imagefocus="http://yourWEB.com/folder/screen2.png" id="Texas" ScriptEvents="1"/>

<script><!--
main() {
	declare SoundBong = Audio.CreateSound("http://yourWEB.com/folder/sound.ogg", 1.0, False, False, False);

	SoundBong.Volume = 1.0;

	while (True) {
		// Check for MouseEvents
		foreach (Event in PendingEvents) {
			switch (Event.Type) {
				case CMlEvent::Type::MouseClick : {
					if (Event.ControlId == "Texas") {
						SoundBong.Play();
					}
				}
			}
		}
		yield;
	}
}
--></script>
Have fun