Post #1 · Posted at 2015-09-06 02:14:11am 9 years ago
So lately I've been working on my BGAnimations Project (http://zenius-i-vanisher.com/v5.2/viewthread.php?threadid=7376) and I can't get over the loop problem that I have. The thing is that some BGAnimations get looped twice and won't play the next BGA (That means it skips 1 BGA in the current song like an overlay over another BGA and it may cause lag ). So I wanted to know if anyone knows how to solve this. Like some counter so it wont loop according to the GetSongBeat().
I'm kind of noobie for scripting but I would be very thankful if someone knows how to solve it.
Quote
local t = Def.ActorFrame{
LoadActor("3.png")..{
OnCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT);
};
LoadActor("1.lua")..{
OnCommand=cmd(rainbow;blend,"BlendMode_Add");
};
};
return t;
LoadActor("3.png")..{
OnCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT);
};
LoadActor("1.lua")..{
OnCommand=cmd(rainbow;blend,"BlendMode_Add");
};
};
return t;
I'm kind of noobie for scripting but I would be very thankful if someone knows how to solve it.
Post #2 · Posted at 2015-09-06 11:37:33pm 9 years ago
dbk2 | |
---|---|
Member | |
332 帖子 | |
Not Set | |
Reg. 2012-04-30 | |
Quote: Engine_Machiner
The thing is that some BGAnimations get looped twice and won't play the next BGA
If it's only happening sometimes, it sounds more like there are probably errors in some of the scripts, preventing those particular scripts from loading at all. Are you showing ThemeErrors and do have
Quote: Preferences.ini
IgnoredDialogs=
set in your Preferences.ini file? Setting it to nothing like that will ensure that no errors are ignored and everything gets reported, which is useful when you are trying to debug a script!
If you are still having difficulties, please let me know and I can try to help you more.
Post #3 · Posted at 2015-09-07 09:44:54pm 9 years ago
Yes still having troubles. But I want to get something clear. These BGA's are not Themes Scripts (in that order). These BGA's are BG's Animations for playing meanwhile the song. Here let me show you the problem exactly.
The RED one is played correctly and the only problem I see on the script to skip the next BGA is the "queuecommand"
The BLUE one is SKIPPED and is not showed because of the first one (like an underlay can't be seen).
The GREEN one is played fine.
So that's exactly what's wrong with these scripts that have "queuecommand", creating Loops and Skipping backgrounds.
The RED one is played correctly and the only problem I see on the script to skip the next BGA is the "queuecommand"
The BLUE one is SKIPPED and is not showed because of the first one (like an underlay can't be seen).
The GREEN one is played fine.
So that's exactly what's wrong with these scripts that have "queuecommand", creating Loops and Skipping backgrounds.
Post #4 · Posted at 2015-09-10 08:01:38am 9 years ago
Quote: Engine_Machiner
But I want to get something clear. These BGA's are not Themes Scripts (in that order).
BGA scripts and theme scripts both use Lua, both use SM5's API, and both will use StepMania's error reporting interface when an error is encountered. BGA scripts are like small pieces of a theme, contained within a song.
Can you send me the scripts and the song in the screenshot? That will help me identify the problem more quickly. I will try my best to explain it to you, rather simply fixing it without any explanation.
- - - - - - - - - - - - - - - - - - - - - - - -
UPDATE:
Thank you for sending me your scripts.
The problem was with BGAnimations that used queuecommand to loop. While this did work to create a loop, it caused those animations to keep looping, essentially forever until the song ended. What you needed was a way to get each animation to stop when the next BGAnimation is called.
Kyzentun helped me with this part of the code.
LoseFocusCommand=function(self)
self:RunCommandsOnChildren( function(child) child:visible(false):finishtweening() end, {} )
end,
Every parent (main) ActorFrame of each BGAnimation should have this code. There are a few parts to it.
LoseFocusCommand is a command that is called when a BGAnimation is ending. This is helpful because it allows us to know when to hide and unload that particular animation, since it might still be looping otherwise.
RunCommandsOnChildren allows us to run a series of commands on all the primary ActorFrame's children actors.
The commands we run on those children are: visible(false) which hides the children actors immediately and finishtweening() which stops the childrens' current tweens and allows the BGAnimations to be unloaded.
- - - - - -
Additionally, I cleaned up your scripts to be more concise and included some comments so you might be able to understand why I changed certain things. Please ask if you have more questions.
You can download my updated versions of your BGAnimations here:
http://www.mediafire.com/download/vda17i5qzmj61ag/BGAnimations.zip
Post #5 · Posted at 2015-09-13 04:18:49pm 9 years ago
Engine_Machiner | |
---|---|
Member | |
222 帖子 | |
Reg. 2014-01-16 | |
"~The message~" |
Thank you so much!
Post #6 · Posted at 2015-09-14 12:41:09am 9 years ago
Quote: Engine_Machiner
Thank you so much!
You're welcome. I hope that it helps you. As for your other question (via PM):
Quote: Engine_Machiner
Everything has been ok. But now I need to find a way to flip the sprites in the right way (Like 50% Flip not 100% because it will look weirdly flipped) Like the old DDR Games. But the only thing I came up with is ":spin():effectmagnitude(0,180,0)". Do you know how to make it flip in the right way?
I don't understand your question. What do you mean by "flip the sprite the right way" ? Are you trying to rotate the sprites? If you are trying to rotate the sprites, on which axis? X? Y? Z?
If you can provide an example of what you are trying to do, I can probably help more. Otherwise, I think you have the right idea (probably) with spin() and effectmagnitude().
For example, to have an actor rotate clockwise, you would use self:spin():effectmagnitude(0,0,180)
To have an actor rotate counter-clockwise, you would use a negative value, like self:spin():effectmagnitude(0,0,-180)
Each value of (x, y, z) will cause the actor to spin on a different axis. You can try different combinations like self:spin():effectmagnitude(0,-180,0) and self:spin():effectmagnitude(180,0,0) to see what I mean.
Post #7 · Posted at 2015-09-14 01:40:31am 9 years ago
Engine_Machiner | |
---|---|
Member | |
222 帖子 | |
Reg. 2014-01-16 | |
"~The message~" |
The 0:24 Second look how the letters flip not completely just 50% and then back.
Post #8 · Posted at 2015-09-14 11:59:41pm 9 years ago
dbk2 | |
---|---|
Member | |
332 帖子 | |
Not Set | |
Reg. 2012-04-30 | |
Quote: Engine_Machiner
Quote
local file =
... or
"Square.png"
return Def.ActorFrame{
OnCommand=function(self) self:playcommand("Spin") self:playcommand("Repeat") end,
LoadActor( file )..{
RepeatCommand=cmd(hibernate,0.2;diffuse,color("#5a5a5a");zoom, 0.8;x, _screen.w-math.random(0,_screen.w); y, _screen.h+100; linear,2; y, -_screen.h-100; effectclock,'beat'; queuecommand,"Repeat";queuecommand,"Spin");
SpinCommand=cmd(spin)
},
... or
"Square.png"
return Def.ActorFrame{
OnCommand=function(self) self:playcommand("Spin") self:playcommand("Repeat") end,
LoadActor( file )..{
RepeatCommand=cmd(hibernate,0.2;diffuse,color("#5a5a5a");zoom, 0.8;x, _screen.w-math.random(0,_screen.w); y, _screen.h+100; linear,2; y, -_screen.h-100; effectclock,'beat'; queuecommand,"Repeat";queuecommand,"Spin");
SpinCommand=cmd(spin)
},
The trouble here is that the Sprite only spins once. Then when it repeats the command (Repeat) it stops spinning. I tried making another Command so it can loop but it doesn't.
I recommend not using spin() and using rotationz() instead. (This is mostly because I don't understand exactly what spin() does, but I do understand what rotationz() does.)
So, the fixed code is very similar to yours, but I used self:rotationz(360) instead of spin(). Hopefully this help solve this problem and helps you find a solution to the "half spin" problem in your post above.
Fixed code: http://pastebin.com/ayBRMc6E
Post #9 · Posted at 2015-09-15 12:01:53am 9 years ago
Engine_Machiner | |
---|---|
Member | |
222 帖子 | |
Reg. 2014-01-16 | |
"~The message~" |
Excellent. Thank you
Post #10 · Posted at 2015-09-15 12:05:40am 9 years ago
Kyzentun | |
---|---|
Member | |
3,209 帖子 | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
Spin is like having it continously rotate. The effectmagnitude vector is how far it rotates in one second.
Post #11 · Posted at 2015-09-15 12:06:46am 9 years ago
dbk2 | |
---|---|
Member | |
332 帖子 | |
Not Set | |
Reg. 2012-04-30 | |
Quote: Kyzentun
Spin is like having it continously rotate. The effectmagnitude vector is how far it rotates in one second.
I was hoping you'd pop in.
Post #12 · Posted at 2015-09-18 04:00:43am 9 years ago
Engine_Machiner | |
---|---|
Member | |
222 帖子 | |
Reg. 2014-01-16 | |
"~The message~" |
I would like to know if I can get local BPM = GAMESTATE:GetCurBPS( )/50. Cuz it's not working somehow making it look like "0". I need it to make the movements according to the BPM of the songs. Also any advices for making rainbow effects?
Post #13 · Posted at 2015-09-18 06:24:31am 9 years ago
Kyzentun | |
---|---|
Member | |
3,209 帖子 | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
If you're using animated sprites or movies that need to have their animation synced to the beat, you actually want "self:efffectclock('beat')". That's for timing when a sprite changes frames though, not for timing how it moves around.
Post #14 · Posted at 2015-09-18 03:50:46pm 9 years ago
Engine_Machiner | |
---|---|
Member | |
222 帖子 | |
Reg. 2014-01-16 | |
"~The message~" |
Does this work then? (I don't think so) ":texcoordvelocity(0.2,0):effectclock('beat')" That's what I'm looking for
Post #15 · Posted at 2015-09-18 05:07:15pm 9 years ago
Kyzentun | |
---|---|
Member | |
3,209 帖子 | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
Unfortunately, texcoordvelocity does not use the effect clock. You'll have to use GAMESTATE:GetSongPosition():GetCurBPS() to fetch the speed of the song and adjust the velocity.
If the built in rainbow effect doesn't do what you want, you'll have to write an update function that changes the diffuse color of the actor every frame. Then figure out the math to describe how you want the color to change.
If the built in rainbow effect doesn't do what you want, you'll have to write an update function that changes the diffuse color of the actor every frame. Then figure out the math to describe how you want the color to change.
Post #16 · Posted at 2015-09-20 06:53:04pm 9 years ago
Thanks! That was what I was looking for. The Rainbow Effect seems a lot more harder than it looks like.
Here at the 0:32 it's the one of the rainbow effect I don't really know how to get.
---
Also I have a carpet on the BGAnimation's folder and SM recognizes it as a BGA but it's not. Do anyone know how to make it non-recognizable? (Like ignoring it and not playing it) Fixed.
---
By how many numbers is the BPS Defined? I need to know this so I can switch between the right divisor according to the speed. (local BPM = GAMESTATE:GetSongPosition():GetCurBPS()/18.875). It's like the texcoordvelocity numbers. If it's 0.1 it's slow. If it's 10 it's fast. Nvm fixed.
---
What about linear? I mean texcoordvelocity and linear are different and I can't get the same values for linear.
Got something while testing the texcoordvelocity according to the BPM.
I need some help because I don't know why is this happening or why is this getting awkward while GameplayScreen and Normal while Edit Mode. I'm using this..
Here at the 0:32 it's the one of the rainbow effect I don't really know how to get.
---
---
---
What about linear? I mean texcoordvelocity and linear are different and I can't get the same values for linear.
Got something while testing the texcoordvelocity according to the BPM.
I need some help because I don't know why is this happening or why is this getting awkward while GameplayScreen and Normal while Edit Mode. I'm using this..
Quote
"local BPM = (GAMESTATE:GetSongPosition():GetCurBPS()/10)*((GAMESTATE:GetSongPosition():GetMusicSeconds())/GAMESTATE:GetSongPosition():GetSongBeat())*GAMESTATE:GetSongPosition():GetCurBPS()"
Post #17 · Posted at 2015-09-20 08:07:38pm 9 years ago
Kyzentun | |
---|---|
Member | |
3,209 帖子 | |
Reg. 2008-02-20 | |
"I'm honestly pissed off." |
Quote: Engine_Machiner
Quote
"local BPM = (GAMESTATE:GetSongPosition():GetCurBPS()/10)*((GAMESTATE:GetSongPosition():GetMusicSeconds())/GAMESTATE:GetSongPosition():GetSongBeat())*GAMESTATE:GetSongPosition():GetCurBPS()"
Post #18 · Posted at 2015-09-20 08:19:40pm 9 years ago
Quote
... that code doesn't even make sense. The current bpm is just current bps times 60, because "BPS" means "Beats Per Second", and there are 60 seconds in a minute.
Thanks again.