Hi people today i want to make a binary clock!,
but i have a problem, can bennu read sys info linke Hours Minutes Sec? or date?
and another question, there is some binary translate func in bennu?
thanx ;)
There are some date and time functions in bennu. Mod_time has the ftime function, see http://wiki.bennugd.org/index.php?title=Mod_time (http://wiki.bennugd.org/index.php?title=Mod_time) for details. I don't know much about binary math operations since I never needed to work on bit level.
thanx ;)
but i had a problem:
http://imageshack.us/photo/my-images/196/scee.jpg/
I see you made a typo. Change mod_timer into mod_timers. That should fix it.
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
Process Main();
Private
String timestring; // The string holding the formatted time
Begin
write_string(0,0,0,0,×tring); // Display the timestring
timer = 100; // Make it so it updates the timestring immediately
Repeat
if(timer>100) // Update the timestring every 1 second
timer = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
Until(key(_esc))
End
other error:
Looks like your editor replaced "timestring" with "×tring".
Quote from: Sandman on June 04, 2011, 09:13:42 AM
Looks like your editor replaced "timestring" with "×tring".
I think that's an & sign which the code-highlight converted wrong.
what i need to do, for starting that example?
Try this instead
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
Process Main();
Private
String timestring; // The string holding the formatted time
Begin
write_string(0,0,0,0,timestring); // Display the timestring
timer = 100; // Make it so it updates the timestring immediately
Repeat
if(timer>100) // Update the timestring every 1 second
timer = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
Until(key(_esc))
End
I think the & sign in write() gave you the error
Quote:11: error: Data type not accepted here ( token error: "timestring" ).
use write() instead of write_string().
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
Process Main();
Private
String timestring; // The string holding the formatted time
timer;
Begin
write(0,0,0,0,timestring); // Display the timestring
timer = 100; // Make it so it updates the timestring immediately
Repeat
if(timer>100) // Update the timestring every 1 second
timer = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
Until(key(_esc))
End
in that version have'nt cmd error, but i see just a window all black
Quote from: Zip on June 06, 2011, 01:47:45 PM
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
Process Main();
Private
String timestring; // The string holding the formatted time
timer;
Begin
write(0,0,0,0,timestring); // Display the timestring
timer = 100; // Make it so it updates the timestring immediately
Repeat
if(timer>100) // Update the timestring every 1 second
timer = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
Until(key(_esc))
End
in that version have'nt cmd error, but i see just a window all black
Well you have to initialize the window first with set_mode()
no thats not the problem..
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
process Main();
private
String timestring; // The string holding the formatted time
timer;
begin
set_mode(320,240,16);
write(0,0,0,0,timestring); // Display the timestring
timer = 100; // Make it so it updates the timestring immediately
repeat
if(timer>100) // Update the timestring every 1 second
timer = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
until(key(_esc))
let_me_alone();
end
its same.. black little window whitout string of text :/
write(0,0,0,0,timestring);
does not update, just writes the text as it is when you call it. You need
write_string(0,0,0,0,×tring);
We can only conclude the compilation behaviour of Bennu has changed. The problem here is that Bennu handled references to arrays as though it were referencing the first elements. Thus timer was read as timer[0]. However, this version (don't know from which) does not do this. This means that it now gives a type error, because you try to compare an int[] and an int. So the solution is to use timer[0] instead of timer. Do not use your own private called timer, because that will not be updated by Bennu.
Correct code:
import "mod_time"
import "mod_timers"
import "mod_text"
import "mod_key"
import "mod_video"
import "mod_proc"
process Main();
private
String timestring; // The string holding the formatted time
begin
write_string(0,10,10,0,& timestring); // Display the timestring (the space after the & is not needed, just to fix the forum display...)
timer[0] = 100; // Make it so it updates the timestring immediately
repeat
if(timer[0]>=100) // Update the timestring every 1 second
timer[0] = 0;
timestring = ftime("%d-%m-%Y %H:%M:%S",time());
end
frame;
until(key(_esc))
let_me_alone();
end
YEA thanx so much now it works
should modify the example in the wiki with that
and for convert in binary there is some module in bennu?