Logo

[Theme Help] How Works GetThemePrefs, etc

Register Log In Back To Forums

Post #1 · Posted at 2014-09-27 08:23:59pm 9.4 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 make a color system for my Theme METRO QUAD... I have tried to learn from Simplicity Theme and Simply Love but I cannt make it works...

------------------------------------------------------------

For Example

On my ScreenTitleMenu background I have this:

------------------------------------------------------------

local t = Def.ActorFrame {};

t[#t+1] = Def.Quad {
BeginCommand=cmd(Fullscreen);
InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color(theme_color));
};

return t;


------------------------------------------------------------

In my 02 ThemePref.lua script, if I write in a line:

theme_color = "0,0,255,1" ;

The Def.Quad from the ScreenTitleMenu will get the Blue color. At that moment everything works fine. On my 02 ThemePref.lua script I write this:

local Prefs =
{
ColorPref =
{
Default = 1,
Choices = { "Blue", "Red" },
Values = { 1, 2 }
},
}

------------------------------------------------------------

That will write the line ColorPref=1 on the file ThemePrefs inside the Save folder.

Now, the thing I want to do is, How I can change the value of "theme_color" depending of the value from the preference ColorPref? I have tried a lot of things but nothing works. If I write on the script theme_color = "0,0,255,1" it will show the color Blue, but I cannt make that with a determinate preference that value changes.

Im not sure if I explained myself correct. I hope that someone can help me or maybe tell me a "more correct" way to implemente a Select Color for my Theme.

Thanks
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released

Post #2 · Posted at 2014-09-30 09:41:19am 9.4 years ago

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


Last updated: 2014-09-30 09:46am
Perhaps the part you are missing is ThemePrefs.Get()

local t = Def.ActorFrame {}

t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}

return t


Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.

local Prefs =
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}

Post #3 · Posted at 2014-10-01 08:41:35pm 9.4 years ago

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

"ITG, The Best Dance Machine!"
Quote: dbk2
Perhaps the part you are missing is ThemePrefs.Get()

local t = Def.ActorFrame {}

t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}

return t


Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.

local Prefs =
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}

Well... it was something so easy... XD, Thanks U Again, now it works perfectly!!
Quote: Released Themes for SM5 Beta 3
Quote: Released Themes for SM5 Beta 4 & 5.0.7
Quote: Simfles Packs Released
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: 8% · Server Time: 2024-03-19 05:51:06
This page took 0.004 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language