Play a Audio at Mouseclick in ML

Discuss everything related to custom data creation.

Moderator: NADEO

Post Reply
Flighthigh
Posts: 427
Joined: 29 Jun 2010, 06:48

Play a Audio at Mouseclick in ML

Post by Flighthigh » 26 May 2015, 17:23

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?

User avatar
undef.de
Posts: 1969
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Play a Audio at Mouseclick in ML

Post by undef.de » 26 May 2015, 17:40

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
Last edited by undef.de on 29 May 2015, 21:09, edited 1 time in total.
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.

Flighthigh
Posts: 427
Joined: 29 Jun 2010, 06:48

Re: Play a Audio at Mouseclick in ML

Post by Flighthigh » 26 May 2015, 18:50

Thanks undef :thumbsup:

but its to complicate for me.

User avatar
undef.de
Posts: 1969
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Play a Audio at Mouseclick in ML

Post by undef.de » 26 May 2015, 19:03

That was a full working example (hopefully) for you, just include it into your Manialink and click on it.
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.

Flighthigh
Posts: 427
Joined: 29 Jun 2010, 06:48

Re: Play a Audio at Mouseclick in ML

Post by Flighthigh » 29 May 2015, 06:59

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

Post Reply

Return to “Title Pack & Custom Data Creation”

Who is online

Users browsing this forum: No registered users and 1 guest