It is currently September 21st, 2019, 6:10 pm

[Script] Lua Marquee

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

Re: PROOF OF CONCEPT: Lua Marquee

darcilicious » September 8th, 2012, 7:27 pm

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: 35
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

darcilicious » September 8th, 2012, 8:56 pm

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: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

smurfier » September 8th, 2012, 10:43 pm

Please try the version I just posted on the first page. Seems I forgot some parenthesis.
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 . . .
darcilicious
Posts: 35
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

darcilicious » September 8th, 2012, 11:27 pm

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: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

smurfier » September 8th, 2012, 11:44 pm

You will simply need to use two script measures, one for each meter.
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 . . .
darcilicious
Posts: 35
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

darcilicious » September 15th, 2012, 6:10 am

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: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

smurfier » September 15th, 2012, 11:57 am

On the script measure set the Position option to Left.
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 . . .
darcilicious
Posts: 35
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

darcilicious » September 15th, 2012, 2:34 pm

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: 1937
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

smurfier » September 15th, 2012, 4:22 pm

Could you please post your skin code so that I can see what's going on?
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 . . .
darcilicious
Posts: 35
Joined: May 1st, 2010, 5:34 pm

Re: [Script] Lua Marquee

darcilicious » September 15th, 2012, 4:31 pm

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"]