Page 17 of 17 FirstFirst ... 7151617
Results 161 to 169 of 169
  1. #161
    Member madmijk's Avatar
    Join Date
    Jul 2012
    Location
    The Netherlands
    Posts
    69

    Default

    I wanna make some BGanimations (random BGanimations for in the BGanimations folder in the root of the Stepmania folder, not specifically for a song), and I don't know how to load the song's background in LUA scripts. I've already found GetSongBackground and LoadSongBackground, but how do I put that in the script? Or is it done another way? The ways I tried always resulted in a black background when I hit the first notes...

  2. #162
    Super Moderator
    Join Date
    Nov 2006
    Posts
    3,490

    Default

    Code:
    Def.Sprite{InitCommand=cmd(LoadFromCurrentSongBackground;)}
    That's the basic element to this.

  3. #163
    about 20% cooler shakesoda's Avatar
    Join Date
    Jun 2007
    Location
    Seattle, WA
    Posts
    6,886

    Default

    You need to call GetSongBackground() on a Song object, which you generally get from GAMESTATE. The magic incantation is GAMESTATE:GetCurrentSong():GetSongBackground(). oops. GetSongBackground() is global, you'd use it like so: LoadActor(GetSongBackground()). The other option (no built in fallback) is GAMESTATE:GetCurrentSong():GetBackgroundPath() as the argument for LoadActor.

    Here's some examples that should work (loads image and makes it invisible first thing, then fades in when a judgment happens)

    Code:
    local container = Def.ActorFrame {}
    local background = LoadActor(GetSongBackground())
    
    function background:InitCommand(params)
        self:diffusealpha(0.0)
    end
    
    function background:JudgmentMessageCommand(params)
        self:linear(0.5)
        self:diffusealpha(1.0)
    end
    
    table.insert(container, background)
    
    return container
    (same thing, written another way)
    Code:
    local t = Def.ActorFrame {}
    
    t[#t+1] = LoadActor(GetSongBackground())..{
        InitCommand=cmd(diffusealpha,0),
        JudgmentMessageCommand=cmd(linear,0.5;diffusealpha,1.0)
    }
    
    return t
    or the simplest example:
    Code:
    return LoadActor (GetSongBackground())..{
        InitCommand=cmd(rainbow)
    }
    Make sure the default.lua file is in a folder, or it will most likely not work at all.

    EDIT: my lua-fu is bad, fsx has informed me that GetSongBackground() is a global function, I was thinking GAMESTATE:GetCurrentSong():GetBackgroundPath().

    Plugging the different method in should work just the same unless the background image is missing.

    Also note, FSX's method using LoadFromCurrentSongBackground might work if this stuff doesn't.
    Last edited by shakesoda; 07-25-2012 at 05:45 PM. Reason: bad magic
    < shakesoda> I have altered the subject
    < shakesoda> pray I do not alter it further

  4. #164
    Member madmijk's Avatar
    Join Date
    Jul 2012
    Location
    The Netherlands
    Posts
    69

    Default

    Quote Originally Posted by shakesoda View Post
    Also note, FSX's method using LoadFromCurrentSongBackground might work if this stuff doesn't.
    Nothing that you coded worked, unfortunately. But I did this and it worked:
    Code:
    local t = Def.ActorFrame{
    	LoadActor(GAMESTATE:GetCurrentSong():GetBackgroundPath())..{
    		OnCommand=cmd(Center;rainbow)
    	};
    	LoadActor("2")..{
    		OnCommand=cmd(Center;pulse;effectclock,'beat');
    	};
    };
    
    return t;
    And thanks for the quick responses, btw! ^^

  5. #165
    Member madmijk's Avatar
    Join Date
    Jul 2012
    Location
    The Netherlands
    Posts
    69

    Default

    Another question: how do I get the song's background (in the BGanimation) cropped like when it's loaded without BGanimation? It always gets bigger than before.

  6. #166
    Super Moderator
    Join Date
    Nov 2006
    Posts
    3,490

    Default

    Code:
    return LoadActorWithParams ("/BackgroundEffects/StretchNormal.lua",{File1=GAMESTATE:GetCurrentSong():GetBackgroundPath(),Color1=color "#FFFFFF"})..{     
    InitCommand=cmd(rainbow) 
    }
    This loads the background with the normal BG translation applied to it.

  7. #167
    Member madmijk's Avatar
    Join Date
    Jul 2012
    Location
    The Netherlands
    Posts
    69

    Default

    Thank you so much!

  8. #168
    about 20% cooler shakesoda's Avatar
    Join Date
    Jun 2007
    Location
    Seattle, WA
    Posts
    6,886

    Default

    Quote Originally Posted by madmijk View Post
    Nothing that you coded worked, unfortunately. But I did this and it worked:
    Code:
    local t = Def.ActorFrame{
    	LoadActor(GAMESTATE:GetCurrentSong():GetBackgroundPath())..{
    		OnCommand=cmd(Center;rainbow)
    	};
    	LoadActor("2")..{
    		OnCommand=cmd(Center;pulse;effectclock,'beat');
    	};
    };
    
    return t;
    And thanks for the quick responses, btw! ^^
    None of them worked huh, I would have tested if I wasn't at work. Was it just GetSongBackground that wasn't working?

    (p.s. you don't need semicolons in lua outside of cmd, just make sure to put commas in your tables between the items)
    < shakesoda> I have altered the subject
    < shakesoda> pray I do not alter it further

  9. #169
    Member madmijk's Avatar
    Join Date
    Jul 2012
    Location
    The Netherlands
    Posts
    69

    Default

    -Deleted post-
    Last edited by madmijk; 09-06-2012 at 02:52 PM.

Similar Threads

  1. Level Six Pad
    By sehtick in forum Input, Adapter, and Controller questions
    Replies: 0
    Last Post: 06-04-2009, 04:51 PM
  2. At what level do you play?
    By CX gamer in forum General StepMania
    Replies: 35
    Last Post: 12-06-2008, 01:29 PM
  3. [In Progress]Galaxy Mix
    By MC_XD in forum Song releases
    Replies: 11
    Last Post: 12-02-2008, 08:39 AM
  4. [In Progress]Galaxy Angel AA - Angel Ukky
    By Queex in forum Song releases
    Replies: 0
    Last Post: 06-01-2007, 11:16 PM
  5. level difficulty
    By MrBob123 in forum General questions
    Replies: 6
    Last Post: 05-27-2007, 10:17 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Thanks to

SourceForge.net Logo