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 (VoroneTZ, 7th_zorro), 1,071 guests, and 5 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
3dgs button logging #462974
11/09/16 11:25
11/09/16 11:25
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Hi everyone,
I want to save log files in my project. I want to save duration of use; button show time and button click time logs, also log time between them.
How can I do this?

Re: 3dgs button logging [Re: gamers] #462981
11/09/16 14:50
11/09/16 14:50
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi gamers,

For automatically logging general startup and usage info use diag_mode (diag_mode = 1; or diag_mode = 2; , see the manual for this).

Besides that, you can manually create log files by simply writing to a text file (in the manual see Engine Functions -> File Manipulation and than file_str_write etc). Under Engine Variables see 'Time' and 'Statistics' for usefull info for logging/debugging. I am not sure how to get 'button show time' or 'button click time', maybe 'time_panels' or 'time_actions' if you dont have other functions running on the background. Or calculate it manually ofcourse.
(note from the manual for statistic variables: "This variable is valid for the topmost view and only available in the development version, not in the release version.")

Does that help?

Last edited by Reconnoiter; 11/09/16 14:51.
Re: 3dgs button logging [Re: Reconnoiter] #463072
11/13/16 13:00
11/13/16 13:00
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Hi Reconnoiter,
Thanks for reply,
Is there any tutorial to create this system you know?

Re: 3dgs button logging [Re: gamers] #463074
11/13/16 16:24
11/13/16 16:24
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi gamers,

Not really that I know off (you could check AUM magazine ofcourse, see left bar of this site). Besides that you could check how long a panel (which contains the button object) is visible and store that somewhere. As for 'button click time', I dont entirely get what you mean with this but maybe store the time in your button function increase the time (in a loop) till the user released the left mouse button (mouse_left).
What is it your are trying to accomplish?

Also you use the variable 'total_secs' to save duration of total use of the application.

Last edited by Reconnoiter; 11/13/16 16:25.
Re: 3dgs button logging [Re: Reconnoiter] #463080
11/14/16 08:07
11/14/16 08:07
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Hi Reconnoiter,
I want to save keystroke counts in a log file, especially for some keys such as key a and key l. Also I want to save the data that while a panel appears and users click a key to close this panel screen and I want to save time these two between events (panel appears time --> keystroke to close panel time).

Re: 3dgs button logging [Re: gamers] #463083
11/14/16 11:03
11/14/16 11:03
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Oh keystrokes, I thought with button you meant literally the button element which panels can have.
To check which key the user pressed last use 'key_lastpressed'. See the manual for more info (Engine Variables -> Input/output -> Keyboard -> key_lastpressed).

Quote:
Also I want to save the data that while a panel appears and users click a key to close this panel screen and I want to save time these two between events (panel appears time --> keystroke to close panel time).
, there are a few ways. First you will have to know when the panel is shown. Most easiest is to just check in a while loop (like the one from your Main function) if the panel is shown, and when shown begin a timer till the panel is closed. When the panel is closed you can save the timer variable somewhere. Example:

Code:
function Main () {
   ....
  var timer = 0;

while (1) {
 ...
 if (is(myPanel, SHOW)) {
    timer += time_step / 16; //add 1 point per sec
 }
 else { //panel is not shown?
   if (timer > 0) { //timer was started and panel is closed?
     ....save timer variable somewhere...
     timer = 0; //reset
   }
 }

 wait(1);
}

}


Re: 3dgs button logging [Re: Reconnoiter] #463100
11/15/16 06:06
11/15/16 06:06
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
I would use acknex log file.

Code:
#include <acknex.h>

STRING *strDiag = "#128";

void keyLog ( var _key )
{
	str_cpy ( strDiag, "" );
	str_cat_num ( strDiag, "\n%06.0f", total_ticks );
	str_cat_num ( strDiag, " (%03.0f) ", _key );
	STRING *_strKey = str_for_key ( NULL, _key );
	if ( _strKey )
	{
		str_cat ( strDiag, _strKey );
		str_cat ( strDiag, " " );
	}
	str_cat ( strDiag, "hit" );
	diag ( strDiag->chars );
	
	var _timer = total_ticks;
	while ( key_pressed ( _key ) )
		wait(1);
	var _secs = ( total_ticks - _timer ) / 16;
	
	str_cpy ( strDiag, "" );
	str_cat_num ( strDiag, "\n%06.0f", total_ticks );
	str_cat_num ( strDiag, " (%03.0f) ", _key );
	_strKey = str_for_key ( NULL, _key );
	if ( _strKey )
	{
		str_cat ( strDiag, _strKey );
		str_cat ( strDiag, " " );
	}
	str_cat_num ( strDiag, "released, %.3f seconds held", _secs );
	diag ( strDiag->chars );
}

void main ()
{
	var lastOld = key_lastpressed;
	while ( 1 )
	{
		if ( lastOld != key_lastpressed )
		{
			keyLog ( key_lastpressed );
			lastOld = key_lastpressed;
		}
		wait(1);
	}
}



Salud!

Re: 3dgs button logging [Re: txesmi] #463144
11/17/16 11:02
11/17/16 11:02
Joined: Jan 2012
Posts: 108
G
gamers Offline OP
Member
gamers  Offline OP
Member
G

Joined: Jan 2012
Posts: 108
Thanks for replies, yo're wonderful laugh


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