Logo

SM 5 Theming - Gameplay to Evaluation transition, Menus and Options

Register Log In Back To Forums

Post #41 · Posted at 2014-07-04 02:53:14am 9.8 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: AJ 187

Would you mind pasting your MusicWheelTransform in the thread?

This is what it currently looks like (runs):


ItemTransformFunction=function(self,offsetFromCenter,_fake1,_fake2) \
local numItems = THEME:GetMetric("MusicWheel","NumWheelItems")\
local curve3D = THEME:GetMetric("MusicWheel", "CirclePercent")*2*math.pi \
local fRotX = scale(offsetFromCenter, -numItems/2,numItems/2, -curve3D/2,curve3D/2) \
local radius = THEME:GetMetric("MusicWheel","Wheel3DRadius") \
local curveX = THEME:GetMetric("MusicWheel","ItemCurveX") \
local spacingY = THEME:GetMetric("MusicWheel","ItemSpacingY") \
self:x( (1-math.cos(offsetFromCenter/math.pi))*curveX ) \
self:y( (offsetFromCenter*scale(math.abs(offsetFromCenter), 0,numItems/2, spacingY,spacingY*math.sin(0.715))) ) \
self:z( -15*math.abs(offsetFromCenter*2.5) ) \
self:rotationx((offsetFromCenter*18) * math.sin(180/math.pi)) \
end


I got crashes when I tried:

ItemTransformFunction=function(self,offsetFromCenter,_fake1,_fake2) \
local numItems = THEME:GetMetric("MusicWheel","NumWheelItems")\
local curve3D = THEME:GetMetric("MusicWheel", "CirclePercent")*2*math.pi \
local fRotX = scale(offsetFromCenter, -numItems/2,numItems/2, -curve3D/2,curve3D/2) \
local radius = THEME:GetMetric("MusicWheel","Wheel3DRadius") \
local curveX = THEME:GetMetric("MusicWheel","ItemCurveX") \
local spacingY = THEME:GetMetric("MusicWheel","ItemSpacingY") \
if offsetFromCenter < 1 and offsetFromCenter > -1 then \
self:x( (1-math.cos(offsetFromCenter/math.pi))*curveX ) \
else \
self:x( (1-math.cos(offsetFromCenter/math.pi))*curveX - 10 ) \
end \
self:y( (offsetFromCenter*scale(math.abs(offsetFromCenter), 0,numItems/2, spacingY,spacingY*math.sin(0.715))) ) \
self:z( -15*math.abs(offsetFromCenter*2.5) ) \
self:rotationx((offsetFromCenter*18) * math.sin(180/math.pi)) \
end


adding semicolons didn't help.

Post #42 · Posted at 2014-07-04 03:12:52am 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
Quote
adding semicolons didn't help.
This is Lua, semicolons don't mean anything, unless they're separating table or list elements. Which is not what they would be doing in this code.

silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #43 · Posted at 2014-07-04 03:25:08am 9.8 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Kyzentun
Quote
adding semicolons didn't help.
This is Lua, semicolons don't mean anything, unless they're separating table or list elements. Which is not what they would be doing in this code.

I suspected as much. Still, I figured I'd list anything I could think of about the theme I could think of since it might provide a reason why it's not currently working like I want.

Post #44 · Posted at 2014-07-04 03:43:20am 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
After looking at it and making stepmania print the error to the log instead of crashing, one of the metrics that you're loading is nil.
"THEME:GetMetric("Foo", "Bar")" searches the "Foo" section of metric.ini for the "Bar" metric and returns its value.
So make sure that each of the things you're using THEME:GetMetric to fetch is actually set.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #45 · Posted at 2014-07-04 04:11:59am 9.8 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Kyzentun
After looking at it and making stepmania print the error to the log instead of crashing, one of the metrics that you're loading is nil.
"THEME:GetMetric("Foo", "Bar")" searches the "Foo" section of metric.ini for the "Bar" metric and returns its value.
So make sure that each of the things you're using THEME:GetMetric to fetch is actually set.

I think I defined every metric I called for, but here's the rest of the section:


[MusicWheel]
CirclePercent=0.5
ExtraColorOverridesMenuColor=true
FadeSeconds=-1
HighlightFinishOffCommand=sleep,0.016;accelerate,0.25;addx,380
HighlightFinishOffSortCommand=sleep,0.396;addx,380
HighlightFinishOnCommand=sleep,0.6;decelerate,0.34;addx,-380
HighlightFinishOnSortCommand=sleep,0.006;addx,-380
HighlightOnCommand=cropleft,0.05
HighlightStartOffCommand=
HighlightStartOnCommand=addx,380
ItemCurveX=32
ItemSpacingY=55
LockedInitialVelocity=7
ModeMenuActions="sort,GROUP"
ModeMenuNames="GROUP"
MostPlayedSongsToShow=30
MusicWheelItemFinishOffCommand=sleep,0.016;accelerate,0.25;addx,386
MusicWheelItemFinishOnCommand=sleep,0.25;addx,-380
MusicWheelItemStartOnCommand=;addx,380
NoCurving=false
NumSectionColors=1
NumWheelItems=18
RouletteSlowDownSwitches=5
RouletteSwitchSeconds=0.05
ScrollBarHeight=321
ScrollBarX=85
SectionColor1=color("1,1,1,1")
ShowEasyMarkerFlag=false
ShowRandom=true
ShowRoulette=true
SongRealExtraColor=color("#F90000") // red
SortMenuActions="sort,GROUP:sort,TITLE:sort,BPM:sort,HARD METER:sort,PLAYERS BEST"
SortMenuColor=color("1,1,1,1")
SortMenuNames=GROUP/SERIES:ABC:BPMBig GrinIFFICULTY:FAVORITE
SwitchSeconds=0.02
Use3D=true
UseExtraColor=false
Wheel3DRadius=391 # Possibly safe defaults is 220?
WheelItemOffDelayCenter=0
WheelItemOffDelayOffset=0
WheelItemOnDelayCenter=0
WheelItemOnDelayOffset=0.023

Post #46 · Posted at 2014-07-04 04:15:45am 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
Write a bit of code that checks whether each one is nil before using it, and prints a message to the log if it's nil and returns instead of continuing. Then hit Flush Log and read the log after SSMusic loads. That's the only way you have to find out which one is going wrong.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #47 · Posted at 2014-07-04 05:38:38am 9.8 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Kyzentun
Write a bit of code that checks whether each one is nil before using it, and prints a message to the log if it's nil and returns instead of continuing. Then hit Flush Log and read the log after SSMusic loads. That's the only way you have to find out which one is going wrong.

How is such code written?

So far, I find that adding any kind of If statement makes it crash. I'd be curious to know the Optical theme is able to use them, but nothing in its Scripts folder struck me as a reason.

Post #48 · Posted at 2014-07-04 06:18:42am 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
First of all, move the function to a lua file in Scripts. metrics.ini is never a good place for lua because it's harder to use any auto-indenting or syntax coloring your editor might provide, and it adds the clumsiness of needing a backslash on every line.

metrics.ini:
ItemTransformFunction=curved_wheel_transform

Scripts/wheel.lua: http://codepad.org/21r7suiu

The code tag here broken (removes indentation, thanks al2k4), so I'm not going to use it anymore.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #49 · Posted at 2014-07-04 05:13:47pm 9.8 years ago

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
Reg. 2012-09-13

"ITG, The Best Dance Machine!"
Im trying to get a 3D curved Music Wheel A LOT, specially for my ITG Theme.

[ScreenSelectMusic]
MusicWheelX=SCREEN_CENTER_X-210
MusicWheelY=SCREEN_CENTER_Y
MusicWheelOnCommand=draworder,-150;fov,5;zoomx,3.34;zoomy,1.06;zoomz,0.9;rotationy,67;
MusicWheelOffCommand=


And this is the ItemTransformFunction from [MusicWheel], I think u are using the same, I just edited it a few, but still with problems...

CirclePercent=0.42
Wheel3DRadius=200
ItemCurveX=-18
ItemSpacingY=32

ItemTransformFunction=function(self,offsetFromCenter,_fake1,_fake2) \
local numItems = THEME:GetMetric("MusicWheel","NumWheelItems")\
local curve3D = THEME:GetMetric("MusicWheel", "CirclePercent")*2*math.pi \
local fRotX = scale(offsetFromCenter, -numItems/2,numItems/2, -curve3D/2,curve3D/2) \
local radius = THEME:GetMetric("MusicWheel","Wheel3DRadius") \
local curveX = THEME:GetMetric("MusicWheel","ItemCurveX") \
local spacingY = THEME:GetMetric("MusicWheel","ItemSpacingY") \
self:x( (1-math.cos(offsetFromCenter/math.pi))*curveX ) \
self:y( (offsetFromCenter*scale(math.abs(offsetFromCenter), 0.95,numItems/2, spacingY,spacingY*math.sin(0.82))) ) \
self:z( -20*math.abs(offsetFromCenter*1) ) \
self:rotationx((offsetFromCenter*13) * math.sin(180.1/math.pi)) \
end


I cannt help so much, BUT really would like to know how to fix or make a better 3D MusicWheel.
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #50 · Posted at 2014-07-04 06:01:41pm 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
There's not actually a good reason to use metrics for anything besides numItems. Using metrics for them just doubles the number of places you can make a mistake.

This code: http://codepad.org/rDFp1CdA

Produces this wheel: http://i.imgur.com/OuBAtpG.jpg

If that's not the exact shape you want, well, that's where you need to apply some mathematical understanding to form a music wheel into the shape you want. This is where your high school geometry and trigonometry classes are useful.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #51 · Posted at 2014-07-04 06:38:39pm 9.8 years ago

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
Reg. 2012-09-13

"ITG, The Best Dance Machine!"
I hate Math (XD), but thanks, Im gonna tested it later.
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #52 · Posted at 2014-07-04 07:39:56pm 9.8 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
If you hate math and refuse to learn to use it properly, you will always be at the mercy of those who can use it.
That being said, I just had an awesome secret idea that I might implement in a couple weeks to make controlling the shape easier.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #53 · Posted at 2014-07-05 05:22:41am 9.7 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Kyzentun
There's not actually a good reason to use metrics for anything besides numItems. Using metrics for them just doubles the number of places you can make a mistake.

This code: http://codepad.org/rDFp1CdA

Produces this wheel: http://i.imgur.com/OuBAtpG.jpg

If that's not the exact shape you want, well, that's where you need to apply some mathematical understanding to form a music wheel into the shape you want. This is where your high school geometry and trigonometry classes are useful.

I must've made a syntax error or something; when I tried earlier to move the Wheel function to a LUA in Scripts, it crashed, but your code worked excellently.

I've just about got difficulty list / StepsDisplay taken care of.; Just need to make a font for the difficulty names and rename them. The Font Generator doesn't like my computer (some nonsense about side by side configurations).

I can't seem to get Percentage Scores to show on the Select Music screen; I tried borrowing code from themes that show them, but the methods from ITG3 and default seem as yet incompatible. I have a working function that returns text, which is basically what a Percentage Score graphic would be, but I'm not sure which functions return the percentage score for the currently selected song for players 1 and 2.

Post #54 · Posted at 2014-07-05 12:33:59pm 9.7 years ago

Offline bmhedgehog
bmhedgehog Avatar Banned+
3,136 Posts
Not Set
Reg. 2008-07-13

"BANNED"
This is pretty interesting stuff. And thanks to Kyezntun now someone can make a Supernova 1 and 2 themes for SM5

Post #55 · Posted at 2014-07-05 04:39:41pm 9.7 years ago

Offline Th3_Ov3rHell_3XoduZ
Th3_Ov3rHell_3XoduZ Avatar Member
313 Posts
Chile
Reg. 2012-09-13

"ITG, The Best Dance Machine!"

Last updated: 2014-07-05 04:39pm
Quote: Kyzentun
If you hate math and refuse to learn to use it properly, you will always be at the mercy of those who can use it.
That being said, I just had an awesome secret idea that I might implement in a couple weeks to make controlling the shape easier.

I said just for fun, I dont like Math so much but I never said I refuse to learn, I really want to learn but I need time for this, and actually I have made great things with The Helps of good people here...

I am very interesting in How this MusicWheel works, so Im gonna tested it on my ITG2 Theme.

Well, the code works perfectly, this is a MusicWheel via LUA, but using this one I got the same result using that one from Metrics.ini

I cannt make the items like I want (similar to the OpenITG MusicWheel).
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #56 · Posted at 2014-07-07 08:27:30pm 9.7 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03


Last updated: 2014-07-07 08:28pm
Th3_Ov3rHell_3XoduZ: Hope its OK for me raid your theme for syntax; while other theme's percentage scores wouldn't work with the theme I'm building, yours (ITG2) worked excellently; Thanks for building it!

Post #57 · Posted at 2014-07-08 12:51:07am 9.7 years ago

Offline dbk2
dbk2 Avatar Member
332 Posts
Not Set
Reg. 2012-04-30

Quote: Musashi
Th3_Ov3rHell_3XoduZ: Hope its OK for me raid your theme for syntax

It should be fine. Th3_Ov3rHell_3XoduZ originally raided my theme, and I originally raided AJ187/freem's theme(s) when I was learning. Acknowledging your sources (which you've been doing well so far!) helps mitigate the likelihood that you'll end up stepping on anyone's toes. Smile

Post #58 · Posted at 2014-07-08 04:08:03pm 9.7 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
Quote: dbk2
Quote: Musashi
Th3_Ov3rHell_3XoduZ: Hope its OK for me raid your theme for syntax

It should be fine. Th3_Ov3rHell_3XoduZ originally raided my theme, and I originally raided AJ187/freem's theme(s) when I was learning. Acknowledging your sources (which you've been doing well so far!) helps mitigate the likelihood that you'll end up stepping on anyone's toes. Smile
I dream of a day when blindly copying code you don't remotely understand from another theme and hoping it works by pure accident isn't common practice among themers.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #59 · Posted at 2014-07-08 07:26:26pm 9.7 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Kyzentun
Quote: dbk2
Quote: Musashi
Th3_Ov3rHell_3XoduZ: Hope its OK for me raid your theme for syntax

It should be fine. Th3_Ov3rHell_3XoduZ originally raided my theme, and I originally raided AJ187/freem's theme(s) when I was learning. Acknowledging your sources (which you've been doing well so far!) helps mitigate the likelihood that you'll end up stepping on anyone's toes. Smile
I dream of a day when blindly copying code you don't remotely understand from another theme and hoping it works by pure accident isn't common practice among themers.

Is it really pure accident?

Way I see it, I had to study the code and make a few logical guesses about its purpose, and since I can only find a certain amount of documentation, only way to learn the undocumented items to study existing work and try different ideas until I get one working. I think of it as experimentation. In fact, early in this thread much of the advice I got was to study other themes.

Post #60 · Posted at 2014-07-08 08:11:48pm 9.7 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
Quote: Musashi
Quote: Kyzentun
Quote: dbk2
Quote: Musashi
Th3_Ov3rHell_3XoduZ: Hope its OK for me raid your theme for syntax

It should be fine. Th3_Ov3rHell_3XoduZ originally raided my theme, and I originally raided AJ187/freem's theme(s) when I was learning. Acknowledging your sources (which you've been doing well so far!) helps mitigate the likelihood that you'll end up stepping on anyone's toes. Smile
I dream of a day when blindly copying code you don't remotely understand from another theme and hoping it works by pure accident isn't common practice among themers.
Is it really pure accident?

Way I see it, I had to study the code and make a few logical guesses about its purpose, and since I can only find a certain amount of documentation, only way to learn the undocumented items to study existing work and try different ideas until I get one working. I think of it as experimentation. In fact, early in this thread much of the advice I got was to study other themes.
My point is that "copy other themes and change parts until you understand" is a terrible phase to have to go through, and I dream of a day when there will be good thorough documentation (not documentation littered with leftovers from 5-10 years ago) for people to read instead.
It's not your fault, you're just struggling through a bad situation.
The most important things to know in theming for SM5 are:
Lua (really understand the language, spend some time working through the Programming In Lua book if at all possible, or just writing simple demo programs that run in the standalone lua interpreter to try out built in functions of the Lua language)
The existence of Lua.xml (where almost every lua function and class you can use is documented)
How an actor is constructed from a table in Lua (not very well explained in the documentation, and varies by small amounts for different actor classes)
The existence of log.txt (where all errors are printed, though soon the errors will be visible on screen too).
Knowing those things, it's possible to put them together and understand how the different parts of an unfamiliar screen work together, or build a screen from scratch if you don't feel like studying someone else's code.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
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: 4% · Server Time: 2024-04-19 23:54:38
This page took 0.017 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language