Logo

[SM5] Accessing other files in song folder?

Register Log In Back To Forums

Post #1 · Posted at 2016-11-16 06:14:50am 7.4 years ago

Offline leadbman
leadbman Avatar Member
263 Posts
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"
Hi all,

I'm just wondering if it is possible for me to load other files other than Banner, Background, Jacket, Disc, etc from the song folder? What I would like to do is be able to access the songs background video if it has one in the folder.

The way the code accesses things from inside the folder is by using for example:

Quote
LoadFromSongBackground( GAMESTATE:GetCurrentSong() )

This loads in the songs background image. So I'm curious if it would be possible to load in using this method the background video for the currently highlighted song. Would save me a tonne of time coding them in individually as well as being more portable for others.

Let me know if you have any ideas! Thanks in advance!
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #2 · Posted at 2016-11-16 05:52:24pm 7.4 years ago

Offline Jousway
Jousway Avatar Member
137 Posts
Netherlands
Reg. 2011-07-12

"Noteskins !== Quality "
this is how I used to load iidx bga before proper support got added back in sm-ssc

Quote

local song = GAMESTATE:GetCurrentSong();
local startoffset = song:GetFirstBeat(); --There is no proper way to get video offset sadly

return Def.ActorFrame {

Def.Sprite {
InitCommand=cmd(stretchto,0,0,SCREEN_WIDTH/550,SCREEN_HEIGHT/294;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-32);
OnCommand=cmd(sleep,startoffset;queuecommand,"Second");
SecondCommand=function(self)
if song then
local songDir = song:GetSongDir();
local dir = FILEMAN:GetDirListing(songDir);
local fileToLoad = nil;
local wat = 1;

for i=1,#dir do
if string.find(dir[i],".avi") then
fileToLoad = dir[i];
wat = 0;
self:Load(songDir..fileToLoad);

elseif string.find(dir[i],".png") and wat == 1 then
fileToLoad = dir[i];
self:Load(songDir..fileToLoad);
self:zoomx((SCREEN_WIDTH/2.15)/self:GetWidth());
self:zoomy((416)/self:GetHeight());
end;
end;
else
-- fallback crap for not having a song
end
end,
};

};

Its not a bug its a FEATURE!
http://i.imgur.com/AnyqNAJ.gif?1

Post #3 · Posted at 2016-11-17 03:53:52am 7.4 years ago

Offline leadbman
leadbman Avatar Member
263 Posts
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"
Thanks a lot for that! I got something working by using some of the ideas in your code. I've got it to play the video that's in the folder. Only issue I'm having is, it continues to show even if I'm over a folder.

Normally I'd deal with this by doing:

Quote
if song then
--Code to call video
self:visible(true);
else
self:visible(false);
end;

But for some reason it's not working at this stage. I think I might have stuffed something up. I tried doing if not song as well as shown below but it didn't work either.

My full code is:

Quote
t[#t+1] = Def.Sprite {

CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-105;);
OnCommand=cmd();
OffCommand=cmd(sleep,0.633;linear,0.05;diffusealpha,0);
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong();
local songDir = song:GetSongDir();
local songtitlet = song:GetTranslitFullTitle();
local songtitle = song:GetDisplayFullTitle();
local fileToLoad = songtitle..".avi"
local fileToLoadTrans = songtitlet..".avi"
local checkiftrans = songDir..fileToLoadTrans
if not song then
self:visible(false);
self:diffusealpha(0);
else

if not checkiftrans then
self:Load(songDir..fileToLoad);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
else
self:Load(songDir..fileToLoadTrans);
self:stoptweening();
self:visible(true);
self:zoomtowidth(265);
self:zoomtoheight(265);
self:diffusealpha(0);
self:sleep(3);
self:linear(0.15);
self:diffusealpha(1);
end;

end;
end;

}

Can you see what I'm doing incorrectly? Thanks a lot for your help on this! I really appreciate it.
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #4 · Posted at 2016-11-17 05:02:19am 7.4 years ago

Offline Jousway
Jousway Avatar Member
137 Posts
Netherlands
Reg. 2011-07-12

"Noteskins !== Quality "

Last updated: 2016-11-17 05:02am
hmmm maybe visable doesnt work on video files???, I have no idea, maybe you can throw in a self:Load(THEME:GetPathG("_blank","")) in there to unload the fille?
Its not a bug its a FEATURE!
http://i.imgur.com/AnyqNAJ.gif?1

Post #5 · Posted at 2016-11-17 05:07:08am 7.4 years ago

Offline leadbman
leadbman Avatar Member
263 Posts
Australia
Reg. 2016-02-01

"Working On: 5thMix BGA bgchanges"

Last updated: 2016-11-17 05:08am
I'll try that. Setting the visibility does work for videos, however I think because the files get loaded/unloaded when needed, the visibility may not be applying properly. I'll let you know how I go.

EDIT: It doesn't seem to work either. I'll keep working on it, I'm sure there's a solution! Thanks again for your help.
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2024 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 4% · Database: 8% · Server Time: 2024-04-18 15:09:47
This page took 0.006 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language