How do I change a text according to time of day?

Get help using Construct 2

Post » Tue Nov 18, 2014 12:22 pm

Good day!

I've got a question regarding time of day. Is it possible to change text according to the time of day? I want to greet the player with a piece of text according to the time of day, like. Let's say somebody's playing during the morning it should say 'Good morning, [username]'. Or if the player is playing during the afternoon it should be 'Good afternoon, [username]'. Is there a way to do this with or without JavaScript? Any type of advice would be greatly appreciated!

Kind regards,

AngusMcfife
B
5
S
1
Posts: 9
Reputation: 343

Post » Tue Nov 18, 2014 12:58 pm

Insert a browser object in your layout.
Then, you can use this value : Browser.ExecJS("new Date().getHours()") that return the current hour of the day.
More informations about Date() methods : http://www.w3schools.com/jsref/jsref_obj_date.asp

And... Beware of the unicorn invasions ! \m/
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Nov 18, 2014 2:25 pm

Work it out with this demo
You do not have the required permissions to view the files attached to this post.
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Post » Tue Nov 18, 2014 2:36 pm

Your example needs plugins (date and lunar by rex.rainbow).
I didn't manage to find their download link on the "official" page.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Post » Tue Nov 18, 2014 3:24 pm

Yes I know but I didn't find any download link :o
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Nov 18, 2014 3:46 pm

Coin try this link all you do is scroll down to Date and click on it it will take you to Rex add on

search.php?keywords=Date&t=65170&sf=msgonly

or Rex main

http://c2rexplugins.weebly.com/rex_time_away.html
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Post » Tue Nov 18, 2014 4:10 pm

Yes but as I said I can't find the actual plugin file on these pages :l Can you upload yours somewhere ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Nov 18, 2014 4:38 pm

I see what I can do for you or just pm Rex and he be happy to help you dear friend
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Post » Tue Nov 18, 2014 4:42 pm

I have also sent Rex message on behalf of you Coin-coin le Canapin
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Next

Return to How do I....?

Who is online

Users browsing this forum: wizdigitech, Zamargo and 14 guests