1 registered members (3s05bmmc),
745
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Second/Time question
[Re: DestroyTheRunner]
#223860
08/27/08 00:04
08/27/08 00:04
|
cemetarycat
Unregistered
|
cemetarycat
Unregistered
|
I think its the timer function. var start_base=timer(); and it returns in microseconds rather in milliseconds. But the same principle is the same to count and measure them. and here is the code. try different values for the literal number value that is added to start_base. ////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
var update_var;
PANEL* first_pan =
{
digits (10, 20, 2, *, 1, sys_seconds);
digits(20,100, 10.2, *, 1, update_var);
digits ( 70, 200, 2, *, 1, sys_hours);
digits ( 90, 200, 2, *, 1, sys_minutes);
digits ( 110, 200, 2, *, 1, sys_seconds);
flags = VISIBLE;
}
/////////////////////////////////////////////////////////////////////
function main()
{
var start_base=timer();
video_mode = 7;
screen_color.blue = 150;
while(1)
{
if ( ( timer()>start_base+5000) )
{
update_var+=1;
start_base=timer();
}
wait(1);
}
} cheers
|
|
|
Re: Second/Time question
[Re: DestroyTheRunner]
#223895
08/27/08 15:07
08/27/08 15:07
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
lol, you'll need some kind of preset seconds to check
var global_timer = 0;
function fnc_counter(){
while(1){
global_timer += 1;
wait(-1);
}
}
//or
var global_second;
function fnc_counter(){
global_second = sys_seconds;
while(1){
if(sys_seconds != global_second){
//do your function
}
}
} hopefully that's what you're after
|
|
|
Re: Second/Time question
[Re: MrGuest]
#223944
08/27/08 19:26
08/27/08 19:26
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
!? It was tested a bit.
var tm_n1 = 0;
var tm_n2 = 0;
var tm_n3 = 0;
function tmf_secNext() {
tm_n3 += 1;
//spof_n1("tm_n3: ", tm_n3);
//spof_n1("sys_seconds: ", sys_seconds);
}
function tmf_count() {
while(1) {
tm_n2 = total_ticks / 16;
if ((tm_n2 - tm_n1) > 1) {
tm_n1 = tm_n2;
tmf_secNext();
}
wait(1);
}
}
|
|
|
Re: Second/Time question
[Re: testDummy]
#224345
08/29/08 17:37
08/29/08 17:37
|
Joined: Aug 2007
Posts: 286
DestroyTheRunner
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 286
|
sorry guys , I had some others issues to take care, this 'clock' thing was only for testing purposes. I havent find the answer yet, but im not using lite-c so i dont think i can use stuff like cemeterycat said " #include <acknex.h> #include <default.c> " and i dont want to make my game to 'freeze' one second by calling WAIT(-1) i just wanted to it constantly add seconds to the timer, like for measuring a entire lap in a race game, anyway next week ill be searching in the AUMs I heard there is something about time in there. Thanks for all your replies
|
|
|
Re: Second/Time question
[Re: DestroyTheRunner]
#224359
08/29/08 18:56
08/29/08 18:56
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
Added missing wait(1) in code posted by THIS (above or previous page). Put code which should be run approximately once a sec, in function tmf_secNext!? Quoting DestroyTheRunner. I´ve tried stuff like 'seconds = time_step/16' and 'seconds = time_frame/16' but its not acuratte at all. But not total_ticks / 16!? AUM 16 timer / counter It uses total_ticks also, but 'you' should probably look through each AUM (or use an index) anyway.
|
|
|
Re: Second/Time question
[Re: testDummy]
#224410
08/29/08 23:06
08/29/08 23:06
|
Joined: May 2006
Posts: 398
Bot190
Senior Member
|
Senior Member
Joined: May 2006
Posts: 398
|
as far as i know wait(-1) does not pause the whole game. also, why don't you want to use a predefined variable?
Last edited by Bot190; 08/29/08 23:08.
Wait, there isn't a "Make My Game Now" button?
|
|
|
Re: Second/Time question
[Re: MrGuest]
#224876
09/01/08 19:03
09/01/08 19:03
|
Joined: Aug 2007
Posts: 286
DestroyTheRunner
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 286
|
omg! im so stupid... thats it, it is easier just to call it in another function...
function stupid_function()
{
while(1)
{
seconds += 1;
wait(-1);
}
}
simple sorry make you guys lose your time anwsering this. but thanks!!
|
|
|
Re: Second/Time question
[Re: DestroyTheRunner]
#225913
09/06/08 17:19
09/06/08 17:19
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
What I am looking for is just the time printed out on the screen how long the game/program been running. in lite-c renny
Last edited by sadsack; 09/06/08 17:20.
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
|