Getting actual time

Get help using Construct 2

Post » Thu Mar 21, 2013 8:17 pm

I was hoping there was some way to do this too.

Hopefully it's something that will be possible in future updates.
B
35
S
6
G
2
Posts: 121
Reputation: 3,585

Post » Thu Mar 21, 2013 11:29 pm

There is a way to do this, and now that I'm back at my main PC, I can show you. Here's the demo:

Demo
Capx

The Capx is very simple. It ajax requests a php file that I've set up to return the current US Eastern date/time. If you have your own server set up, you can create a similar set up for your own game. Here's the code used in the php file :

<?php
header('Access-Control-Allow-Origin: *');
date_default_timezone_set("America/New_York");
$datetime=getdate();
echo("$datetime[hours]:$datetime[minutes]:$datetime[seconds] $datetime[mon]/$datetime[mday]/$datetime[year] ");
?>


I hope this helps.                  zatyka2013-03-21 23:36:29
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Fri Mar 22, 2013 1:40 am

C2 doesn't offer Clock expression until you send suggestion to Ashley.


Besides there are 2 plugins would help you:

http://www.scirra.com/forum/c2-plugin-clock_topic42660.html


http://www.scirra.com/forum/plugin-system-date-and-time_topic45206.html
B
95
S
25
G
20
Posts: 3,052
Reputation: 22,613

Post » Sat Mar 23, 2013 3:45 pm

Sorry for my delayed reply. Thanks to everyone who responded for the information. And yes, I was looking for a way to get actual real world time to help with time based tasks such as Farmville and other "grinders". Pulling the time from the server via a PHP script is a great solution. Thanks again.
B
5
Posts: 2
Reputation: 1,304

Previous

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, MChiz, plinkie, Radulepy and 0 guests