SRL Archive - Senior News and General

Human response > IRC > SCAR > RS


The Un-Named

2007-12-02 15:41:59

Well, for the life of me I couldn't think of a good title, so let me explain a bit more about what this "program" does. But first, if you don't know a bit about IRC, this isn't for you.

Have you ever made a script, for members, and needed good responding to say, friends? With this little tool, you can view all runescape chats received by SCAR, send them off to an IRC channel(that you are in), and you can then type, and that will get sent so SCAR can read it and reply with what you typed. The actual process goes like this:

RS Text > SCAR > Php Script > Java > IRC
Then when you respond:
IRC > Java > Php Script > SCAR > RS.

And you can use this on one computer(say, running this script on SMART) or run the script on a PC and respond on any pc connected to the IRC channel. In short, this can be achieved.

It's not hard to setup either, download IRCSponder.rar(attached to post), extract it, upload the index.php file to a website(for example, upload it to http://www.example.com/scarirc/), and keep a mental note of where you uploaded it to, and edit Run.bat accordingly(see Readme.txt). Set up the network, IRC channel, the bot name, your IRC name(the script will ignore most things unless you set this up correctly) and the url to where you uploaded the file to. Now, I suggest you open your IRC client, join the channel you set in Run.bat, make sure no one else is in it(for the next version I'm just going to add private messaging not chnnels), and run Run.bat, wait until the bot joins the channel and set it invite only. From there, you can type !help, !help commands, !quit or !startup depending on what you do. I suggest !help first(IIRC, that explains what the commands do, especially !help commands). Once it's all setup, you can run qa.scar(in the main line, edit in the URL of where you uploaded index.php to). From there, you can fiddle with it all you like.

A few notes -
This uses The PircBot Java IRC Api. I do not take any credit for this.
The current version isn't very user-friendly, and it has been rushed. It's more of an example than a solid way of doing this. It checks the url every second to see if it has changed, so be warned if your concerned about bandwidth. I've also uploaded the source so you can fiddle with that.

If you have any questions, I'll do my best to answer. ;)

mastaraymond

2007-12-02 16:20:47

From: The Un-Named
Well, for the life of me I couldn't think of a good title, so let me explain a bit more about what this "program" does. But first, if you don't know a bit about IRC, this isn't for you.

Have you ever made a script, for members, and needed good responding to say, friends? With this little tool, you can view all runescape chats received by SCAR, send them off to an IRC channel(that you are in), and you can then type, and that will get sent so SCAR can read it and reply with what you typed. The actual process goes like this:

RS Text > SCAR > Php Script > Java > IRC
Then when you respond:
IRC > Java > Php Script > SCAR > RS.

And you can use this on one computer(say, running this script on SMART) or run the script on a PC and respond on any pc connected to the IRC channel. In short, this can be achieved.

It's not hard to setup either, download IRCSponder.rar(attached to post), extract it, upload the index.php file to a website(for example, upload it to http://www.example.com/scarirc/), and keep a mental note of where you uploaded it to, and edit Run.bat accordingly(see Readme.txt). Set up the network, IRC channel, the bot name, your IRC name(the script will ignore most things unless you set this up correctly) and the url to where you uploaded the file to. Now, I suggest you open your IRC client, join the channel you set in Run.bat, make sure no one else is in it(for the next version I'm just going to add private messaging not chnnels), and run Run.bat, wait until the bot joins the channel and set it invite only. From there, you can type !help, !help commands, !quit or !startup depending on what you do. I suggest !help first(IIRC, that explains what the commands do, especially !help commands). Once it's all setup, you can run qa.scar(in the main line, edit in the URL of where you uploaded index.php to). From there, you can fiddle with it all you like.

A few notes -
This uses The PircBot Java IRC Api. I do not take any credit for this.
The current version isn't very user-friendly, and it has been rushed. It's more of an example than a solid way of doing this. It checks the url every second to see if it has changed, so be warned if your concerned about bandwidth. I've also uploaded the source so you can fiddle with that.

If you have any questions, I'll do my best to answer. ;)


Very nice!

But isn't it faster to make a direct connection to the irc server, with sockets. So its more like Scar > Irc, Irc > Scar..

Lets pay some noobs to do manual 'responding :D'. But wait 1 moment.. If we could get the responding done on a big server, we could make a real good responder… (h) That would be pretty cool, making the responder a different process :eek:

Special Ed

2007-12-02 16:22:03

Looks awesome, maybe we could get you and code to work together and possibly incorporate this with tUcos? Have a little tab under each script or on each script page have a text blank that you can type in to respond. I think that would be awesome if you could pull it off. I'll try this out, I haven't used IRC a lot in the past but I'm sure I can get it to work.

Markus

2007-12-02 16:33:14

Looks cool :D
Hmm, maybe we should make something like Sleepwalker, that if I respond I get credits, and then other noobs can respond for me and I pay them? ^^ WOuld be nice to see :)

The Un-Named

2007-12-03 03:42:18

From: mastaraymond
…But isn't it faster to make a direct connection to the irc server, with sockets. So its more like Scar > Irc, Irc > Scar.. …


I was waiting for that. Yes, it would be more faster if you was to do it directly, however you can't slap it in the script that's running, you'll need to have another SCAR, use SendInterScarMessages and it could get very messy without threads, since you'll need to be doing 3 things at once, one, checking for pings, two, checking for responses, three, sending/receiving SendInterScarMessages.

From: Special Ed
Looks awesome, maybe we could get you and code to work together and possibly incorporate this with tUcos? Have a little tab under each script or on each script page have a text blank that you can type in to respond. I think that would be awesome if you could pull it off. I'll try this out, I haven't used IRC a lot in the past but I'm sure I can get it to work.


I'm not sure how tUcos works yet, but I'm sure implementing anything server side would be easy(if you have a look at index.php, it's a 1 minute job), and implementing it into scripts could be easy, you could have on, off, friends only, default(pre-defined) responses and such. Also, a small tip, use XChat, it's preference really but it really does make IRC easy, and it isn't bulky like mIRC.

From: Markus
Looks cool :D
Hmm, maybe we should make something like Sleepwalker, that if I respond I get credits, and then other noobs can respond for me and I pay them? ^^ WOuld be nice to see :)


I was thinking something like that, multiple people on an "allow" list, then when someone else responds for you, it gets marked up on the server, and since the person running the script will be running the Java app, no one can fiddle with it. :D

Special Ed

2007-12-03 17:00:37

c0de I was saying if you could implement a chat box into the tUcos page. You know how you can have chat boxes on websites, that was I was referring too. No necessarily the same method that tUcos used but just implement the chat into the web page rather than having it be a separate program.

Special Ed

2007-12-03 22:18:19

I never said I knew how to do it I just said it would be cool if you could do it. :p

Either way, you're right in both aspects more - so with the first.

Ejjman

2007-12-03 22:23:28

Implementing IRC isn't too hard, anyway, is it? It'd be really sweet :)

The Un-Named

2007-12-04 07:57:05

From: c0de
You mean java applet for irc, it would be easy to implement yes. Or you mean shoutbox, I still don't see how we could push those from tUcos to RS :P


Well the way it currently works is SCAR would take a string, remove all non alphanumeric characters except underscores(replace spaces with underscores), apostrophes and question marks, and use GetPage(url + '?s=chat-' + string); and check the page every 1 second until the string has changed and is prefixed with "response-". All that would be required is a separate page for the messages, and use of fopen in php to check if the string has been prefixed with "chat-", then wait for a reply and fopen(url + '?s=response-' + parsedString); and SCAR can read that, and reply with it. Probably not the best way to do it but it would work. :P

Alternately, I could find an extremely lightweight IRC client in Java(by lightweight I mean something that will only reply to pings and can accept private messages), and embed it into a webpage.

mastaraymond

2007-12-05 07:38:02

From: c0de
That is bandwith eater, + if we consider loading page over 1 second, it would bug alot, maybe check for messages every 10 seconds? I know how to make the system , the point is usage of bandwith and script lagging, it wouldn't really be able to execute normally unless the getpage was in second thread, if you get what I mean, and for irc applet, pjirc would do the job.


It might be possible to create a plugin that has got direct connection with the website\irc.. Then it would be really possible to make the script going..

Something like this:
begin;
GetChat;
SendChat;
ThingsToDo := ReceiveChat;
if ThingsToDo <> '' then
begin;
….
end;
end;

The Un-Named

2007-12-05 07:50:31

From: c0de
That is bandwith eater, + if we consider loading page over 1 second, it would bug alot, maybe check for messages every 10 seconds? I know how to make the system , the point is usage of bandwith and script lagging, it wouldn't really be able to execute normally unless the getpage was in second thread, if you get what I mean, and for irc applet, pjirc would do the job.


I get what you mean, although it could easily be done with 5000 people checking 8 times an hour for a full 28 days on a "free host" that provides 5GB/monthly (960k checks a day, 183mb, a little over 5GB every 28 days).

I'll figure out how to use the Java <> SCAR made by RegeX, then all you need to do is ask Java witch asks an IRC channel(Priv message maybe), no bandwidth eating involved.

Special Ed

2007-12-05 15:43:43

From: c0de
That's the point of this thread, but it went in wrong direction when trying to involve tUcos :)


Sorry for getting everyone off topic, but IMO it was a good idea, I just didn't see as far as the programming side of it and how server intensive it would actually be.

I don't know a lot about interlanguage programming but it sounds like your best bet is to go from SCAR <> Java although that goes against the SRL code. (IDK if its really considered a code but thats how I see it).

The Un-Named

2007-12-06 10:27:49

Well, a quick update, I've got the Java sharedmem with SCAR working(so directly going from SCAR to Java), and I can ask an IRC user and get a response, but there's one small problem:

While SCAR is waiting for a response, the script "hangs" if it were, meaning one of 2 things:

You can put anti-randoms and anti-ban in a separate script
You can make a plugin for real multi-threaded support in SCAR.

The second one would be pretty damned hard, and both choices won't work well.

I have experimented with TTimers(the only real multi-threading capability's in SCAR), and it STILL hangs the script because a nice form pops up, and you need to close that form to let the rest of the script continue, or use a really dirty hack and use frmDesign.show; and frmDesign.hide; in your SafeInit procedure, but then SCAR goes ballistic when you try to stop the script.