It is currently April 27th, 2024, 4:14 am

Skin that counts hours of playing games?

Get help with creating, editing & fixing problems with skins
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Skin that counts hours of playing games?

Post by soyelrafa »

Hello, I have a Game Launcher with my games, and I like Steam feature that counts the hours that I play a game, so I am thinking how to do it in my game launcher to get this feature with all the games, not only Steam.

I see that with the process plugin I can get if a game is running or not. So I think that I can create a skin that when a game is open with the skin, start a timer, and when is closed, the timer finish, and the results will be added to the previous results written in a txt.

The program name will be readed for a txt that have the name of the game (example, if I execute ABZU it'll read in ABZU.txt that the game is ABZU.exe). I don't set any game previosly, but the skin reads the folder "Shortcuts" and set the games with the order in that folder, with the possibility of scroll.

My question before I get into the mess of creating this is if it's possible this idea or it's impossible to make it to work. Like I figured it I think it's possible, but I don't have much experience already with Rainmeter, so I am not sure.

Thanks and best regards.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:I see that with the process plugin I can get if a game is running or not. So I think that I can create a skin that when a game is open with the skin, start a timer, and when is closed, the timer finish, and the results will be added to the previous results written in a txt.
A properly created skin will count no matter how do you open the game. It'll count even if you open the game with the skin, even if you open it with a shortcut.
soyelrafa wrote:The program name will be readed for a txt that have the name of the game (example, if I execute ABZU it'll read in ABZU.txt that the game is ABZU.exe). I don't set any game previosly, but the skin reads the folder "Shortcuts" and set the games with the order in that folder, with the possibility of scroll.
Probably a better approach would be to create a let's say Variables.inc file, which should have the names of all games you'd like to work with. The skin would use that file and the variables added into it.
soyelrafa wrote:My question before I get into the mess of creating this is if it's possible this idea or it's impossible to make it to work. Like I figured it I think it's possible, but I don't have much experience already with Rainmeter, so I am not sure.
Probably it is.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:A properly created skin will count no matter how do you open the game. It'll count even if you open the game with the skin, even if you open it with a shortcut.

Probably a better approach would be to create a let's say Variables.inc file, which should have the names of all games you'd like to work with. The skin would use that file and the variables added into it.

Probably it is.
Thank you for the answer and the advices! I will try it then :D
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:Thank you for the answer and the advices! I will try it then :D
I suppose, you'll have further question. Just let me (us) know, if you have any.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:I suppose, you'll have further question. Just let me (us) know, if you have any.
I suppose that too :D Perfect, thank you so much!!
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:I suppose that too :D Perfect, thank you so much!!
Glad to help, if I can.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

Well, first problem. I have a Measure, mName1-1, that get the name of the game 1-1, for example ABZU. So, I want this meter shows the variable ABZU, that I set to ABZU.exe, but I can't get it to work.

Code: Select all

[Variables]
ABZU=ABZU.exe

[MeasureFolder]
Measure=Plugin
Plugin=FileView
Path="#@#\GameLauncher 2.0\Shortcuts"
ShowDotDot=0
ShowFolder=0
Count=55
HideExtensions=1

[mName1-1]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FileName
Index=1

[Prueba2]
Meter=STRING
MeasureName=mName1-1
X=730
Y=500
FontColor=179,220,237,255
FontSize=20
StringStyle=NORMAL
StringAlign=CENTER
Text=#%1#
AntiAlias=1
Hidden=0
Group=1

I want that [Prueba2] (in english "prueba" means test by the way) shows ABZU.exe, the variable that I set earlier. I try with "#[mName1-1]#" and it doesn't work too. I want this because the element 1-1 is not always the same, because you can do scroll in the skin.

PD: I only put the code that I think is important to this matter (the complete skin have 4545 lines :rofl: ) , but maybe I forgot something important so sorry if that the case.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

This isn't possible this way, because Rainmeter resolves firstly the variables, then the measures. This means that a [Measure#Number#] kind of expression will work, returning the value of the [Measure1], [Measure2] and so on (obviously depending by the value of the Number variable) measures, but a #[mName1-1]# can't work, because Rainmeter will resolve as I said, first the value of the variable, then the measures. In this case, because when Rainmeter wants to resolve the variable, the measure doesn't has a value yet, this won't work.
A solution for a similar problem was given by moshi a while ago, here: https://forum.rainmeter.net/viewtopic.php?p=96350#p96350 (I thank him, for this great idea).
In that case, the question was how could be used a variable name into another variable name, but using a measure name into a variable name, is almost the same question. The problem is that you should enumerate all possible values of the variable into the Substitution option. If this is possible, the workaround will work.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:This isn't possible this way, because Rainmeter resolves firstly the variables, then the measures. This means that a [Measure#Number#] kind of expression will work, returning the value of the [Measure1], [Measure2] and so on (obviously depending by the value of the Number variable) measures, but a #[mName1-1]# can't work, because Rainmeter will resolve as I said, first the value of the variable, then the measures. In this case, because when Rainmeter wants to resolve the variable, the measure doesn't has a value yet, this won't work.
A solution for a similar problem was given by moshi a while ago, here: https://forum.rainmeter.net/viewtopic.php?p=96350#p96350 (I thank him, for this great idea).
In that case, the question was how could be used a variable name into another variable name, but using a measure name into a variable name, is almost the same question. The problem is that you should enumerate all possible values of the variable into the Substitution option. If this is possible, the workaround will work.
Thanks for the info! But in that case I prefer to return to the first idea, for every game i'll create a txt with the program name. It's a messy solution too, but I think is better than edit the skin every time I want to add a new game.

Again thanks for the answer!
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:Thanks for the info! But in that case I prefer to return to the first idea, for every game i'll create a txt with the program name. It's a messy solution too, but I think is better than edit the skin every time I want to add a new game.

Again thanks for the answer!
You're welcome.
But I don't think it would be necessary. Instead I'd add into the [Variables] section,one variable for each game. Something like this:

Code: Select all

[Variables]
Game1=NAME-OF-THE-FIRST-GAME
Game2=NAME-OF-THE-SECOND-GAME
Game3=NAME-OF-THE-THIRD-GAME
...
and so on.
Then I'd use these variables into the appropriate Process plugin measures:

Code: Select all

[MeasureGame1]
Measure=Plugin
Plugin=Process
ProcessName=#Game1#

[MeasureGame2]
Measure=Plugin
Plugin=Process
ProcessName=#Game2#

[MeasureGame3]
Measure=Plugin
Plugin=Process
ProcessName=#Game3#

...
Each such measure will return -1 if the appropriate game isn't running and 1 if it is.
This is not a good enough solution to your problem?