About Monkey 2 › Forums › Monkey 2 Projects › m2irc – IRC module
This topic contains 6 replies, has 3 voices, and was last updated by
Hezkore
1 year, 2 months ago.
-
AuthorPosts
-
January 29, 2018 at 3:42 pm #13331
m2irc is an IRC module for Monkey2.
It lets you connect to any IRC server easily and process the messages and events however you want.GitHub: https://github.com/Hezkore/m2irc

Instructions
* Download or Git Clone to your Monkey2 ‘Modules’ folder
* Recompile module
* Compile & run tests inside the ‘tests’ folder
Possible usage
IRC is an open protocol, you’re free to use it however you want.
It’s also very easy to understand as it’s all just text based.It could be used to build a fully featured IRC client with any number of special features.
Make a simple game bot that asks quiz questions in a channel.
It can act as your in-game chat.
Or a bot to remote control your computer as a terminal.
Or even update Monkey2 or build Monkey2 projects remotely (that’s what I’m doing)
I have a bot that tells me every night what updates Mark’s done to M2, in a short summarized message.It doesn’t even have to be about “chatting”, you can use it to send any text between clients.
There’s no limit here.No nickname registration is required (but you can!) and no personal information is stored.
Plus, anyone can make a channel!
You could make #MyTestChan for testing stuff.
Then tell someone to join #MyTestChan if you want to show something.There’s a #monkey2 channel over at “chat.freenode.net”
Feel free to drop by and say hello and show what you’re working on.
ExampleMonkey123456789101112131415161718192021#Import "<std>"#Import "<m2irc>"Using std..Using m2irc..Function Main()Local irc:=New IRCClient' Skip fiber usage when not using Mojo.Appirc.UseFiber=False' Connect to Freenode networkirc.Connect( "chat.freenode.net", 6667, "m2user" )' Manual update is only needed when UseFiber is FalseWhile irc.Connectedirc.Update()Sleep( 0.25 )WendEndJanuary 29, 2018 at 3:58 pm #13333Yo. You’re coding some really cool stuff, Hezcore. Sheesh, I’m glad we have you onboard the monkey train.
January 29, 2018 at 4:07 pm #13335Heh thanks.
An early version of this that I wrote last year is still inside Ted2Go, it’s what it used for the “Chat” tab.
I’ve since rewritten it, and I plan on redoing some part of this as well later on.
But I figured I’d share what I’ve got so far as it’s likely to be backwards compatible anyways.A few more modules are on the way.
January 30, 2018 at 9:59 am #13353Cool stuff Hezkore, is this going into “Modules”?
[EDIT] : Would this work for turn based multiplayer?
January 30, 2018 at 2:29 pm #13359You can throw it anywhere for now @Diffrenzy
I’ll make a proper documented module of it at some point heh.And about the game…
You COULD make a turn based multiplayer game, sure.
It’s just text.
But since the only kind of identification on IRC is the nickname, it means that they could probably cheat by just logging into IRC via a standard IRC client using the same nickname and send messages from there.
In fact if the nickname wasn’t registered, anyone could sign in with it and mess things up.Only one person can use a nickname at the same time from one client, so if it’s in use it’s “safe”.
But I’m guessing the idea would be that they could basically turn the game off and come back later and continue?
If it’s a game that ends when a client quits, then it could work, yes.You’d have to make sure that the clients connects to the same server though, because “net splits” can happen on networks from time to time.
Which basically means that a server loses connection to the bigger network for a short while.So for example ‘chat.freenode.net’ is a network for open source projects (Freenode where #monkey2 is) and you can connect to that and be assigned a server based on your location, and there are lots of servers all around the world and they all connect to the main network.
In the end, every user can all talk to each other (even if they’re on different servers) because the servers all talk to each other via the network.
But at some point one of the servers could lose connection to the network and they’d be separate from everyone else for a little while.But that’s easy to work around.
If you just connect the clients to the same server, for example ‘sinisalo.freenode.net’ which is a Freenode server in Sweden, they’d be together during net splits.January 31, 2018 at 3:52 pm #13395Thanks Hezkore, that is a very good and welcome explanation.
I can see several useful ways to use your module.
PS: I won’t be posting it as a user module, but it would be great if you did at some point.
February 1, 2018 at 5:44 pm #13414Yeah… I have a few modules that could go into the user module section I suppose.
I can hardly even remember to update the GitHub repos for everything though.
I also have to update my server backup that compiles everything for me.Those are still automatic processes though that I just have to trigger, so sometimes I do remember it heh!
So the problem, for me at least, is that “User Module” uploads are a very manual process, and I update my stuff quite often. At least at this stage in development.But I can upload them at some point.
Or feel free to do it yourself, but remember that I update often! -
AuthorPosts
You must be logged in to reply to this topic.