It is currently March 28th, 2024, 3:53 pm

How to create crawling text?

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

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# )
I tried completing you, but the rainmeter is blocking again
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 »

xenium wrote:I tried completing you, but the rainmeter is blocking again
That's normal. It's not a good idea to continuously refresh a skin and especially a skin using WebParser plugins (like this one). Details: https://forum.rainmeter.net/viewtopic.php?p=136507#p136507
And here is another post about the undesirable skin refresh: https://forum.rainmeter.net/viewtopic.php?p=119966#p119966
Working on the solution, come back a bit later.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: How to create crawling text?

Post by eclectic-tech »

balala wrote:Yeah, but I don't see it a good one, even if it's the simplest. Described above why.
Yes, I'm not disagreeing with you (other than times when !Refresh is needed to update after !WriteKeyValue bangs) ...
please go ahead and offer an updated version of YOUR original (non-lua) code from 4 years ago. :17flag :D
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:Yes, I'm not disagreeing with you (other than times when !Refresh is needed to update after !WriteKeyValue bangs) ...
Definitely. I didn't say (or at least I didn't intend to) that the skin(s) should never have to be refreshed. Just that it's not a desirable action and as much as possible, it should be avoided.
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 »

xenium wrote: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?
Here's my workaround:
  • First, the width of the shown string should be set automatically. Setting it manually in this case is hard to be achieved, because the string can change (the same code should have to be used by other users, too). So, remove the not needed TextWidth variable.
  • We also won't need any more any of the [MeasureTimer], [BinActionRefresh] and [BinActionWidth] measures. Remove all of them.
  • Replace the Formula option of the still existing [MeasureX] measure, with the following one: Formula=( COUNTER % ( #SkinWidth# + [MeterText:W] )). This formula requires to also add the DynamicVariables=1 option to the same [MeasureX] measure. Don't forget it.
  • Replace the X option of the [MeterText] meter, with the following one: X=(#SkinWidth#-[MeasureX]). Also remove the W and H options of the same meter.
  • The last step you have to do is to set up the proper width of the skin. Add the SkinWidth=#SkinWidth# option to the [Rainmeter] section of the skin.
I think that's all. Now the skin doesn't refresh at all.
Please let me know if you was able to make all needed changes to your code and if it does work now well.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:Here's my workaround:
  • First, the width of the shown string should be set automatically. Setting it manually in this case is hard to be achieved, because the string can change (the same code should have to be used by other users, too). So, remove the not needed TextWidth variable.
  • We also won't need any more any of the [MeasureTimer], [BinActionRefresh] and [BinActionWidth] measures. Remove all of them.
  • Replace the Formula option of the still existing [MeasureX] measure, with the following one: Formula=( COUNTER % ( #SkinWidth# + [MeterText:W] )). This formula requires to also add the DynamicVariables=1 option to the same [MeasureX] measure. Don't forget it.
  • Replace the X option of the [MeterText] meter, with the following one: X=(#SkinWidth#-[MeasureX]). Also remove the W and H options of the same meter.
  • The last step you have to do is to set up the proper width of the skin. Add the SkinWidth=#SkinWidth# option to the [Rainmeter] section of the skin.
I think that's all. Now the skin doesn't refresh at all.
Please let me know if you was able to make all needed changes to your code and if it does work now well.
it works! :17good
I let it run for about 10 minutes to see if Rainmeter is blocking :D
Can I also set the running speed?
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 »

xenium wrote:Can I also set the running speed?
I've started to write my reply about this, when you asked. It can easily be modified.
So, if you want to speed up the movement of the string, first add the Speed variable to the [Variables] section. This will be a generic number, which the larger is, the more the scrolling speed of the string will be higher:

Code: Select all

[Variables]
...
Speed=3
Obviously Speed=3 is just an example, feel free to experiment to find the best value for your needs.
Now replace the Formula option of the [MeasureX] measure, with the following one: Formula=(( #Speed# * COUNTER ) % ( #SkinWidth# + [MeterText:W] ))
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: How to create crawling text?

Post by xenium »

balala wrote:I've started to write my reply about this, when you asked. It can easily be modified.
So, if you want to speed up the movement of the string, first add the Speed variable to the [Variables] section. This will be a generic number, which the larger is, the more the scrolling speed of the string will be higher:

Code: Select all

[Variables]
...
Speed=3
Obviously Speed=3 is just an example, feel free to experiment to find the best value for your needs.
Now replace the Formula option of the [MeasureX] measure, with the following one: Formula=(( #Speed# * COUNTER ) % ( #SkinWidth# + [MeterText:W] ))
That's great !
Thank you very much for your help !
:welcome: :welcome:
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 »

You're welcome. It's always a pleasure to help, when I can.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: How to create crawling text?

Post by eclectic-tech »

:17nodding As a courtesy, here are balala's updated examples :17good

Horizontal scrolling text

Code: Select all

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

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

[Variables]
Txt=Example skin to demonstrate horizontal scroll effect.
SkinWidth=160
Speed=3

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

[MeterText]
Meter=String
X=(#SkinWidth#-[MeasureX])
Y=5
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
SolidColor=0,0,0,1
AntiAlias=1
Text=#Txt#
DynamicVariables=1

[MeasureX]
Measure=Calc
Formula=( #Speed# * COUNTER % ( #SkinWidth# + [MeterText:W] ))
DynamicVariables=1

Vertical scrolling text

Code: Select all

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

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

[Variables]
SkinHeight=160
Txt=Example skin to demonstrate vertical scroll effect.
Speed=3

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

[MeterText]
Meter=String
X=25
Y=(#SkinHeight#-[MeasureY])
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=255,255,255
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
SolidColor=0,0,0,1
AntiAlias=1
Text=#Txt#
Angle=(Rad(90))
DynamicVariables=1

[MeasureY]
Measure=Calc
Formula=( #Speed# * COUNTER % ( #SkinHeight# + ([MeterText:W] )))
DynamicVariables=1

Very nicely done! :17group
Post Reply