I have been working on a skin that takes the recently played games on your steam profile and can launch them from their icon on the skin.
The problem with the skin is that it won't show any games if you have less than 5 games in recent (I decided that the max nb of games shown would be 5).
On my measure that gets the ID and the logo of each games, I copied appid":(.*),.*logo":"(.*)",.* 5 times as the RegExp, for the number of games I want to get. If I had 4 games, then I would simply need to copy it 4 times for the skin to work. However, I'd like it to be user friendly.
To counter this problem, I wrote a small LuaScript that counts the number of games in recent with the number of appearance of "Appid". With the result of that count, I create a sequence of appid":(.*),.*logo":"(.*)",.* with the length needed. This result would then be sent to my skin as a variable and this variable it used for my RegExp. On paper it works...
I have a string meter to make sure the result of my Lua is good, and it does show me the right thing. But when I put the result of Lua in my webparser, it gives me a value of zero.
When I would expect something like that.
I tried a lot of things and looked at many post to see if their could be a way to fix that. I don't understand why the variable shows up right on my string meter but gives me a value of 0 on my webparser measure.
To help, my variable that uses the Lua result is NbGames and that variable is used for [MeasureAll].
I really hope a solution exists and I just didn't find it. Thank you.
Here are my script:
UserVariables.inc
Code: Select all
[Variables]
Game=appid":(.*),.*logo":"(.*)",.*
; appid":(.*),.*logo":"(.*)",.*
; Thumbnails dimensions
Width=146
Height=55
; Put your steam ID name after SteamID=
SteamID=imsash
;Panel Color
ColorSkin=50,50,50
;Panel Color on hover
ColorSkin2=255,80,247
;Panel Opacity
Opacity=175
;Number of games
NbGames=5
CountGames.lua
Code: Select all
function Initialize()
feedMeasure = SKIN:GetMeasure('MeasureNbGames')
end
function Update()
feedData = feedMeasure:GetStringValue()
dummyVar, numberOfItems = string.gsub(feedData, 'appid', "")
Game = SKIN:GetVariable('game', 'n/a')
g = string.rep(Game,numberOfItems)
return tostring(g)
end
SteamRecent.ini
Code: Select all
[Rainmeter]
Update=500
OnUnfocusAction=[!SetVariable ToggleVar 1][!UpdateMeter MeterPanel][!Redraw][!HideMeter MeterGame1Image][!HideMeter MeterGame2Image][!HideMeter MeterGame3Image][!HideMeter MeterGame4Image][!HideMeter MeterGame5Image][!HideMeter MeterSteamImage][!UpdateMeter *][!Redraw]
RightMouseUpAction=[!SkinCustomMenu]
ContextTitle=Settings
ContextAction=["#@#Config\config.exe" #PanelType# "#CURRENTCONFIG#" "#CURRENTFILE#" "#SETTINGSPATH#" "#SKINSPATH#" "#PROGRAMPATH#"]
ContextTitle2=Refresh
ContextAction2=[!Refresh #CurrentConfig#]
ContextTitle3=Unload
ContextAction3=[!DeactivateConfig]
ContextTitle4=----
ContextAction4=[]
ContextTitle5=MoreActions
ContextAction5=[!SkinMenu]
[Variables]
@include=#@#UserVariables.inc
ToggleVar=1
NbGames=(?siU)[&MeasureLuaScript:Update()]
; GamesID="appid":(.*),.*logo":"(.*)",.*appid":(.*),.*logo":"(.*)",.*"
; Timers
[Timer]
Measure=Calc
Formula=( Timer + 1 )
Disabled=1
IfCondition=(Timer=1)
IfTrueAction=[!HideMeter MeterGame1Image][!HideMeter MeterGame2Image][!HideMeter MeterGame3Image][!HideMeter MeterGame4Image][!HideMeter MeterGame5Image][!HideMeter MeterSteamImage][!SetVariable ToggleVar "1"][!DisableMeasure Timer][!UpdateMeter *][!Redraw]
[MeasureNbGames]
Measure=WebParser
URL=https://steamcommunity.com/id/#SteamID#/games/?tab=recent
RegExp=(?siU)var rgGames(.*)var
UpdateRate=300
[MeasureLuaScript]
Measure=Script
ScriptFile=#@#CountGames.lua
Disabled=1
UpdateDivide=-1
[MeasureAll]
Measure=WebParser
URL=https://steamcommunity.com/id/#SteamID#/games/?tab=recent
RegExp=#NbGames#
UpdateRate=300
FinishAction=[!CommandMeasure MeasureGame1ImageDL "Update"][!CommandMeasure MeasureGame2ImageDL "Update"][!CommandMeasure MeasureGame3ImageDL "Update"][!CommandMeasure MeasureGame4ImageDL "Update"][!CommandMeasure MeasureGame5ImageDL "Update"][!HideMeter MeterGame1Image][!HideMeter MeterGame2Image][!HideMeter MeterGame3Image][!HideMeter MeterGame4Image][!HideMeter MeterGame5Image][!SetVariable ToggleVar "1"][!HideMeter MeterSteamImage]
[MeasureSteam]
Measure=WebParser
URL=https://steamcommunity.com/id/#SteamID#/
RegExp=(?siU)<div class="profile_avatar_frame">.*<img src="(.*)">.*</div>.*<img src="(.*)">.*</div>
UpdateRate=300
[MeasureFrame]
Measure=WebParser
URL=[MeasureSteam]
StringIndex=1
Download=1
[MeasureSteamProfile]
Measure=WebParser
URL=[MeasureSteam]
StringIndex=2
Download=1
; Games
[MeasureGame1ID]
Measure=WebParser
URL=[MeasureAll]
StringIndex=1
[MeasureGame1ImageURL]
Measure=WebParser
URL=[MeasureAll]
StringIndex=2
Substitute="\/":"/"
[MeasureGame1ImageDL]
Measure=WebParser
URL=[&MeasureGame1ImageURL]
DynamicVariables=1
Download=1
[MeasureGame2ID]
Measure=WebParser
URL=[MeasureAll]
StringIndex=3
[MeasureGame2ImageURL]
Measure=WebParser
URL=[MeasureAll]
StringIndex=4
Substitute="\/":"/"
[MeasureGame2ImageDL]
Measure=WebParser
URL=[&MeasureGame2ImageURL]
DynamicVariables=1
Download=1
[MeasureGame3ID]
Measure=WebParser
URL=[MeasureAll]
StringIndex=5
[MeasureGame3ImageURL]
Measure=WebParser
URL=[MeasureAll]
StringIndex=6
Substitute="\/":"/"
[MeasureGame3ImageDL]
Measure=WebParser
URL=[&MeasureGame3ImageURL]
DynamicVariables=1
Download=1
[MeasureGame4ID]
Measure=WebParser
URL=[MeasureAll]
StringIndex=7
[MeasureGame4ImageURL]
Measure=WebParser
URL=[MeasureAll]
StringIndex=8
Substitute="\/":"/"
[MeasureGame4ImageDL]
Measure=WebParser
URL=[&MeasureGame4ImageURL]
DynamicVariables=1
Download=1
[MeasureGame5ID]
Measure=WebParser
URL=[MeasureAll]
StringIndex=9
[MeasureGame5ImageURL]
Measure=WebParser
URL=[MeasureAll]
StringIndex=10
Substitute="\/":"/"
[MeasureGame5ImageDL]
Measure=WebParser
URL=[&MeasureGame5ImageURL]
DynamicVariables=1
Download=1
; Images
[MeterPanel]
Meter=Image
MeasureName=MeasureSteamProfile
X=0
Y=0
W=#Height#
H=#Height#
Padding=12,12,(#ToggleVar# = 1 ? 12 : 821),12
SolidColor=#colorskin#,#opacity#
AntiAlias=1
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor #colorskin2#,#opacity#][!UpdateMeter MeterPanel][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor #colorskin#,#opacity#][!UpdateMeter MeterPanel][!Redraw]
DynamicVariables=1
LeftMouseUpAction=[!SetVariable ToggleVar (1-#ToggleVar#)][!UpdateMeter MeterPanel][!Redraw][!ToggleMeter MeterGame1Image][!ToggleMeter MeterGame2Image][!ToggleMeter MeterGame3Image][!ToggleMeter MeterGame4Image][!ToggleMeter MeterGame5Image][!ToggleMeter MeterSteamImage][!UpdateMeter *][!Redraw]
[MeterGame1Image]
Meter=Image
MeasureName=MeasureGame1ImageDL
X=(#Height#+24)
Y=12
W=#Width#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=steam://rungameid/[MeasureGame1ID]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1]
DynamicVariables=1
[MeterGame2Image]
Meter=Image
MeasureName=MeasureGame2ImageDL
X=0R
Y=12
W=#Width#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=steam://rungameid/[MeasureGame2ID]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1]
DynamicVariables=1
[MeterGame3Image]
Meter=Image
MeasureName=MeasureGame3ImageDL
X=0R
Y=12
W=#Width#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=steam://rungameid/[MeasureGame3ID]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1]
DynamicVariables=1
[MeterGame4Image]
Meter=Image
MeasureName=MeasureGame4ImageDL
X=0R
Y=12
W=#Width#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=steam://rungameid/[MeasureGame4ID]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1]
DynamicVariables=1
[MeterGame5Image]
Meter=Image
MeasureName=MeasureGame5ImageDL
X=0R
Y=12
W=#Width#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=steam://rungameid/[MeasureGame5ID]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1]
DynamicVariables=1
[MeterSteamImage]
Meter=Image
ImageName=@Resources\Steam.png
X=(0+12)R
Y=12
W=#Height#
H=#Height#
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
LeftMouseDownAction=!Execute ["D:\Program Files (x86)\Steam\Steam.exe"]
LeftMouseUpAction=[!EnableMeasure "Timer"][!SetVariable ToggleVar 1][!UpdateMeter *][!Redraw]
MiddleMouseDownAction=!Execute ["D:\Program Files (x86)\Steam\Steam.exe"][steam://url/SteamIDMyProfile][!EnableMeasure "Timer"][!SetVariable ToggleVar 1][!UpdateMeter *][!Redraw]
RightMouseDownAction=!Execute ["D:\Program Files (x86)\Steam\Steam.exe"][steam://open/games][!EnableMeasure "Timer"][!SetVariable ToggleVar 1][!UpdateMeter *][!Redraw]
DynamicVariables=1
[MeterFrame]
Meter=Image
MeasureName=MeasureFrame
X=7
Y=7
W=(#Height# + 10)
H=(#Height# + 10)
SolidColor=0,0,0,1
Solid=1
AntiAlias=1
[MeterNumOfOcc]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#NbGames#
DynamicVariables=1