It is currently March 28th, 2024, 9:05 am

How to create crawling text?

Get help with creating, editing & fixing problems with skins
Post Reply
Ornlu Wolfjarl
Posts: 3
Joined: October 14th, 2014, 1:24 am

How to create crawling text?

Post by Ornlu Wolfjarl »

Hello, I recently downloaded Rainmeter and started playing around with it. I'm a novice when it comes to creating visual effects using code (did some very brief experimenting with POVRay a long time ago). I want to create a box at the bottom of my screen, which will show text crawling from right to left (English is not my first language and I have no idea if I'm using the right terminology here: Basically I want to make sort of what you see during news shows, where at the bottom of the screen there's headlines running along).

Basically I want to create a desktop that would simulate a Space Marine helmet HUD, and the crawling text would be various W40K quotes and other inspirational stuff meant to be seen by the Space Marine while in combat. If you have any other tips in helping me do this, they would be welcome. I'm using a basic Enigma skin currently to experiment, and I think a modified version of that will be the main interface and will act as the targeting reticle in the grand scheme of how my desktop will look.

Thank you!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: How to create crawling text?

Post by eclectic-tech »

Here is a great tool to get crawling text... lua marquee by smurfier
Ornlu Wolfjarl
Posts: 3
Joined: October 14th, 2014, 1:24 am

Re: How to create crawling text?

Post by Ornlu Wolfjarl »

eclectic-tech wrote:Here is a great tool to get crawling text... lua marquee by smurfier
Thank you very much!
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

And here 's a solution without using lua. The first code moves the text horizontaly, the second verticaly.
Horizontaly:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
Update=100
MouseActionCursor=1

[Variables]
TextWidth=140
SkinWidth=160
Txt=Example skin

;----------------------------------------

[MeterText]
Meter=String
X=[MeasureX]
Y=5
W=[BinActionWidth]
H=30
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
Text=#Txt#
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
and verticaly:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
Update=100
MouseActionCursor=1

[Variables]
TextWidth=140
SkinWidth=160
Txt=Example skin

;----------------------------------------

[MeterText]
Meter=String
X=25
Y=[MeasureX]
W=50
H=[BinActionWidth]
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
Text=#Txt# 
Angle=1.5707963267948966192313216916398
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
Of course, you can play arround to create a background. I'd do that with an image meter, using a solidcolor.
Ornlu Wolfjarl
Posts: 3
Joined: October 14th, 2014, 1:24 am

Re: How to create crawling text?

Post by Ornlu Wolfjarl »

Thank you!
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

Hi,
I want to enter the above code (horizontal version) into my wheater skin to run the name of the city. I tried but the city is running twice and then disappears and Rainmeter blocks and closes.
What's the problem?

This is the code:

Code: Select all

[Rainmeter]
Author=xenium
Update=100
MouseActionCursor=1

[Variables]
TextWidth=140
SkinWidth=160


URL=https://www.foreca.com/Japan/Tokyo?tenday
URL1=https://www.foreca.com/Japan/Tokyo

;----------------------------------------


[MeasureName]
Measure=Plugin
Plugin=Plugins/WebParser.dll
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1


[image]
meter=image
imagename=rain.png
x=0
y=0
w=160


[MeterText]
Meter=String
MeasureName=MeasureName
X=[MeasureX]
Y=5
W=[BinActionWidth]
H=30
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
DynamicVariables=1


[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 3 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
Thanks
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: How to create crawling text?

Post by eclectic-tech »

You modified the amount of change on every update from adding 1 to adding 3 in the [MeasureTimer] section...
This causes the 'IfEqualValue' in the [BinActionRefresh] section to never fire a '!Refresh', because the count skips right over when you add 3 on every update.

The simplest solution would be to add IfAboveValue to [BinActionRefresh] to test if the value is above...

Code: Select all

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )
IfAboveAction=!Refresh
IfAboveValue=( 2 * #SkinWidth# )
Using IfCondition would be another way of doing this (at the time this code was posted, IfCondition was not available).
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

eclectic-tech wrote:You modified the amount of change on every update from adding 1 to adding 3 in the [MeasureTimer] section...
This causes the 'IfEqualValue' in the [BinActionRefresh] section to never fire a '!Refresh', because the count skips right over when you add 3 on every update.

The simplest solution would be to add IfAboveValue to [BinActionRefresh] to test if the value is above...

Code: Select all

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )
IfAboveAction=!Refresh
IfAboveValue=( 2 * #SkinWidth# )
Using IfCondition would be another way of doing this (at the time this code was posted, IfCondition was not available).
This isn't a good solution (sorry eclectic-tech - this is my opinion), because usually it's not a good idea to refresh the skins and especially the skins using WebParser measure(s). The initial code was written for a static string, set up in the [Variables] section, as the Txt variable. But here things are different, I'd renounce to the continuous refresh.
After the initial skin was written, a lot of new features was added to Rainmeter. Using these, the code can be easily improved.
Right now I'm working on it, immediately I'll post an updated code.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5380
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: How to create crawling text?

Post by eclectic-tech »

Well it's about time you updated this! ;-)

I was offering the simplest solution for the OP ...
Yes, there are new ways to achieve this, as I am sure your new approach will show... :Watching:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to create crawling text?

Post by balala »

eclectic-tech wrote:I was offering the simplest solution for the OP ...
Yeah, but I don't see it a good one, even if it's the simplest. Described above why.
Post Reply