Music player
|
|
Calydor Foley
Registered User
Join date: 15 Mar 2006
Posts: 6
|
05-02-2006 14:12
I am currently using Archanox's Free Music Script to playback a piano piece on, wow, a piano. The originality is baffling.
Anyway, the script as it is does not quite fit my needs; I'd like to be able to play one of a selection of files by choice.
I'm imagining it like this: Touch the piano, blue popup with a list of the available songs, click one of those and it runs the script with the firstsongname variable set to that.
However, I be but a humble n00bz0r, and I have absolutely no frickin' idea how to accomplish that. llDialog, I wager. And something to listen for it. And a bunch of other stuff I have no idea I need.
Can anyone point me in the right direction? Maybe an existing script that can do what I want? Or maybe someone who's willing to write it for a price?
|
|
Dean Knight
Registered User
Join date: 13 Apr 2006
Posts: 13
|
05-02-2006 14:20
there is a script inworld that does exactly what you are asking. visit the Vind Vindaloo store and there is a piano in there, maybe you can find who wrote the script and ask them about it.
|
|
Charles Granville
Registered User
Join date: 18 Mar 2006
Posts: 33
|
05-02-2006 14:26
Try this: under touch_start(): llDialog(llDetectedKey(0),"Play which song?",["song 1","song 2","song 3","song 4"],-2011); under state_entry(): llListen(-2011,"","",""  ; paste this before the final bracket: listen(integer channel, string name, key id, string message) { if (message == "song 1") firstsongname = "Song name"; if (message == "song 2") firstsongname = "Song name"; if (message == "song 3") firstsongname = "Song name"; if (message == "song 4") firstsongname = "Song name"; }
So, your script would look like: //any code already here default { state_entry() { //any code already here llListen(-2011,"","",""); } touch_start(integer num) { llDialog(llDetectedKey(0),"Play which song?",["song 1","song 2","song 3","song 4"],-2011); }
//any code already here
listen(integer channel, string name, key id, string message) { if (message == "song 1") firstsongname = "Song name"; if (message == "song 2") firstsongname = "Song name"; if (message == "song 3") firstsongname = "Song name"; if (message == "song 4") firstsongname = "Song name"; } }
|
|
Laharl Fassbinder
Registered User
Join date: 12 Oct 2004
Posts: 68
|
05-02-2006 15:26
From: Charles Granville Try this: under touch_start(): llDialog(llDetectedKey(0),"Play which song?",["song 1","song 2","song 3","song 4"],-2011); under state_entry(): llListen(-2011,"","",""  ; paste this before the final bracket: listen(integer channel, string name, key id, string message) { if (message == "song 1") firstsongname = "Song name"; if (message == "song 2") firstsongname = "Song name"; if (message == "song 3") firstsongname = "Song name"; if (message == "song 4") firstsongname = "Song name"; }
So, your script would look like: //any code already here default { state_entry() { //any code already here llListen(-2011,"","",""); } touch_start(integer num) { llDialog(llDetectedKey(0),"Play which song?",["song 1","song 2","song 3","song 4"],-2011); }
//any code already here
listen(integer channel, string name, key id, string message) { if (message == "song 1") firstsongname = "Song name"; if (message == "song 2") firstsongname = "Song name"; if (message == "song 3") firstsongname = "Song name"; if (message == "song 4") firstsongname = "Song name"; } }
negative listen channels? does that work?
|
|
Gigs Taggart
The Invisible Hand
Join date: 12 Feb 2006
Posts: 406
|
05-02-2006 18:40
Yes, of course, negative channels are set aside for script use. Really it's best not to use positive ones.
|
|
Charles Granville
Registered User
Join date: 18 Mar 2006
Posts: 33
|
05-02-2006 19:26
Yeah, I put that in place so bystanders can't mess with it.
|
|
Calydor Foley
Registered User
Join date: 15 Mar 2006
Posts: 6
|
05-02-2006 23:03
Well, I tried writing the script by the instructions, and I keep getting told that firstsongname (in listen()) isn't ... defined within scope, I believe the error said.
Then I went hunting for the existing concert piano and found it, but it's no-mod and selling for a lot of money, so I doubt the owner would be willing to part with the script. It's worth a shot, though.
|
|
Calydor Foley
Registered User
Join date: 15 Mar 2006
Posts: 6
|
05-02-2006 23:25
IM'ed him, he pretty much disconnected without giving an answer, so hm. I'm assuming it was a crash.
If he's not willing to sell, I may look at hiring you, Charles, if you're interested. What would you charge for something like this?
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
05-02-2006 23:26
From: Calydor Foley Well, I tried writing the script by the instructions, and I keep getting told that firstsongname (in listen()) isn't ... defined within scope, I believe the error said.
Then I went hunting for the existing concert piano and found it, but it's no-mod and selling for a lot of money, so I doubt the owner would be willing to part with the script. It's worth a shot, though. Up at the top of the script declare the variable with this line: string firstsongname; That should fix you up.
|
|
Calydor Foley
Registered User
Join date: 15 Mar 2006
Posts: 6
|
05-03-2006 01:04
Okay, we're starting to get there. Looking at the script debug window, apparently the info provided by the dialog button is not going into the firstsongname variable like it should:
Piano: Couldn't find sound 01 Piano: Couldn't find sound 02
etc.
Working on it at the moment.
|
|
Calydor Foley
Registered User
Join date: 15 Mar 2006
Posts: 6
|
05-03-2006 01:12
Problem solved. Negative channels DO NOT work, at least not for me. Channel -11, can't find sound 01. Channel 11, the piano plays.
Thank you very much for all your help, it's nice to have someone to ask who doesn't just go "OMG n00b u suxx0rz!!!!1!11eleven"
|
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
05-03-2006 01:22
negitive channels work in LSL, just that the only way a user may chat on them is via dialog boxs.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|