Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Kingware, AemStones, RealSerious3D), 1,388 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Second/Time question #223672
08/25/08 21:01
08/25/08 21:01
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
I know its noobish... but I searched over the forum but coundt find it.

Simple thing, I want add 1 to the variable every second BUT without using stuff like, sleep or wait(-1) or total_secs.

here´s the example:
Code:
var seconds;
...
while(1)
{
seconds += ?? ; 
wait(1);
}


I´ve tried stuff like 'seconds = time_step/16' and 'seconds = time_frame/16' but its not acuratte at all.

help?

Last edited by DestroyTheRunner; 08/25/08 21:02.
Re: Second/Time question [Re: DestroyTheRunner] #223712
08/26/08 08:05
08/26/08 08:05
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
you could use sys_seconds maybe

Re: Second/Time question [Re: badapple] #223715
08/26/08 08:26
08/26/08 08:26
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
yeah maybe u can try with sys_seconds.. something like:

var secs;
secs = sys_seconds;
while(secs != sys_seconds)
{
my_variable++;
secs = sys_seconds;
}



not tested .. just giving u an idea.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Second/Time question [Re: delinkx] #223722
08/26/08 08:41
08/26/08 08:41

C
cemetarycat
Unregistered
cemetarycat
Unregistered
C




well, since sys_seconds goes from
0 to 59...which is 1 to 60. wink

when sys_seconds is equal to 59
or even when sys_seconds changes again back to 0
update or add 1 to your variable.

Re: Second/Time question [Re: ] #223726
08/26/08 09:15
08/26/08 09:15
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
Originally Posted By: cemetarycat

well, since sys_seconds goes from
0 to 59...which is 1 to 60. wink

when sys_seconds is equal to 59
or even when sys_seconds changes again back to 0
update or add 1 to your variable.


@cemetarycat:

mate, he wants to count no. of seconds. ur algorithm is for updating every one minute.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Second/Time question [Re: delinkx] #223729
08/26/08 09:26
08/26/08 09:26

C
cemetarycat
Unregistered
cemetarycat
Unregistered
C



meowwww! smile
now I see.


cheers


so get/retrive current system time at run time or perhaps when entering a function..if the algorithm is in function.
assign it as start time.
then count off 1000 milliseconds...since there is 1000 miliseconds in a second. Update your variable.
update your start time then for new current
system time. Repeat.
I have done this in other languages like Blitz3d, Cobra/Cobra 3d, Pure Basic, and even Dark Basic too.

But looking in the online manual
and in the Predefined variables under Time
total_ticks looks good.
but especially the timer function wink









Last edited by cemetarycat; 08/26/08 09:40.
Re: Second/Time question [Re: ] #223742
08/26/08 10:17
08/26/08 10:17

C
cemetarycat
Unregistered
cemetarycat
Unregistered
C




okay,

here is a code snippet.

Code:
 ////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////

var update_var=0;

PANEL* first_pan =
{
	digits (10, 20, 2, *, 1, sys_seconds);
	
	digits(20, 50,4, *, 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;
	video_mode = 7; 
	screen_color.blue = 150;
	
	 start_base=sys_seconds;
	
	while(1)
	{
		if (sys_seconds != start_base)
		{
			update_var+=1;
			start_base=sys_seconds;
			
			
		}
		
		wait(1);
		
	}
	
	
}



and kudos and cheers to delinkx.

Re: Second/Time question [Re: ] #223821
08/26/08 20:21
08/26/08 20:21
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
thanks for all your replies but when I said
Quote:

...BUT without using stuff like, sleep or wait(-1) or total_secs.

I meant I didnt want to use any predefined variable and ,yes through math calculations like "time_step/16" as i read in another random post but doest seem to work.

is this possible to without using the predefined?

thanks smile

Re: Second/Time question [Re: DestroyTheRunner] #223834
08/26/08 21:17
08/26/08 21:17
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
you will still need to use time_step because this will make it where the time is exactly the same all the time unless your framerate is less than 4 or something.

I'm assuming that you want to see the seconds like this: XX.xxx? Is that why you want it like that?


- aka Manslayer101
Re: Second/Time question [Re: mpdeveloper_B] #223843
08/26/08 22:20
08/26/08 22:20
Joined: Aug 2007
Posts: 286
DestroyTheRunner Offline OP
Member
DestroyTheRunner  Offline OP
Member

Joined: Aug 2007
Posts: 286
i think im not expressing myself very clearly.
Im sorry!

lets start over:

how can I add 1 to the variable X every second?
like


X += 1*every second.

without using thoses 'sys_this, sys_that...' predefinedes..

I know ill probably need to use time_step, i just dont want to use those SYS predefines..
smile

Page 1 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