It is currently March 28th, 2024, 1:36 pm

[Script] Lua Marquee

Discuss the use of Lua in Script measures.
Post Reply
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: PROOF OF CONCEPT: Lua Marquee

Post by darcilicious »

smurfier wrote:Here is my working code with NowPlaying.
Hi there,

In my skin I have the Artist and Track as two separate meters:

Artist: ArtistName
Track: TrackName

(The "Artist:" and "Track:" labels are separate meters as well)

Would it be possible use your script to have just ArtistName and TrackName to scroll? I'm brand new to Rainmeter though I've managed to modify a number of skins to get them to work the way I'd like. The only thing that's missing from my NowPlaying skin for Spotify in ABP is to get these two items to scroll horizontally...

Thanks in advance for any help you can provide!
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

Post by darcilicious »

Okay, I think I found a problem?

Turning on debug I see this in the log file:

ERRO (04:21:42.655) Script: Marquee.lua:39: attempt to concatenate a boolean value

I get this in two skins, my modified NowPlay skin and the sample skin/.ini in the first post of this thread. In both cases, the skin/meter displays 0 or 0.0

Not sure what the fix is?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

Please try the version I just posted on the first page. Seems I forgot some parenthesis.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

Post by darcilicious »

That fixed it, thanks!

Any thoughts about my first post above? I'd rather not spend a lot of time fiddling trying to get it to work if the script doesn't support it (which is fine).

Thanks!
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

You will simply need to use two script measures, one for each meter.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

Post by darcilicious »

Perfect, that did the trick.

Quick question -- would it be possible for the initial display of the text to start in the "0" position and display the maximum numbers of characters initially and then start scrolling?

No worries if it can't be done or if you don't feel like doing it (but if it's the latter, that'd be good to know as I can make my hubby learn enough Lua this weekend to modify your script...)

Thanks again for a great script!
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

On the script measure set the Position option to Left.
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

Post by darcilicious »

Oh, right, options :) However after doing this:
  • Position
    • When set to LEFT, the string starts on the left side of the marquee.
It turns out it only "works" on the first "cycle" of the string; when the next cycle starts, the string starts in the original position...

And if the string is not long enough to need scrolling then the string gets repeated without scrolling, e.g. "Crying SineCrying" is what my meter is currently displaying because "Crying Sine" doesn't need to scroll.

Also, I tried using the mouseover unpause/pause commands and couldn't get them to work. The info from the original post is slightly inconsistent so it's very possible I'm not setting it up right.
Actions:
  • Reset the Timer
    • !CommandMeasure "MeasureLua" "Timer=0;"
  • Pause
    • !CommandMeasure "MeasureLua" "Pause=0;"
  • UnPause
    • !CommandMeasure "MeasureLua" "Pause=1;"
  • Toggle Pause
    • !CommandMeasure "MeasureLua" "Pause=1-Pause"
Tricks:
  • Have the text scroll only on mouseover.
    • On the Marquee measure set Pause=0 and Position=Left.
    • On the meter in question set:
      MouseOverAction=!CommandMeasure Lua Pause=1
      MouseLeaveAction=!CommandMeasure Lua Pause,Timer=0,0
These last two lines -- should they be like this?

MouseOverAction=[!Command "MeasureLua" "Pause=1"]
MouseLeaveAction=[!Command "MeasureLua" "Pause,Timer=0,0"]

If so, they don't seem to work.

However this works

MouseOverAction=[!CommandMeasure "MeasureLua" "Pause=1-Pause"]

if I mouse over the text twice ;)

Thanks again for your help, I'm SO close now :)
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

Could you please post your skin code so that I can see what's going on?
darcilicious
Posts: 34
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

Post by darcilicious »

Sure. Text styles are coming from the JSMeterV theme.

Code: Select all

[MeterAllBackground]
Meter=IMAGE
W=160
H=75
SolidColor=0,0,0,1

[MeterTitle]
Meter=STRING
X=0
Y=0
StringAlign=Left
Text="Now Playing"
AntiAlias=1
FontFace=#FontFace#
FontColor=#Color1#
FontSize=14

[mPlayer]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Spotify
; Edit PlayerName= above. A list of valid values is available
; from: http://rainmeter.net/cms/Plugins-NowPlaying_beta#playerlist
PlayerType=TITLE
Substitute="":"N\A"

[ArtistLabel]
Meter=STRING
StringAlign=Left
AntiAlias=1
FontColor=#Color2#
FontFace=#FontFace#
FontSize=12
X=r
Y=24
Text="Artist:"

[MeasureMediaArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[mPlayer]
PlayerType=ARTIST

[mArtist]
Measure=Script
ScriptFile=Marquee1.lua
MeasureName=MeasureMediaArtist
NumOfMeasures=1
Width=17

[ArtistName]
Meter=String
MeasureName=mArtist
AntiAlias=1
FontFace=#FontFace#
FontColor=#Color2#
FontSize=12
X=35r
Y=r

[TrackLabel]
Meter=STRING
AntiAlias=1
FontFace=#FontFace#
FontColor=#Color2#
FontSize=12
X=-35r
Y=15r
Text="Track:"

[MeasureMediaTrack]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[mPlayer]
PlayerType=TITLE

[mTrack]
Measure=Script
ScriptFile=Marquee2.lua
Width=17
MeasureName=MeasureMediaTrack
Position=Left
Pause=0

[TrackName]
Meter=String
MeasureName=mTrack
AntiAlias=1
FontFace=#FontFace#
FontColor=#Color2#
FontSize=12
X=35r
Y=r
MouseOverAction=[!Command "mTrack" "Pause=1"]
MouseLeaveAction=[!Command "mTrack" "Pause,Timer=0,0"]
Post Reply