KINGx - Das inoffizielle PlayStation Forum & News Portal

Normale Version: psp lua pge problem
Sie sehen gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.

daniel133

Hi Leute
ich hab mir mal das Packet vlf von LXD heruntergeladen
ich wollte den Mp3 player, der in dem VLF Tutorial beschrieben wurde ,zum Laufen bringen doch immer kommt ein fehler und er startet nicht

Hir mal der Code

require("VLF")
VLF.init()
VLF.GetBG(28,"theme.vlf",true)
function Fade_Control()
old_Next_task = old_Next_task or 0
Next_task = Next_task or 0
if Fade_mode == 1 then
if Fade_finished then
current_task = Next_task
Fade_mode = 2
SET_HIGHLIGHT_BUTTON = 1
VLF_DISABLE_FOCUS_ANIMATION = true
end
elseif Fade_mode == 2 then
if Fade_finished then
VLF_DISABLE_FOCUS_ANIMATION = false
end
end
if old_Next_task ~= Next_task then
Fade_mode = 1
end
old_Next_task = Next_task
end
current_task = 1
current_mp3 = 1 --die aktuelle mp3
mp3 = {} --der table in dem alle mp3 pfade abgespeichert werden
--menu tables
main = {"load MP3","Player","Exit"}
player = {"Pause/Play","Stop","forward","back"}
while pge.running() do
Fade_Control()
pge.controls.update()
pge.gfx.startdrawing()
pge.gfx.clearscreen()
VLF.DrawFrame()
VLF.DrawTitleBar("VLF MP3 Player",1,TOP.EGG,pge.gfx.createcolor(0,0,0,0))
if current_task == 1 then --MAIN MENU
--to show "X Enter" with VLF.DrawOptions() we'll set options (take a look at line 915) = 1
options = 1
selected_item = VLF.DrawCentralMenu(main,VLF_USE_BUTTONS,VLF.Font, 1) --shows the mainmenu and stores the selectem item in
selected_item
--to check which option has been chosen in the menu we're gonna use this if block
if selected_item == 1 then --item 1 "choose MP3" has been chosen
--to switch to the MP3 menu we set Next_task = 3 (take a look at the task allocation at line 988)
Next_task = 3
elseif selected_item == 2 then --item 2 (player menu) has been chosen
--to switch to the player menu we set Next_task = 2
--but before we have to check if there are mp3 files available in order to play them
if #mp3 ~= 0 then --checks if mp3s have been loaded // if none have been loaded the MP3 task will be called (due to the mp3 files are
loaded within the MP3 task)
Next_task = 2
else
Next_task = 3
end
elseif selected_item == 3 then --exit has been chosen
--here we also have to change Next_task
Next_task = 4
end
elseif current_task == 2 then --PLAYER MENU
--to show "X Enter" and "O Back" with VLF.DrawOptions() we have to set options (take a look at line 915) = 3
options = 3
--to return to the main menu by pressing O we're gonna add the following codeblock
if pge.controls.pressed(PGE_CTRL_CIRCLE) then --checks if O is pressed
Next_task = 1 --changes the current task to 1 (main menu)
pge.wav.play(SND_CURSOR) --the button sound will be played
end
selected_item = VLF.DrawCentralMenu(player,VLF_USE_BUTTONS,VLF.Fon t,1) --shows the player menu and stores the selected item in
selected_item
if pge.mp3.isplaying() then --checks if a mp3 file is being played
VLF.DrawText(VLF_CENTER,50,VLF.Font,pge.mp3.title( pge.mp3.getinfo()).." "..current_mp3.."/"..#mp3)--shows the title of the current
track and the mp3-position within the table
end
if selected_item == 1 then --item 1 ("Pause / Play") has been chosen
--to execute the related function we're gonna use the pge mp3 pause function
pge.mp3.pause() --if the function is called one time the mp3 will be paused, if the function is called 2 times the mp3 playback will continue
elseif selected_item == 2 then --item 2 ("stop") has been chosen
pge.mp3.stop()
elseif selected_item == 3 then --"continue" has been chosen
--to call the next MP3 function we're gonna use the following codeblock
if mp3[current_mp3+1] ~= nil then --checks for antoher mp3 file being available
current_mp3 = current_mp3 + 1 --increases the value of the current_mp3 variable by 1
pge.mp3.play(mp3[current_mp3]) --plays the next mp3 out of the mp3 table
else --if no more files are available within the table the first track will be played
current_mp3 = 1 --the value of the current_mp3 variable is set to 1
pge.mp3.play(mp3[current_mp3]) --plays the first mp3 out of the mp3 table
end
elseif selected_item == 4 then --"back" has been chosen
if current_mp3 ~= 1 then --checks for current_mp3 not being 1 (checks for the last mp3 being available)
current_mp3 = current_mp3 - 1 --decreases the value of the current_mp3 variable by 1
pge.mp3.play(mp3[current_mp3]) --plays the last played track out of the mp3 table
else --if current_mp3 = 1 (no more mp3s available) the last track that is contained in the table will be played
current_mp3 = #mp3 --the current_mp3 variable is set to the last field of the mp3 table (the last mp3 is chosen)
pge.mp3.play(mp3[current_mp3]) --plays the last mp3 of the mp3 table
end
end
elseif current_task == 3 then --MP3 LOADING
VLF.DrawText(VLF_CENTER,130,VLF.Font,"Searching MP3 files... ",2,3,VLF.Text_Color,VLF.Shadow_Color) --shows the state message
pge.gfx.swapbuffers()--in order to show the text without delay the buffers have to be swapped
--to insert all mp3s located in "ms0:/MUSIC/" into the mp3 table we're gonna use the following codeblock
mp3 = {} --the mp3 table is emptied
dir = pge.dir.open("ms0:/MUSIC/") --opens the directory "ms0:/MUSIC/"
music_files = dir:read() --reads the directory and returns it to music_files
dir:close() --closes the directory
for i = 1, #music_files do --starts the for loop that checks all fields of the table music_files
if not music_files[i].dir then --checks if the current field variable is a folder
if string.sub(music_files[i].name,-3) == "mp3" then --checks if the current field variable is a mp3
mp3[#mp3+1] = "ms0:/MUSIC/"..music_files[i].name --adds its path to the mp3 table
end
end
end
if #mp3 ~= 0 then --checks if mp3 files have been found
pge.mp3.play(mp3[1]) --plays the first mp3 of the table
current_mp3 = 1
Next_task = 2 --switches to the player menu
else --there are no mp3 files available
Next_task = 4 --since there are no mp3 files available the application quits (the exit task is called)
end
elseif current_task == 4 then --EXIT
pge.gfx.swapbuffers() --in order to finish the fade properly the buffers are swapped a bit earlier
pge.exit() --the application quits
end
VLF.DrawOptions(options)
pge.gfx.enddrawing()
pge.gfx.swapbuffers()
Fade_finished = VLF.FadeObjects(Fade_mode,VLF_FADE_SPEED_FAST)
end

hir konnt ihr es euch runterladen Download VLF v0.3.rar from Sendspace.com - send big files the easy way

Wäre echt net wenn ihr mir helfen könntet !!

daniel133

kann mir niemand helfen
Sad
Hast du die Vlf dateien ins pge verzeichnis kopiert? Was für ein Fehler? fehler gibts viele.

daniel133

der fehler liegt hier :

require("VLF")
VLF.init()
VLF.GetBG(28,"theme.vlf",true)
function Fade_Control()
old_Next_task = old_Next_task or 0
Next_task = Next_task or 0
if Fade_mode == 1 then
if Fade_finished then
current_task = Next_task
Fade_mode = 2
SET_HIGHLIGHT_BUTTON = 1
VLF_DISABLE_FOCUS_ANIMATION = true
end
elseif Fade_mode == 2 then
if Fade_finished then
VLF_DISABLE_FOCUS_ANIMATION = false
end
end
if old_Next_task ~= Next_task then
Fade_mode = 1
end
old_Next_task = Next_task
end
current_task = 1
current_mp3 = 1 --die aktuelle mp3
mp3 = {} --der table in dem alle mp3 pfade abgespeichert werden
--menu tables
main = {"load MP3","Player","Exit"}
player = {"Pause/Play","Stop","forward","back"}
while pge.running() do
Fade_Control()
pge.controls.update()
pge.gfx.startdrawing()
pge.gfx.clearscreen()
VLF.DrawFrame()
VLF.DrawTitleBar("VLF MP3 Player",1,TOP.EGG,pge.gfx.createcolor(0,0,0,0))
if current_task == 1 then --MAIN MENU
--to show "X Enter" with VLF.DrawOptions() we'll set options (take a look at line 915) = 1
options = 1
selected_item = VLF.DrawCentralMenu(main,VLF_USE_BUTTONS,VLF.Font, 1) --shows the mainmenu and stores the selectem item in
selected_item
--to check which option has been chosen in the menu we're gonna use this if block
if selected_item == 1 then --item 1 "choose MP3" has been chosen
Referenz-URLs