1 registered members (3s05bmmc),
745
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Serious User
|
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: gamers]
#463074
11/13/16 16:24
11/13/16 16:24
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
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: gamers]
#463083
11/14/16 11:03
11/14/16 11:03
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
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). 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:
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
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
Hi, I would use acknex log file.
#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!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|