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
ArrayList.size() sends multiple times...(help)

 
Post new topic   Reply to topic Printable version
 View previous topic  BOT knowledge wanted Post :: Post duel plugin by mav  View next topic  
Author Message
BDwinsAlt
Agurus's Posse


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

PostPosted: Mon Aug 29, 2005 10:33 am    Post subject: ArrayList.size() sends multiple times...(help) Reply to topic Reply with quote

OK i have this !error command that reports errors for my bot. I want to be able to show Total Errors at the bottom this is what happends:

BDwinsAlt> !errorlist
ST 2.3> 08/28/2005 - BDwinsAlt : test
Total Errors: 1

now watch

BDwinsAlt> !errorlist
ST 2.3> 08/28/2005 - BDwinsAlt : test
ST 2.3> 08/28/2005 - BDwinsAlt : test2
Total Errors: 2
Total Errors: 2

If it has two errors, it sends total errors twice.
How do i stop this? My code is:

for (int i = 0; i < log.size(); i++) {
m_botAction.sendPrivateMessage( name, "Total Errors: " + log.size() );
}
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
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Mon Aug 29, 2005 10:36 am    Post subject: Reply to topic Reply with quote

Just move the 'sendPrivateMessage()' outside the for() loop or remove the for() loop alltogether.
_________________
Nickname: Maverick (I changed my name!)
TWCore developer | Subspace statistics
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: Mon Aug 29, 2005 12:27 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

m_botAction.sendPrivateMessage( name, "Total Errors: " + log.size() );

for (int i = 0; i < log.size(); i++)
{
   m_botAction.sendPrivateMessage( name, "Error #" + (i + 1) + ": " + log.get(i) );
}


Mave was right.
_________________
SubSpace Discretion: A Third Generation SubSpace Client
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 Aug 29, 2005 2:53 pm    Post subject: Reply to topic Reply with quote

Alright ill try it. Thanks.
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
BDwinsAlt
Agurus's Posse


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

PostPosted: Mon Aug 29, 2005 3:05 pm    Post subject: Reply to topic Reply with quote

It worked. Thanks guys. I had it reading from a text file ahaha so it posted it twice anyways. icon_redface.gif I removed the Buffered Reader and now its just an actual log. $$ Thanks guys. You Rock! icon_razz.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
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: Mon Aug 29, 2005 4:43 pm    Post subject: Reply to topic Reply with quote

Ah hah! So Java can't fix all programmer's errors by itself!
_________________
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
BDwinsAlt
Agurus's Posse


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

PostPosted: Mon Aug 29, 2005 6:00 pm    Post subject: Reply to topic Reply with quote

It's free, and so advanced icon_razz.gif What do you expect?
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
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Aug 29, 2005 6:31 pm    Post subject: Reply to topic Reply with quote

I don't know of anything that actually fixes logical errors with any degree of success, cyan icon_wink.gif
_________________

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 Aug 29, 2005 6:36 pm    Post subject: Reply to topic Reply with quote

sa_tongue.gif I love you.
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
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Aug 29, 2005 6:38 pm    Post subject: Reply to topic Reply with quote

(he's kidding of course)

Cyan, you should make a program that's actually just you going through correcting errors and writing the rest of the code. I would use that program like every day.
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 Aug 29, 2005 6:44 pm    Post subject: Reply to topic Reply with quote

I never said i was kidding icon_lol.gif
lol just playing. But i really look up to you. Your cool in my eyes.
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
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Mon Aug 29, 2005 6:44 pm    Post subject: Reply to topic Reply with quote

I meant cyan was kidding, and thank you biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
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 Aug 30, 2005 3:57 pm    Post subject: Reply to topic Reply with quote

Lol. What would it say if you used Java? "Get a real language, retard."
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: Tue Aug 30, 2005 6:43 pm    Post subject: Reply to topic Reply with quote

How is any of it real? Its all virtual anyways sa_tongue.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
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Tue Aug 30, 2005 8:05 pm    Post subject: Reply to topic Reply with quote

This reminds me of one of my more favorite quotes.

Charles Babbage wrote:
On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
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: Tue Aug 30, 2005 8:55 pm    Post subject: Reply to topic Reply with quote

I like marshmallows icon_confused.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
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
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: 61 page(s) served in previous 5 minutes.

phpBB Created this page in 0.482875 seconds : 40 queries executed (93.0%): GZIP compression disabled