It is currently May 2nd, 2024, 2:40 pm

[Solved] Randomized greeting based on array?

Get help with creating, editing & fixing problems with skins
firefiber
Posts: 22
Joined: January 11th, 2013, 7:25 am

[Solved] Randomized greeting based on array?

Post by firefiber »

Hi.

I recently tried to create a welcome message, every time I log on. It'll display for a few seconds, and hide itself. This works out great. But I want to do more with it.

Is it possible to randomize the greeting message with a set number of words in an array?
Currently, it just says "Hello, [my name]".

Is it possible to store an array of greeting words in other languages (for example, like how Flickr does it or even Wordpress), where they'd display something like "Ola, [name]!" and then the next time display "Hello, [name]", and so on, in a set number of different languages.

What I would want to do is to store these words in an array (the different translations of "hello"), and then randomize it, each time the skin loads.

Any possible way to do this?
Last edited by firefiber on January 11th, 2013, 9:09 pm, edited 1 time in total.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Randomized greeting based on array?

Post by moshi »

definitely possible.
have a look at the quote plugin: http://docs.rainmeter.net/manual/plugins/quote
firefiber
Posts: 22
Joined: January 11th, 2013, 7:25 am

Re: Randomized greeting based on array?

Post by firefiber »

Thanks!

I just tried it right now, and I'm probably doing it wrong. Here's my code:

[Rainmeter]
Update=1000

[MeasureQuote]
Measure=Plugin
Plugin=QuotePlugin
PathName=%HOMEDRIVE%%HOMEPATH%\My Documents\Test
Subfolders=1
FileFilter=*.txt

[MeterQuote]
Meter=String
MeasureName=MeasureQuote
X=0
Y=0
W=200
H=200

The lines in red are the ones I changed from the example code given. All it displays is the path of the random.txt file I placed inside the Test folder I created.

What am I doing wrong?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Randomized greeting based on array?

Post by jsmorley »

Quote plugin does two things depending on the options you set:

1) Returns a random file name from a folder / subfolders
2) Returns a random line from a file

You are using options that make it understand you want 1) above...

If you just say:

Code: Select all

[Rainmeter]
Update=1000

[MeasureQuote]
Measure=Plugin
Plugin=QuotePlugin
PathName=%HOMEDRIVE%%HOMEPATH%\My Documents\Test.txt

[MeterQuote]
Meter=String
MeasureName=MeasureQuote
X=0
Y=0
W=200
H=200
It should work fine to return a random line from Test.txt.

P.S. You are probably going to want some UpdateDivider= option on the measure, as I'm sure you don't want a new random line once a second.
firefiber
Posts: 22
Joined: January 11th, 2013, 7:25 am

Re: Randomized greeting based on array?

Post by firefiber »

Yay! Got it to work, thanks guys!

One last question, is there a way to delay the skin from appearing? Say, for instance, 2 seconds after the computer has logged on, I want it to display a string, or whatever.
I know how to hide it using a counter, but any way to hide by default, and show after a certain amount of time?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Randomized greeting based on array?

Post by smurfier »

Code: Select all

[Rainmeter]
Update=1000
OnRefreshAction=!Hide

[Show]
Measure=Calc
Formula=Show+1
IfAboveValue=2
IfAboveAction=[!DisableMeasure #CURRENTSECTION#][!Show][!EnableMeasure Hide]

[Hide]
Measure=Calc
Formula=Hide+1
IfAboveValue=10
IfAboveAction=[!DisableMeasure #CURRENTSECTION#][!Hide]
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 . . .