It is currently March 28th, 2024, 7:41 pm

[Script] Lua Marquee

Discuss the use of Lua in Script measures.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

sl23 wrote:Actually I used @Resources\Marquee.lua instead of #@#Marquee.lua, now I switched to the latter, it works now I've rearranged the code a little. I can't get the font style to work though?

Here's the latest version.
It's MeterStyle=, StringStyle= is used for Bold, Italic and the like.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [Script] Lua Marquee

Post by sl23 »

That's the thing, I've used this to specify the details:
[StringMeter1]
StringStyle=styleLeftText

Here's the code now:

Code: Select all

[mMedia1]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Artist

[mLua1]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia1
Delimiter=" | "

[StringMeter1]
Meter=String
MeasureName=mLua1
StringStyle=styleLeftText
X=120
Y=18
W=120
H=16

[mMedia2]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Title

[mLua2]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia2
Delimiter=" | "

[StringMeter2]
Meter=String
MeasureName=mLua2
StringStyle=styleLeftText
FontColor=128,255,0,255
X=r
Y=15r
W=120
H=16

[mMedia3]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Album

[mLua3]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia3
Delimiter=" | "

[StringMeter3]
Meter=String
MeasureName=mLua3
StringStyle=styleLeftText
X=r
Y=15r
W=120
H=16
- MuLab -
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

MeterStyle=styleLeftText
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [Script] Lua Marquee

Post by sl23 »

Oh?! Now I'm confused! Why not StringStyle? That works elsewhere.

Yay! Sorted, thanks for your help smurfier :thumbup:
- MuLab -
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

sl23 wrote:Oh?! Now I'm confused! Why not StringStyle? That works elsewhere.

Yay! Sorted, thanks for your help smurfier :thumbup:
Because StringStyle is exclusively used for StringStyle=Bold and the like.

What you are doing is using a MeterStyle.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [Script] Lua Marquee

Post by sl23 »

Er... Ok! How come this works elsewhere though? Does it depend where it's used I suppose?
- MuLab -
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

sl23 wrote:Er... Ok! How come this works elsewhere though? Does it depend where it's used I suppose?
It shouldn't work anywhere else. StringStyle is only for use on strings and applies Bold, Italic, or BoldItalic to a string. MeterStyle applies to all Meters and adds the options from the defined styles to that meter. A MeterStyle can be a section containing options or be another meter itself.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [Script] Lua Marquee

Post by sl23 »

My mistake I saw StringStyle and mistook it for the MeterStyle!!!
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: [Script] Lua Marquee

Post by sl23 »

The Marquee seems to work but have minor problems. The skin is laid out like this:

Artist - Never seen scrolling yet
Track - Always scrolls if longer than visible size
Album - sometimes scrolls, sometimes not

I've set the length to 20 characters. Basically I have 3 marquees one for each and they're all the same so how come Artist doesn't scroll and Album sometimes scrolls but not always, both should ALWAYS scroll when more than 20 characters shouldn't they?

EDIT: Think I've solved this, it was due to 20 chars being longer than W=120!

Marquee Code...

Code: Select all

;----------------------------------------------------------- TRACK INFO
[mMedia1]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Artist

[mLua1]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia1
Position=Left

[Artist1]
Meter=String
MeasureName=mLua1
MeterStyle=styleLeftText
X=120
Y=18
W=120
H=16
;===================
[mMedia2]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Title

[mLua2]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia2
Position=Left

[Track2]
Meter=String
MeasureName=mLua2
MeterStyle=styleLeftText
FontColor=128,255,0,255
X=r
Y=15r
W=120
H=16
;===================
[mMedia3]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=Album

[mLua3]
Measure=Script
ScriptFile=#@#Marquee.lua
Width=20
MeasureName=mMedia3
Position=Left

[Album3]
Meter=String
MeasureName=mLua3
MeterStyle=styleLeftText
X=r
Y=15r
W=120
H=16
I also can't get the scroll on MouseOver to work:
MouseOverAction=!CommandMeasure Lua Pause=1
MouseLeaveAction=!CommandMeasure Lua Pause,Timer=0,0

I copied this from the first post. As I have used these commands in the [Rainmeter] section, and I'd prefer a general MouseOver command, I put them in there with the other stuff. Am I doing something wrong?

I changed the Pause=0 and Position=Left in the LUA.
[Rainmeter] section Code...

Code: Select all

[Rainmeter]
Update=250
MouseOverAction=[!CommandMeasure mLua Pause=1][!Redraw]
MouseLeaveAction=[!CommandMeasure mLua Pause=,Timer=0,0][!Redraw]
EDIT: I've figured out the cause. Basically as I'd renamed MeterLua and now have 3 of these, I needed 3 !CommandMeasure mLua1(and 2 and 3). As detailed below:

Code: Select all

[Rainmeter]
Author=poiru
Update=250
MouseOverAction=[!CommandMeasure mLua1 Pause=1][!CommandMeasure mLua2 Pause=1][!CommandMeasure mLua3 Pause=1][!Redraw]
MouseLeaveAction=[!CommandMeasure mLua1 Pause,Timer=0,0][!CommandMeasure mLua2 Pause,Timer=0,0][!CommandMeasure mLua3 Pause,Timer=0,0][!Redraw]
One other thing, is it possible to make the Marquee work slightly differently. Instead of showing AlbumName then waiting til it scrolls to the last letter before reappearing, I'd like it work something like this:

AlbumName - AlbumName - AlbumName - ....

So the AlbumName is continually shown without waiting for it to finish before it starts again.

EDIT: As the MouseLeaveAction resets the Marquee, this isn't needed now as on MouseOver it scrolls from the start. I managed to sort these problems out but left this post here to help others

Thanks for your help
Scott
- MuLab -
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: [Script] Lua Marquee

Post by Seahorse »

Version 6.2 is rounding numbers, eg if a calc returns 15.8 it displays 16. How do I change this behaviour?

Further to that, the figure above is RAM, and Autoscale does not seem to be supported so I am using a calc:

Code: Select all

[PhysMemTotalCalc]
Measure=Calc
Formula=ROUND((MeasurePhysMemTotal/1024/1024/1024),#Accuracy#)
and I want to append GB. e.g 15.85 GB or whatever.

MeasureName=MeasureTime|MeasureDate|PhysMemTotalCalc GB|PhysMemUsedCalc|PhysMemFreeCalc

If I pop a GB after PhysMemTotalCalc the meter is not displayed at all, so what is the method to achieve this please?
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt