View Full Version : Two small but difficult questions..need help pls
tippadog
02-08-2006, 07:46 AM
Hi All,
I'm new to auto menuing but have managed to create a menu to play music files(ogg format). I have the 20 files set out as in track 1 and so on and have created a play all tracks button. Where I'm getting stuck is that I cannot for the life of me get the single tracks to play just the one selected, instead it seems to play as from that track to the end of the remaining files eg if I select track 7 it plays on from there to track 20. I can of course remove the global script then the single track will play and stop, but thats not what I want I want to do both, play one selected track and stop along with the option to play all tracks.
I have created list boxes from reading up in the help file and downloaded an example from here and understand how they operate but again thats not what I'm after. I want a row of nicely created buttons 1 thru 20 single track play and the 21st button play all. I'm almost there but just need a shove in the right direction.
I would also like to auto scroll my text along the bottom of the menu// not the track title i have done that bit I want normal auto scrolling text.
many thanx for any help offered
rhosk
02-08-2006, 08:14 AM
Without seeing some of your code....no idea. Button 1-20 should be a simple load/play audio action (unless you're not providing all details).
As for the scrolling text, use the On Timer event. There are some examples around the forum :)
TJ_Tigger
02-08-2006, 08:19 AM
You can use Page.CreateObject and Page.SetObjectScript to dynamically create buttons at run time. Shouldn't be that hard of a task just play with the coding, look at some examples and if you run into trouble, ask questions, post code and we will do our best to help.
Tigg
tippadog
02-08-2006, 08:42 AM
Sorry about the failure to add the script.
Here it is
On Global Function
-- keep track of the audio files
audio_count = 1;
--loads desired audio files into a table
audio = {
"Autoplay\\Audio\\chess\\Chess - 101 - Merano.ogg",
"Autoplay\\Audio\\chess\\Chess - 102 - The Russian And Molokov- Where I Want To Be.ogg",
"Autoplay\\Audio\\chess\\Chess - 103 - Opening Ceremony.ogg",
"Autoplay\\Audio\\chess\\Chess - 104 - Quartet (A Model Of Decorum And Tranquility).ogg",
"Autoplay\\Audio\\chess\\Chess - 105 - The American And Florence - Nobody's Side.ogg",
"Autoplay\\Audio\\chess\\Chess - 106 - Chess.ogg",
"Autoplay\\Audio\\chess\\Chess - 107 - Mountain Duet.ogg",
"Autoplay\\Audio\\chess\\Chess - 108 - Florence Quits.ogg",
"Autoplay\\Audio\\chess\\Chess - 109 - Embassy Lament.ogg",
"Autoplay\\Audio\\chess\\Chess - 110 - Anthem.ogg",
"Autoplay\\Audio\\chess\\Chess - 201 - Bangkok - One Night in Bangkok.ogg",
"Autoplay\\Audio\\chess\\Chess - 202 - Heaven Help My Heart.ogg",
"Autoplay\\Audio\\chess\\Chess - 203 - Argument.ogg",
"Autoplay\\Audio\\chess\\Chess - 204 - I Know Him So Well.ogg",
"Autoplay\\Audio\\chess\\Chess - 205 - The Deal No Deal.ogg",
"Autoplay\\Audio\\chess\\Chess - 206 - Pity the Child.ogg",
"Autoplay\\Audio\\chess\\Chess - 207 - Endgame.ogg",
"Autoplay\\Audio\\chess\\Chess - 208 - Epilogue- You and I - The Story of Chess.ogg",
};
This is the on audio script
if e_State == "Finish" then
audio_count = audio_count + 1;
--ensures a valid file will be loaded
if audio_count < Table.Count(audio)+1 then
Audio.Load(CHANNEL_USER1, audio[audio_count], true, false);
end
end
this is the play all button script
Audio.Stop(CHANNEL_ALL);
Audio.Load(CHANNEL_USER1, audio[audio_count], true, false);
This is one of the play track buttons (on click)
Audio.Stop(CHANNEL_ALL);
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\chess\\Chess - 101 - Merano.ogg", true, false);
As you can see from reading the script. the button select will play the track selected but then carry on.. the play all function works fine. it's just the single track select where it falls short of what I'm trying to do
thanks
rhosk
02-08-2006, 08:52 AM
Hmm, maybe a quick variable to check the state.
if (e_State == "Finish") and playAll then
audio_count = audio_count + 1;
--ensures a valid file will be loaded
if audio_count < Table.Count(audio)+1 then
Audio.Load(CHANNEL_USER1, audio[audio_count], true, false);
end
end
Audio.Stop(CHANNEL_ALL);
playAll = true;
Audio.Load(CHANNEL_USER1, audio[audio_count], true, false);
Audio.Stop(CHANNEL_ALL);
playAll = false;
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\chess\\Chess - 101 - Merano.ogg", true, false);
TJ_Tigger
02-08-2006, 09:18 AM
Here is an example on how to create buttons dynamically based on the table of audio file you have. The script will need some tweaking to make it work in your project and to make sure that buttons fit on the page and such. Give it a look, hopefully it will work out.
-- Button object properties table.
tblBtnProps = {};
tblBtnProps.ButtonFile = "AutoPlay\\Buttons\\10_112.btn";
tblBtnProps.Text = "";
tblBtnProps.FontName = "Verdana";
tblBtnProps.FontSize = 15;
tblBtnProps.FontWeight = FW_BOLD;
tblBtnProps.FontItalic = false;
tblBtnProps.FontStrikeout = false;
tblBtnProps.FontScript = ANSI_CHARSET;
tblBtnProps.FontAntiAlias = true;
tblBtnProps.FontUnderline = false;
tblBtnProps.XOffset = 0;
tblBtnProps.YOffset = 0;
tblBtnProps.Style = BTNSTYLE_STANDARD;
tblBtnProps.ToggleState = BTN_TOGGLE_UP;
tblBtnProps.Cursor = CURSOR_HAND;
tblBtnProps.TooltipText = "";
tblBtnProps.Y = 0;
tblBtnProps.X = 0;
tblBtnProps.Height = 25;
tblBtnProps.Width = 60;
tblBtnProps.Enabled = true;
tblBtnProps.Visible = true;
tblBtnProps.HighlightSound = SND_STANDARD;
tblBtnProps.HighlightSoundFile = "";
tblBtnProps.ClickSound = SND_STANDARD;
tblBtnProps.ClickSoundFile = "";
tblBtnProps.ColorNormal = Math.HexColorToNumber("FFFFFF");
tblBtnProps.ColorHighlight = Math.HexColorToNumber("FFFFFF");
tblBtnProps.ColorDown = Math.HexColorToNumber("FFFFFF");
tblBtnProps.ColorDisabled = Math.HexColorToNumber("FFFFFF");
tblBtnProps.Alignment = ALIGN_CENTER;
nX = 20 -- starting horizontal position
nY = 20 -- starting vertical Position
for i,v in audio do
-- split the path of the audio to get the file name for the button
tbPath = String.SplitPath(audio[i]);
--set properties for text and page position of the button
tblBtnProps.Text = tbPath.Filename;
tblBtnProps.X = nX
tblBtnProps.Y = nY
--increment the vertical position of the button
nY = nY + tblBtnProps.Height + 5;
--create the button
Page.CreateObject(OBJECT_BUTTON, "AC_BTN_"..i, tblBtnProps);
strScript = "Audio.Load(CHANNEL_NARRATION, v, true, false);"
Page.SetObjectScript("AC_BTN_"..i, "On Click", strScript)
end
--create the play all button
tblBtnProps.Text = "Play All";
tblBtnProps.X = nX
tblBtnProps.Y = nY
Page.CreateObject(OBJECT_BUTTON, "AC_BTN_All", tblBtnProps);
Page.SetObjectScript("AC_BTN_"..i, "On Click", "Play all script goes here")
tippadog
02-09-2006, 02:26 AM
thanx for the help guys, I can now scroll text to my hearts content lol.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.