It is currently October 24th, 2021, 10:50 am

[Script] Lua Marquee

Discuss the use of Lua in Script measures.
ToyMachine
Posts: 7
Joined: October 11th, 2011, 8:43 pm

Re: [Script] Lua Marquee

Post by ToyMachine »

Here's all I threw together to get Songbird to work. The only thing I would like to change now is how fast the marquee scrolls. It goes too slow as of now.

The skin I'm using is Hexa http://shailendravikram.deviantart.com/art/hexa-1-0-193409276

Code: Select all

[Rainmeter]
Author=shailendravikram kumar (shailendra007smailbox@gmail.com)
;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata
[SongbirdLabel]
Meter=STRING
X=24
Y=12
FontColor=232222
StringStyle=BOLD
Fontsize=11
Fontface=Agency FB
StringEffect=SHADOW
FontEffectColor=255,255,255,100
AntiAlias=1
Text="Songbird"
Hidden=0

[seperator]
Meter=IMAGE
SolidColor=255, 255, 255, 150
X=4
Y=30
W=92
H=1

[StyleButton]
X=15r
Y=76
FontColor=255,255,255
StringStyle=Bold
FontSize=18
StringAlign=LEFT
FontFace=Webdings
AntiAlias=1
Hidden=0

[IconBack]
Meter=IMAGE
ImageName=BG2.png
X=0
Y=0

;-------------------------
; OPEN

[Open]
Meter=IMAGE
ImageName=songbird.png
h=20
w=20
x=40
y=76
LeftMouseDownAction=!Execute ["C:\Program Files (x86)\Songbird\songbird.exe"]




;--------------------
; Now Playing


;===============================================================================================
;Variables
;===============================================================================================

[Variables]

;Fonts & Colours
@include="Settings.inc"

;===============================================================================================

[MeasureQuote]
Measure=Plugin
Plugin=Plugins\QuotePlugin.dll
PathName=nowplaying.txt
UpdateDivider=1

[MeasureLua]
Measure=Script
ScriptFile=Marquee.lua
MeasureName=MeasureQuote
Width=30

;===============================================================================================
;Meters
;===============================================================================================

[MeterRefresh]
Meter=BUTTON
X=0
Y=0
ButtonCommand=!UpdateMeasure MeasureQuote
MiddleMouseUpAction=!Execute ["#CURRENTPATH#nowplaying.txt"]

[QuoteString]
Meter=String
MeasureName=MeasureLua
X=5R
Y=36
W=90
H=16
MeterStyle=StringStyleBig
Text=%1

;-----------------------------------------------------------------------------END NOW PLAYING



;-------------------------
; BUTTONS

[Prev]
Meter=STRING
MeterStyle=StyleButton
X=1
y=53
Text="7"
LeftMouseDownAction=!Execute ["C:\Program Files (x86)\Songbird\songbird.exe" -previous]


[Play]
Meter=STRING
MeterStyle=StyleButton
Text="4"
y=54
x=34
LeftMouseDownAction=!Execute ["C:\Program Files (x86)\Songbird\songbird.exe" -pause]



[Next]
Meter=STRING
MeterStyle=StyleButton
Text=" 8"
y=54
x=52
LeftMouseDownAction=!Execute ["C:\Program Files (x86)\Songbird\songbird.exe" -next]


here's the whole songbird hexa folder also
http://www.mediafire.com/?slgbfdr8j53oa2i

as you can see it's kind of a frankenstien code now..lol..i guessed options till it all worked.
User avatar
smurfier
Moderator
Posts: 1930
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

The speed of LuaMarquee is completely dependent on the Update of the skin. That is, it moves one character per update. Making it do any different would raise other problems.

Try adding Update=1000 to the Rainmeter section, then gradually lowering the number until the marquee moves the way you want. Once you've done that, Take 1000/YourNumber, Round, and set UpdateDivider=YourNewNumber to the MeasureQuote. This will make sure that the text file isn't being read any more often than it already is.
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
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Script] Lua Marquee

Post by jsmorley »

smurfier wrote:The speed of LuaMarquee is completely dependent on the Update of the skin. That is, it moves one character per update. Making it do any different would raise other problems.
Not for long... 8-)
hkgcry2011
Posts: 1
Joined: October 23rd, 2011, 3:03 am

Re: [Script] Lua Marquee

Post by hkgcry2011 »

can someone teach me how to edit the Marquee.lua that can display japanese...
User avatar
Valentine
Posts: 70
Joined: June 30th, 2011, 11:01 am
Location: Daegu, South Korea

Re: PROOF OF CONCEPT: Lua Marquee

Post by Valentine »

Thank you for useful lua scrip :D
User avatar
smurfier
Moderator
Posts: 1930
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: [Script] Lua Marquee

Post by smurfier »

Updated because I felt like it.
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 . . .
Grantp
Posts: 82
Joined: November 29th, 2010, 5:28 pm

Re: [Script] Lua Marquee

Post by Grantp »

Hi, This seems very useful to me but where do I download the LUA Script I can't see a link anywhere.

Many thanks
Grant
User avatar
smurfier
Moderator
Posts: 1930
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

[Script] Lua Marquee

Post by smurfier »

It's the second text box in the first post. You will need to copy and paste it into a plain text editor and save it there.
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 . . .
Grantp
Posts: 82
Joined: November 29th, 2010, 5:28 pm

Re: [Script] Lua Marquee

Post by Grantp »

That simple.

Thanks.

Grant
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Re: [Script] Lua Marquee

Post by XANCI »

Come up with a simple way, and can use any font:
1.Set W&H in your STRING meter
2.lua code

Code: Select all

function Initialize()
	sText=string.rep(' ',N)..tostring(SKIN:GetVariable("Text"))
	iTextLength=string.len(sText)
	iStart=iTextLength-1
end

function Update()
	iStart=iStart%iTextLength+1
	return string.sub(sText,iStart,iTextLength)
end
the "N" in string.rep represents how many spaces are needed to fill the STRING meter with the given W, you can find it manually and then replace N