Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Java

Name: HALP 2010-04-23 16:09

Sup anon

Hi there,

I am having problems with my IRC bot coded in Java. I can't for the life of me print out the values stored within token[] to print to a single line.

My program consists of 2 classes, a main class "ircbot" and a class "Bot".

The code i am having problems with is

Pattern sayRegex = Pattern.compile("!say", Pattern.CASE_INSENSITIVE);
                Matcher say = sayRegex.matcher(currLine);
                if (say.find() && ownership.find()) {
                    String[] token = currLine.split(" ");
                    for (int i = 4; i < token.length; i++) {
                        JavaBot.say(token[i]);
                    }
                }

And the "say" function located in the Bot class is

        public void say(String message) throws IOException {
        bw.write("PRIVMSG " + channel + " :" + message + "\n");
        bw.flush();
    }


As you can see, if i were to type !say 1 2 3 4 5 6

The output would be;

1
2
3
4
5
6

How could i print the numbers on the same line?

Thanks

Name: Anonymous 2010-04-23 16:14

Your problem is Java .

Name: Anonymous 2010-04-23 16:24

thanks anon, that must be the problem

Name: Anonymous 2010-04-23 16:34

>>2
you forgot that he forgot the code tags.

Name: Anonymous 2010-04-23 16:55

>protip: never ask 4chan

Name: Anonymous 2010-04-23 16:57

>>1
3/10, maybe next time champ ;)

Name: Anonymous 2010-04-23 17:23

You should be using Python and Twisted.

Name: Anonymous 2010-04-23 17:51

This shouldn't be difficult. I wrote an IRC bot when I was 5.

Name: Anonymous 2010-04-23 18:11

In the unlikely event that the OP is not a troll,

What is "\n" ?
If you know the answer to that, then you know the answer to your problem.

Name: Anonymous 2010-04-23 18:22

STATIC SINGLETON IRC BOT

Name: Anonymous 2010-04-23 18:33

>>9
Nobody tell him! Make him google it

Name: Anonymous 2010-04-23 18:40

Please don't help people who don't use [code] tags.

Name: Anonymous 2010-04-23 18:48

Please help idiots just to piss off people like >>11-12!

Name: Anonymous 2010-04-23 19:00

>>12
Agreed.

Name: Anonymous 2010-04-23 19:09

>>13
It doesn't piss us off. Helping is not the purpose of this board; there are plenty of places that already have that purpose. So when people try to fit their fucking square peg into our fucking circle anus, it's kinda depressing.

Name: Anonymous 2010-04-23 19:59

>>15
Yes, but then you have to consider the following: most people who post the so-called ``help-requesting threads'' are actually trolls. Fully predictably and without exception, genuine /prog/riders then proceed to provide bogus answers to the OP's question, thereby acting as trolls. Knowing this, a smarter-than-average   trollrider posts a fully-documented, insightful and helpful answer to OP's question, to the frustration of the aforementioned group, effectively trolling them. This all results in a classic case of trolls trolling trolls trolling trolls.

Name: Anonymous 2010-04-23 21:22

>>16
Perhaps the same could be said of all social avenues?

Name: Anonymous 2010-04-23 21:30

>>17
PERHAPS MY ANUS

Name: Anonymous 2010-04-24 10:02

>>16
The key word there, good sir, is most.

Don't change these.
Name: Email:
Entire Thread Thread List