Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, Power_P), 1,065 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Second/Time question [Re: DestroyTheRunner] #223860
08/27/08 00:04
08/27/08 00:04

C
cemetarycat
Unregistered
cemetarycat
Unregistered
C




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.

Code:
 ////////////////////////////////////////////////////////////////////
#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
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
lol, you'll need some kind of preset seconds to check
Code:
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
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
!?
It was tested a bit.
Code:
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 Offline OP
Member
DestroyTheRunner  Offline 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 smile smile

Re: Second/Time question [Re: DestroyTheRunner] #224359
08/29/08 18:56
08/29/08 18:56
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

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.
Quote:
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 Offline
Senior Member
Bot190  Offline
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: Bot190] #224518
08/30/08 17:25
08/30/08 17:25
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
The only time it will pause the whole game is if you have everything being updated from 1 function, which has the wait(-1) in...

Do you know about creating/calling seperate functions, of which 1 could just be a simple clock?

Re: Second/Time question [Re: MrGuest] #224876
09/01/08 19:03
09/01/08 19:03
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
omg!
im so stupid...
thats it, it is easier just to call it in another function...
crazy

Code:
function stupid_function()
{
   while(1)
   {
   seconds += 1;
   wait(-1);
   }   
}

simple frown

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 Offline
Senior Member
sadsack  Offline
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

Re: Second/Time question [Re: sadsack] #225917
09/06/08 17:34
09/06/08 17:34
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
just use a panel with total_secs in a digits element...

something like...

PANEL* total_time =
{
pos_x=0;
pos_y=0;
layer=1;
digits(0,0,5,*,1,total_secs);
flags = VISIBLE;
}

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1