It is currently March 29th, 2024, 8:39 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

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote: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?
Hello, thanks again for the help. Maybe I'm wrong, but I have my games sorted alphabetically automatically in the skin. If I use this form you write I must rewrite manually the order games everytime I'll add a new game, no?

The problem is this skin gets the name of the games of the folder automaticly. I do this way because everytime I've installed a new game I must reorder manually every game, or have them disordered.

Example:

Game1=ABZU
Game2=Assetto Corsa

If after I install Age Of Empires, I want that Game2 is Age Of Empires, not Assetto Corsa.

PD: I figured out that the name of the program and the name of the game is not necessarily the same (maybe the game ABZU has a executable that is Launcher.exe), so my previous solution won't work.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:Hello, thanks again for the help. Maybe I'm wrong, but I have my games sorted alphabetically automatically in the skin. If I use this form you write I must rewrite manually the order games everytime I'll add a new game, no?
Yes, right.
But I'm not very sure if each newly installed game will have the appropriate .exe file in the same folder? To can make the skin to order the game alphabetically using the FileView plugin, you have to have them in the same folder. That's why at least for now, it's not clear for me how that skin will work. Plus as you said, sometimes the name of the process and the name of the file don1t match each other.
But there also could be a solution: maybe you could use my above solution (with the variables and the appropriate Process plugin measures) and use a small lua script to order alphabetically the process names.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:Yes, right.
But I'm not very sure if each newly installed game will have the appropriate .exe file in the same folder? To can make the skin to order the game alphabetically using the FileView plugin, you have to have them in the same folder. That's why at least for now, it's not clear for me how that skin will work. Plus as you said, sometimes the name of the process and the name of the file don1t match each other.
But there also could be a solution: maybe you could use my above solution (with the variables and the appropriate Process plugin measures) and use a small lua script to order alphabetically the process names.
Hello again, the skin is fully functional right now, I just want to improve it with the function that I said. I have a messy solution to make it work, I create 3 folders, Shortcuts, Icons and Images. Then I put every shortcut of my games in the Shortcuts folder, an Icon of the game with the exact name, and an Image of the game with the exact name. The three items have the same name, so although the skins use Independent measures to measure the folders, it results that the game 2 has the shortcut 2, the icon 2 and the image 2, so it shows correctly. When I install a new game, I put the shortcut in the shortcut folder, an icon with the same name in the icon folder, and an image with the same name in the images folder, so then the program order it automaticly.

Code: Select all

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

[MeasureFolder2]
Measure=Plugin
Plugin=FileView
Path="#@#\GameLauncher 2.0\Icons"
ShowDotDot=0
ShowFolder=0
Count=55

[MeasureFolder3]
Measure=Plugin
Plugin=FileView
Path="#@#\GameLauncher 2.0\Images"
ShowDotDot=0
ShowFolder=0
Count=55

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

[mIcon1-1]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder2]
Type=FileName
Index=1

[mLink1-1]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder]
Type=FilePath
Index=1

[mImage1-1]
Measure=Plugin
Plugin=FileView
Path=[MeasureFolder3]
Type=FileName
Index=1
If you want to see more just let me know.

I like that idea, but the order must be the order of the shortcuts. Example again, if ABZU is the element 1, and his program is launcher.exe, launcher.exe must be the first element too. That can be done with Lua? Moreover, I don't have knowledge of Lua, is it difficult to learn to do that?

One more time thank you so much for your time, I really appreciate that!!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

soyelrafa wrote:Hello again, the skin is fully functional right now, I just want to improve it with the function that I said. I have a messy solution to make it work, I create 3 folders, Shortcuts, Icons and Images. Then I put every shortcut of my games in the Shortcuts folder, an Icon of the game with the exact name, and an Image of the game with the exact name. The three items have the same name, so although the skins use Independent measures to measure the folders, it results that the game 2 has the shortcut 2, the icon 2 and the image 2, so it shows correctly. When I install a new game, I put the shortcut in the shortcut folder, an icon with the same name in the icon folder, and an image with the same name in the images folder, so then the program order it automaticly.
And you add these shortcuts, icons and images manually?
soyelrafa wrote:I like that idea, but the order must be the order of the shortcuts. Example again, if ABZU is the element 1, and his program is launcher.exe, launcher.exe must be the first element too. That can be done with Lua? Moreover, I don't have knowledge of Lua, is it difficult to learn to do that?
If you have exactly the same file names, with the appropriate extensions in all three folders, a properly created lua script will order them in the same order. In fact, we'll order just one of these file names, supposing the others have the same order.
Lua is a programming language and as such, despite it's not extremely complicated (at least the simpler scripts), you have to get used to it. It's not impossible, but first steps will not be simple. If finally you'll decide to use it, me or some other user here for sure will help.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:And you add these shortcuts, icons and images manually?

If you have exactly the same file names, with the appropriate extensions in all three folders, a properly created lua script will order them in the same order. In fact, we'll order just one of these file names, supposing the others have the same order.
Lua is a programming language and as such, despite it's not extremely complicated (at least the simpler scripts), you have to get used to it. It's not impossible, but first steps will not be simple. If finally you'll decide to use it, me or some other user here for sure will help.
That's correct.

Alright, then I'll try. Thanks again for the info!
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

Hello again, in LUA I can't use variables in get measures neither, no?

I use

mGame = mName1-1
mNombre = SKIN:GetMeasure('mGame')
mNombreValor = mNombre:GetStringValue()
return mNombreValor

And It doesn't work. But if I put mName1-1 directly in GetMeasure it works.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

Other thing, I want to set a Variable in Lua with a Bang,

I Use for example this:

SKIN:Bang('[!SetVariable SomeVariable "New value!"]')

return SomeVariable

But in Rainmeter #SomeVariable# doesn't exist after that...
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

Well, I solve the two problems I write before. It's my first day with Lua, so I suppose it's normal I have mistakes like that :D
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin that counts hours of playing games?

Post by balala »

Sorry soyelrafa I didn't reply so far, I just got home right now, after a long day...
soyelrafa wrote:Well, I solve the two problems I write before.
Both? Good!
soyelrafa wrote:It's my first day with Lua, so I suppose it's normal I have mistakes like that :D
Right. You'll get used to it, if you'll keep working. Good luck.
soyelrafa wrote:I Use for example this:

SKIN:Bang('[!SetVariable SomeVariable "New value!"]')

return SomeVariable

But in Rainmeter #SomeVariable# doesn't exist after that...
I don't know how finally have you solved these questions, but you should try to replace the above command with the following one: SKIN:Bang('!SetVariable', 'SomeVariable', 'New value!').
soyelrafa wrote:Hello again, in LUA I can't use variables in get measures neither, no?

I use

mGame = mName1-1
mNombre = SKIN:GetMeasure('mGame')
mNombreValor = mNombre:GetStringValue()
return mNombreValor

And It doesn't work. But if I put mName1-1 directly in GetMeasure it works.
Try this:

Code: Select all

function Update()
	mNombre = SKIN:GetMeasure('mGame')
	mNombreValor = mNombre:GetStringValue()
	SKIN:Bang('!SetOption', 'AStringMeter', 'Text', mNombreValor)
end
This script will set as text of the [AStringMeter] meter, the value of the mNombreValor.
soyelrafa
Posts: 96
Joined: March 1st, 2017, 3:09 pm

Re: Skin that counts hours of playing games?

Post by soyelrafa »

balala wrote:Sorry soyelrafa I didn't reply so far, I just got home right now, after a long day...

Both? Good!

Right. You'll get used to it, if you'll keep working. Good luck.

I don't know how finally have you solved these questions, but you should try to replace the above command with the following one: SKIN:Bang('!SetVariable', 'SomeVariable', 'New value!').

Try this:

Code: Select all

function Update()
	mNombre = SKIN:GetMeasure('mGame')
	mNombreValor = mNombre:GetStringValue()
	SKIN:Bang('!SetOption', 'AStringMeter', 'Text', mNombreValor)
end
This script will set as text of the [AStringMeter] meter, the value of the mNombreValor.
Hello, thanks one more time for the answer. I appreciate all the help you are providing me!

I hope you're right :D

I solved it with:

Code: Select all

SKIN:Bang('!SetVariable Game1 '..Juego2)
I must change to take the form you write there? If yes I suppose it will be:

Code: Select all

SKIN:Bang('!SetVariable', 'Game1', ..Juego2)
I solved the second problem in a different form than you write I think, my full program right now is:

Code: Select all

function Initialize()

end

function Update()

t = {}
t["ABZU"] = "ABZU.exe"
t["AGE OF EMPIRES II HD EDITION"] = "AOE2.exe"

mGame1 = SELF:GetOption('mGame')
--In the Rainmeter skin I create the variable mGame that have the value of the measure that I want to check. In my testing I am using mName1-1.

mNombre = SKIN:GetMeasure(mGame1)
mNombreValor = mNombre:GetStringValue()

--After I get the name of the Measure mName1-1, in the actual case is ABZU, I'll do a for bucle to the table for get the value that belongs to that game, in this case ABZU.exe.

for key,value in pairs(t) do 
a = key,value
if a == mNombreValor then
Juego2 = value
SKIN:Bang('!SetVariable Game1 '..Juego2)
end
end

end


This is right now the code I have in LUA, I want to improve with getting the table from a file that have only that table, but I still must research to learn how to do that :rofl: