Logo

Trouble with Linear and Sleep params in SM5

Register Log In Back To Forums

Post #1 · Posted at 2015-04-30 11:42:10pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

Hello, I am porting a theme from SM 3.9X, the params Linear and Sleep are working in SM5 but if the screen has menus or selectables items this params block the user input util the sleep or linear time specified has passed. There is a way to fix this? Or equivalent parameters that doesn't block the user input? Thanks!

Post #2 · Posted at 2015-05-01 01:41:22pm 8.9 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

Each screen class handle inputs differently, so it would help if you could specify which screen class you're using (ScreenTitleMenu, ScreenSelectMaster, etc. )

ScreenTitleMenu ignores inputs until the "In" transition is finished. If your problem is on ScreenTitleMenu and you're using "ScreenTitleMenu In" you could try moving the animation into the decorations instead.

Post #3 · Posted at 2015-05-01 04:17:46pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

Im using it on the ScreenTitleMenu underlay if I use on decorations the objects would ve in a layer over the menu?

Post #4 · Posted at 2015-05-01 07:08:14pm 8.9 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

Quote: MadkaT
Im using it on the ScreenTitleMenu underlay if I use on decorations the objects would ve in a layer over the menu?

Decorations work a little differently from Underlay or Overlay. The Underlay and Overlay each form a single layer, so if you want any part of the Underlay to be under an object, the entire Underlay has to be under that object. Decorations does not form a single layer, each object in Decorations is independent. You could have one object in Decorations be under the Underlay, and another be over the Overlay.

Personally, I only use Decorations, and never Underlay or Overlay, because it can do anything the others can and is far more powerful.

I found the line of code that is causing your trouble.

Quote: "ScreenSelectMaster::BeginScreen()"
m_fLockInputSecs = this->GetTweenTimeLeft();

ScreenSelectMaster, from which ScreenTitleMenu is derived, blocks all inputs until the initial tweening is finished.

There easiest way to work around that is through use of "queuecommand".

I think the most efficient way to do it would be to have a single actor, possibly the screen itself, tell the screen to 'queuecommand,"Animate"' or whatever you'd like to call the command, and then have all of the actors you'd like to animate tween off the AnimateCommand instead of OnCommand or InitCommand. The other option is to have each individual actor you wish to tween use it's own queuecommand from it's OnCommand or InitCommand

I don't know how much you know about theming in Stepmania, so if that is not enough information or if you need to see specific examples please ask.

Post #5 · Posted at 2015-05-01 09:54:00pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

I'm a noob in SM theming, I have three days playing with this Tongue

As far as I can understand you suggest me:

1. To use "ScreenTitleMenu decorations" instead of overlay/underlay.
2. Change OnComand to AnimateCommand

I've seen the animate comman in other themes but I don't know how to use it (Syntax). It probably would help me to implement also the "CommandRepeatSeconds" param too.

Actually this is one of my actors:

Quote
LoadActor( "../ScreenLogo background/ddrx_light1.png" )..{
OnCommand=cmd(diffusealpha,0.2;blend,'BlendMode_Add';horizalign,left;vertalign,top;y,0;x,-320;rotationz,-90;linear,7;rotationz,6;linear,7;rotationz,-90);
-- CommandRepeatSeconds=14
};

Is a rotating light from the DDRX Title BG.

I was wondering if there's a place where I can find documentation about the params available and syntax? Would be helpful for me to start reading Big Grin

Thanks for the help.

Post #6 · Posted at 2015-05-01 10:13:49pm 8.9 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01


Last updated: 2015-05-01 10:28pm
Actually, it's not limited to ScreenTitleMenu but to all screens as well. I agree with Mad Matt's way because overlay and underlay folders are somewhat redundant and they both can be placed inside decorations folder (with proper layer ordering). This way will minimize file/folders scattering all over inside BGAnimations folder. A good theme should have the minimum possible contents available inside (producing smallest possible storage) while maintaning the theme's functionality. I prefer to put all custom graphics and/or fonts inside each screen's decoration folder or Graphics folder (depends on the function), rather than in Graphics and/or Fonts folder, because they are easier to found.

Equivalent SM5 code from above would be this one: http://codepad.org/paOe0Ego

Post #7 · Posted at 2015-05-01 11:06:44pm 8.9 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

Each actor has a "tween queue" which is a list of tween states, tween types, and times. The tween states contain information like position, rotation, size, color, etc. The tween types are the things like "linear", "accelerate", etc. sleep works a little different internally, but can be used in more or less the same way. The times are the parameter you supply along with the tween type( e.g. with "linear,1", 1 is the time ). Actors move from one tween state to the next, and how fast they move and the speed at which they change is based on the tween types and tween times.

All actors can have any number of commands, with whatever names you'd like to assign to them. Some commands are triggered automatically by the game, others can be triggered by you as you like. You can use the method "playcommand,<command name>" to instantly trigger a command, or the method "queuecommand,<command name>" to add a special tween state to the end of the tween queue that will trigger the command when the actor reaches that state.

Quote: "Example"

Def.ActorFrame{
InitCommand = cmd(sleep,10;playcommand,"Now");
NowCommand = cmd(sleep,10; DO SOME STUFF );
}

Def.ActorFrame{
InitCommand = cmd(sleep,10;queuecommand,"Later");
LaterCommand = cmd(sleep,10; DO SOME STUFF );
}

In the first example, the actor will sleep for 20 seconds and then do some stuff. In the second example the actor will sleep for 10 seconds, and then trigger the second command, adding another 10 second sleep, and then do some stuff.

The difference between those two is fairly important in a number of cases. If you want to have commands repeat themselves, you have to use queuecommand. Using playcommand would trigger the command again immediately, which would trigger itself again immediate, etc to infinity. Using queuecommand it'll wait until it reaches the end before triggering the command.

Now, for your problem:
The game checks what the tween times of all actors are immediately after loading them. If your tweens are in your OnCommands, the game will see some non-zero time and block inputs until that time is over. If you have your OnCommand instead queues a command with tweens, the initial tween time will be zero, and on the first update, after the screen has already decided that inputs are now OK, your actors will begin tweening.

Quote: "Example"

Def.ActorFrame{
OnCommand=cmd(queuecommand,"Animate");
AnimateCommand=cmd( do stuff );
}
If you did that with each of your actors, you would not have the input blocking problem.

More on playcommand/queuecommand:

When an ActorFrame gets a command, with a few very rare( but important ) exceptions, it also tells all of it's children to play their command with the same name, if they have one. The "Screen" is an ActorFrame( it is derived from ActorFrame, at least ), and you can tell it to play or queue a command. If you do that, the command will be propagated to all actors on the screen, so rather than having to give all of them OnCommands which queue other commands, you could have a single actor tell the Screen to queue the Animate command and then have all of your animating actors listen for that command.

Quote: "Example"

Def.ActorFrame{
OnCommand=function() SCREENMAN:GetTopScreen():queuecommand("Animate");
}

LoadActor("your actor 1") .. { AnimateCommand=cmd( Do some Stuff ); }
LoadActor("your actor 2") .. { AnimateCommand=cmd( Do other Stuff ); }

Post #8 · Posted at 2015-05-02 06:03:17am 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

Ohh I got it! Animate is a custom string to identify the custom command. I've updating my lua file and it works, but I have another question:

There are some elements that I've aligned before, but using this queuecommand they appear in a different position of the screen, aligned to the top leftcorner:

http://i.imgur.com/W6yxNTU.jpg

Those are two of the elements tha give me that behaviour

Quote
LoadActor( "left_tab.png" )..{
OnCommand=cmd(queuecommand,"leftCommand");
leftCommand=cmd(x,39;y,240;addx,-78;sleep,0.283;decelerate,0.066;addx,78);
};

LoadActor( "left_panel.png" )..{
OnCommand=cmd(queuecommand, "leftCommand");
leftCommand=cmd(x,112;y,212;addx,-224;rotationz,-45;sleep,0.233;decelerate,0.166;addx,224;rotationz,0);
};

What i'm doing wrong? Dead

Post #9 · Posted at 2015-05-02 09:31:32am 8.9 years ago

Offline AJ 187
AJ 187 Avatar Member
130 Posts
Not Set
Reg. 2008-10-14

"retired"
Don't use absolute locations, use locations relative to SCREEN_CENTER_X, SCREEN_CENTER_Y, SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, and SCREEN_RIGHT. Keep in mind that the original 3.9 theme was most likely designed for 640x480, so for example, here's a conversion of left_tab

x was 39. relative to a SCREEN_CENTER_X value of 320, that would be SCREEN_CENTER_X-281.
y is 240, so just use SCREEN_CENTER_Y, as that's the middle Y value for a 640x480 screen.

Convert the other numbers in the same way, being mindful of the alignment (e.g. horizalign/vertalign/halign/valign).

Post #10 · Posted at 2015-05-02 10:58:05am 8.9 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

Quote: MadkaT
Those are two of the elements tha give me that behaviour

Quote
OnCommand=cmd(queuecommand, "leftCommand");

What i'm doing wrong? Dead

What you have is is triggering a non-existent "leftCommandCommand"

Quote: "Try this"
OnCommand=cmd(queuecommand,"left");

Post #11 · Posted at 2015-05-02 03:48:34pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

Quote: Mad Matt

What you have is is triggering a non-existent "leftCommandCommand"

I haven't seen that Big Grin is the Intellisense editor fault. Thanks!

Quote: AJ 187
Don't use absolute locations, use locations relative to SCREEN_CENTER_X, SCREEN_CENTER_Y, SCREEN_TOP, SCREEN_BOTTOM, SCREEN_LEFT, and SCREEN_RIGHT.

Thanks, they have these values cause I'm only pasting the original values to see if they work on SM5, and later tune em when the screen is working. I'll keep that in mind.

Well I have two more questions Confused:

1. In the original theme, there is present a black filter with this code:

Quote
[Layer31]
File=../_black.png
Type=1 // 0=sprite, 1=stretch, 2=particles, 3=tiles
Command=diffusealpha,0;sleep,64.5;accelerate,0.5;diffusealpha,1

I've adapted to this:

Quote
LoadActor( "../_black" )..{
OnCommand=cmd(queuecommand, "Blk");
BlkCommand=cmd(Center;FullScreen;diffusealpha,0;sleep,64.5;accelerate,0.5;diffusealpha,1);
};

But I did not seen the filter on screen.

2. The menu elements have a BG graphic rotated in x axis, one of the actors is this:

Quote
LoadActor( "choice_frame.png" )..{
OnCommand=cmd(queuecommand,"Ch1");
Ch1Command=cmd(x,SCREEN_CENTER_X+146;y,SCREEN_CENTER_Y-176;rotationz,-2;zoomx,0;sleep,0.15;decelerate,0.083;zoomx,1.1;accelerate,0.016;zoomx,1);
};

But in the main screen the still are horizontally oriented, how can I make the rotation?

There is a comparison between the original an my ported version of the screen:

The original theme screen:
http://i.imgur.com/rervXU9.jpg

My actual version:
http://i.imgur.com/P3Cx7Jc.jpg

Thanks for the time and support Mad Matt and AJ 187!

Post #12 · Posted at 2015-05-02 04:11:27pm 8.9 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26


Last updated: 2015-05-02 04:15pm
1) I'm not sure why it's being told to sleep for 64 seconds, but that is probably the reason it's not showing up. If you wait long enough it probably will. Try removing the sleep, to confirm that it's actually the right size and position. If so, you'll have to decide if you want to leave the long sleep or not.

2) In the second screenshot it looks like they are all rotated but only by a small amount( 2 degrees ) and all in the same direction.
In the first screenshot they look like the rotate in alternating directions,( +2, -2, +2, -2, etc ).

Post #13 · Posted at 2015-05-02 04:36:19pm 8.9 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01

@MadkaT

You should make for loop for repeated items with pattern. My take: http://codepad.org/aezIGt4s

Post #14 · Posted at 2015-05-02 05:55:32pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24

razorblade: Your code give me this error:

http://i.imgur.com/m3Z862M.jpg

The 121 line is te line of the for definition:
Quote
for i=1, 6 do

Yes, I've used the same object and forgot to change the rotationz value. Sorry about that.
For the black filter, i've removed the sleep command, but the screen is totally black now. This is the actual code:

Quote
LoadActor( "../_black" )..{
OnCommand=cmd(queuecommand,"Blk");
BlkCommand=cmd(Center;FullScreen;diffusealpha,0;accelerate,0.5;diffusealpha,1);
};

And this is what it looks like:
http://i.imgur.com/yw3OdMq.jpg

The image _black has no opacity.

Post #15 · Posted at 2015-05-02 06:15:01pm 8.9 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01

Change t[t+1] to t[#t+1] . Typo.

Post #16 · Posted at 2015-05-03 04:53:23pm 8.9 years ago

Offline MadkaT
MadkaT Avatar Member
820 Posts
Not Set
Reg. 2009-11-24


Last updated: 2015-05-03 11:16pm
Still not working Cry

Also I wanna ask how to assing a font to the menu elements? I have the png in the fonts folder but I don' know how to use it Laughing Hard
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: 3% · Database: 4% · Server Time: 2024-03-29 12:38:36
This page took 0.012 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language