Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Javascript Clock in browser game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Wiezerzz
Expert Cheater
Reputation: 1

Joined: 09 Sep 2007
Posts: 242
Location: Java coding atm..

PostPosted: Sat Apr 11, 2009 3:34 am    Post subject: Javascript Clock in browser game Reply with quote

kk dude uhm lets start here is a code of a javascript clock i want to speed up the clock. the game is a browser name called "Bulletstar"

Code:


<script type="text/javascript">
                         var timer = null
                         function stop() { clearTimeout(timer) }
                         function start() {
                          var currenttime = 'April 11, 2009 11:19:26'
                          var servertijd  = new Date(currenttime)
                          var time = new Date()
                          var hours = time.getHours()
                          var minutes = time.getMinutes()
                          minutes=((minutes < 10) ? "0" : "") + minutes
                          var seconds = time.getSeconds()
                          seconds=((seconds < 10) ? "0" : "") + seconds
                          var clock = hours + ":" + minutes + ":" + seconds
                          document.getElementById('displayklok').value = clock
                          timer = setTimeout("start()",1000)
                         }
            </script>



Code:

timer = setTimeout("start()",1000)


How can i change this to like 1second = 2 minutes?

_________________


Also know as Bruqaj.
Back to top
View user's profile Send private message MSN Messenger
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Sat Apr 11, 2009 7:46 am    Post subject: Re: Javascript Clock in browser game Reply with quote

bruqaj wrote:
Code:

timer = setTimeout("start()",1000)


How can i change this to like 1second = 2 minutes?

See the 1000 in "start()",1000)? That means 1000 milliseconds = 1 second. 2 minutes = 120 seconds = 120000 milliseconds.
Back to top
View user's profile Send private message Visit poster's website
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1373

PostPosted: Sun Apr 12, 2009 11:14 am    Post subject: Re: Javascript Clock in browser game Reply with quote

talker0 wrote:
bruqaj wrote:
Code:

timer = setTimeout("start()",1000)


How can i change this to like 1second = 2 minutes?

See the 1000 in "start()",1000)? That means 1000 milliseconds = 1 second. 2 minutes = 120 seconds = 120000 milliseconds.

Also you dont use timeout when creating a timer, you use interval.

Code:
timer = setInterval("start()",1000);

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Wiezerzz
Expert Cheater
Reputation: 1

Joined: 09 Sep 2007
Posts: 242
Location: Java coding atm..

PostPosted: Sun Apr 12, 2009 1:23 pm    Post subject: Re: Javascript Clock in browser game Reply with quote

is it possible to change the timeout with a javascript in the browser?
_________________


Also know as Bruqaj.
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1373

PostPosted: Tue Apr 14, 2009 5:44 am    Post subject: Re: Javascript Clock in browser game Reply with quote

bruqaj wrote:
is it possible to change the timeout with a javascript in the browser?

TimeOut is only executed once. Why would you wanna use TimeOut for a clock? And yes, javascripts are client sided so it would be possible.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Tue Apr 14, 2009 8:58 am    Post subject: Re: Javascript Clock in browser game Reply with quote

ثك&am wrote:
Also you dont use timeout when creating a timer, you use interval.

Code:
timer = setInterval("start()",1000);


If you used interval you'd need to move its position and change the stop function too
Code:
<script type="text/javascript">
var timer = null;
function stop() { timer = window.clearInterval(timer) }
function start() {
  var currenttime = 'April 11, 2009 11:19:26',
      servertijd  = new Date(currenttime),
      time = new Date(),
      hours = time.getHours(),
      minutes = time.getMinutes(),
      seconds = time.getSeconds();
  minutes=((minutes < 10) ? "0" : "") + minutes;
  seconds=((seconds < 10) ? "0" : "") + seconds;
  var clock = hours + ":" + minutes + ":" + seconds;
  document.getElementById('displayklok').value = clock;
}
timer = setInterval("start()",120000);
</script>
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Thu Apr 16, 2009 12:04 am    Post subject: Reply with quote

look up firebug. it's for firefox. it lets you change html in real time.
_________________
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)