Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
java eclapsed time.
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  Is there a way to turn bullets off..? Post :: Post Dynamic arena?  View next topic  
Author Message
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Sep 22, 2005 8:32 pm    Post subject: Reply to topic Reply with quote

Easy answer: write your bots in a real language. icon_cool.gif
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Sep 22, 2005 9:48 pm    Post subject: Reply to topic Reply with quote

It uses the same operating system calls as the C equivelent, Ekted. So quit your moaning.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Sep 23, 2005 10:41 am    Post subject: Reply to topic Reply with quote

Then why are we having this discussion? Just use GetTickCount(). Problem solved. End of thread.
Back to top
View users profile Send private message Add User to Ignore List
Cerium@school
Guest


Offline

PostPosted: Fri Sep 23, 2005 11:09 am    Post subject: Reply to topic Reply with quote

Theyre debating the usefullness of the system tick count vs system time. Java 1.5 seems to be able to get both, but 1.4.x and prior only have the system time available.

As its already been said, stop worrying about a few isolated cases where the system clock will change and just implement the basic uptime.

Code: Show/Hide

long lngStart = System.currentTimeMillis();

public long getUptime() { return System.currentTimeMillis() - lngStart; }
Back to top
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Sep 23, 2005 12:32 pm    Post subject: Reply to topic Reply with quote

in C/C++ I'd just use time(0) to get the seconds, since he's uninteresting in milliseconds and this value won't overflow for many years.
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Sep 23, 2005 3:52 pm    Post subject: Reply to topic Reply with quote

I had the same idea myself. You might want to give that sig an alpha layer though.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Sep 23, 2005 8:16 pm    Post subject: Reply to topic Reply with quote

any open source Transparent GIF editor (or PNG, I suppose)? I wish I could do it in paint, but I suppose no program's perfect. GIMP refuses to install on my computer.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Sep 23, 2005 10:06 pm    Post subject: Reply to topic Reply with quote

Sorry, I couldn't get it exactly right, but this one should be better. (Works in FF, but IE still can't handle PNG transparency.)



better

size2.png - 4.42 KB
File downloaded or viewed 21 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
cypher@lazy
Guest


Offline

PostPosted: Fri Sep 23, 2005 10:49 pm    Post subject: Reply to topic Reply with quote

You can make transparent PNGs easily w/ php w/ use of the GD2 extension; which is pretty sweet. icon_smile.gif
Back to top
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sat Sep 24, 2005 4:08 am    Post subject: Reply to topic Reply with quote

Good work. Windows still craps out trying to preview it, but it works on Firefox. What did you use to create it?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Sep 24, 2005 10:31 am    Post subject: Reply to topic Reply with quote

GIMP. icon_biggrin.gif You should really get that to install...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Sep 26, 2005 8:17 am    Post subject: Reply to topic Reply with quote

I figured it out on my own. It looked to simple so i thought it was wrong.
icon_redface.gif

Heres my code.
Code: Show/Hide

long startTime = System.currentTimeMillis();
..........................................
..........................................
public void buptime(String name, String msg){
            long difference = System.currentTimeMillis() - startTime;
            int days = (int)(Math.floor(difference/1000/60/60/24));
         int hours = (int)(Math.round( (difference/60/60 % 24000)/1000));
            int minutes = (int)Math.round( (difference/60 % 60000)/1000 );
            int seconds = (int)Math.round( (difference % 60000)/1000 );
            m_botAction.sendPrivateMessage( name, "Bot has been up for " + days + " day(s) " + hours + " hour(s) " + minutes + " minute(s) and " + seconds + " second(s)." );
            }


Thanks guys.

P.S.: When my new pc comes in and I install my Visual C++ CD i will use c++.

I'll still use java to but i'll give C++ a chance.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Mon Sep 26, 2005 9:10 am    Post subject: Reply to topic Reply with quote

Let me just be clear and say that the Java language cannot be held responsible for the above code.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:38
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Mon Sep 26, 2005 10:02 am    Post subject: Reply to topic Reply with quote

Indeed, don't blame the languages for your sucking on programming.
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Sep 26, 2005 7:59 pm    Post subject: Reply to topic Reply with quote

sa_tongue.gif LOL.

What ever. It works...
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Mon Sep 26, 2005 8:25 pm    Post subject: Reply to topic Reply with quote

yeah, it works fine. no need to wrap Dates around something as simple as this
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Sep 26, 2005 10:49 pm    Post subject: Reply to topic Reply with quote

I agree with Bak.
Unless he's being sarcastic icon_lol.gif ...

Im still new to java so if their's an easier way to do something let me know. I plan to actually stop and buy a few books around Chirstmas. Right now all i know is wha i've learned in about 2 months i guess. icon_redface.gif

Im used to doing things with Trial and Error. icon_rolleyes.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Sep 27, 2005 2:13 am    Post subject: Reply to topic Reply with quote

Add in a touch of common sense and youll be a lot better off. For instance, most people hate doing lots of pointless repetitive math problems; the same can be said about computers.

Im kind of suprised ekted hasnt thrown up on his keyboard and posted something explaining how he was daming your name while cleaning it up.
_________________
There are 7 user(s) ignoring me right now.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Tue Sep 27, 2005 3:11 am    Post subject: Reply to topic Reply with quote

even Java should be able to optimize

difference/1000/60/60/24

to

difference/86400000
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cerium
Server Help Squatter


Age:43
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Tue Sep 27, 2005 2:56 pm    Post subject: Reply to topic Reply with quote

Do you always rely on the compiler to optimize your code?

BD shouldnt get in the habit (or impression) that the compiler can/will always clean up his code.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Tue Sep 27, 2005 3:28 pm    Post subject: Reply to topic Reply with quote

Cerium wrote:
Im kind of suprised ekted hasnt thrown up on his keyboard and posted something explaining how he was daming your name while cleaning it up.


I don't do Java, and haven't been keeping up with this thread. icon_smile.gif

But I will chime in here a bit. I expect the compiler to optimize from line to line. I write code that makes sense, and it will do what is fastest/smallest (based on my compile settings). For example, if I'm multiplying by 4 because that is the formula for something, I prefer to use "* 4" in the code instead of "<< 2". All compilers will handle that. However, you should not expect a compiler to handle optimizations of large blocks where the actual operations are different. For example:

Code: Show/Hide
// this is inferior code

for (i = 0; i < size; i++)
   {
   a = array + i;
   // do something with a
   }

// this is much better

a = array;

for (i = 0; i < size; i++)
   {
   // do something with a
   a++;
   }
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Sep 27, 2005 7:03 pm    Post subject: Reply to topic Reply with quote

Ekted wrote:
For example, if I'm multiplying by 4 because that is the formula for something, I prefer to use "* 4" in the code instead of "<< 2".

Ahh, thank goodness. I get so tired of seeing that shifting crap in people's code.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 25 page(s) served in previous 5 minutes.

phpBB Created this page in 0.676843 seconds : 48 queries executed (79.3%): GZIP compression disabled