gogg
I wrote this, please do not put it on a website without permission. Original is at my site: http://ognet.mybesthost.com
Not familiar with mIRC? This all sounds a bit confusing? Look over this mIRC newbie guide first then: http://www.ircbeginner.com/ircinfo/mirc.html
First thing is to cover is everything that doesn’t deal with code. What exactly is a bot, and how is it setup? An IRC bot is a mIRC program/client that is running server side programming to tell it what to do when it gets commands from a client. So in essence the mIRC program (or any other programmable IRC client for that matter) is the game-server. Now for most MMO type games you have to download a client to play, with your bot the client to play is any program that can access IRC, or if you want to take it to another level you could have a specifically programmed mIRC client (script) that people would have to download to play. Usually that isn’t necessary, unless you’re going to be messing with graphics, because otherwise the commands that need to be sent to the server are plain text (ex. !stats).
To find out where your going to be programming all this open your mIRC program and on newer version of mIRC click on the icon with the green button with “/a” and a red dot on it. This is the scripts editor. You’re going to be using all the tabs except the “popup” section.
Here is what the help file says about the remote:
Quote
--------------------------------------------------------------------------------
The remote allows you to create scripts that react to IRC Server events, such as when a user joins a channel or sends you a message. This tool is the most complex part of mIRC and to use it you must already know how to use IRC Commands, how to create Aliases, and how to use Variables and Identifiers.
The remote consists of three distinct sections:
The Users section, where user addresses with assigned access levels are listed. Each User in your Users section can be assigned one or more levels. These access levels dictate which events a user will be able to access.
The Variables section, where the currently active variables are listed.
The Scripts section, where the scripts that you create are listed. You can load multiple scripts which work independently of each other. This means that a single IRC Server event can trigger events in one or more scripts. Scripts consist of events which can only be triggered by users who have the required access levels. You can also place Aliases in your scripts by using the alias prefix, and menus in your scripts by using the menu prefix.
--------------------------------------------------------------------------------
All done? Now you can learn about “ini” files. The files where your data is going to be are called “ini” files because they should end in .ini, but aren’t limited to that. For character files I usually use .chr instead, it’s all user preference. The ini file has three levels to divide your data: section, item, and value.
Here is what the help has to say about the writeini command (basic command to write to an ini file):
Quote
--------------------------------------------------------------------------------
/writeini -n
Writes to files in the standard INI file format.
If the -n switch is specified, mIRC will attempt to write to the .ini file even if it is larger than 64k.
A part of the mirc.ini file looks like this:
[DDE]
ServerStatus=on
ServiceName=mirc
You could achieve this with /writeini by using:
/writeini my.ini DDE ServerStatus on
/writeini my.ini DDE ServiceName mirc
You can delete whole sections or items by using the /remini command.
--------------------------------------------------------------------------------
Done? Let’s review. When you have you bot running you’ll have a mIRC client open that has the bot programming done to it. So if you wished to play your own game you’d need another copy of mIRC open, and joined to the same server and channel.
Another thing you might be wondering about is how a bot looks in action, here's some screenshots of MechSiege.
http://ognet.mybesthost.com/tut3.gif
http://ognet.mybesthost.com/tut4.gif
Ok, now that you know the basics well start on the scripting part of the tutorial, but first we need to set up where we’re going to be making the bot. By now you should have a copy of mIRC on your computer (most likely in C:Program FilesmIRC) (if not get it here: http://www.ircadmin.net/mirc/mirc616.exe). We’re going to take that directory and make a copy of it, this copy we make with be the bot/server. So copy the folder “mIRC” and paste it in “Program Files”, now rename it to “mIRC Bot Tutorial”. Go into the directory and open up “mirc.exe” and run the script editor by hitting Alt+R, or that green button with “/a” on it. Click the “Remote” tab and type
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello:#:{
/msg $chan world!
}
--------------------------------------------------------------------------------
Click “File > Save As” and name it “main.mrc”. And that my friend’s is an extremely basic command, now when someone enters the chatroom and says “hello”, the bot will say “world!” To test this, connect the bot to a server and empty chatroom. Now launch “C:Program FilesmIRCmirc.exe” and point it to the same server and chatroom and type “hello”. The other copy of mIRC you have running (the bot) will say “world!” Now everything so far should make perfect sense and be extremely easy. I will now run though each part of the command code quoted above.
Quote
--------------------------------------------------------------------------------
on 1
--------------------------------------------------------------------------------
This is the user level someone has to be to do the command, the default is 1. To define user levels above 1 use the “Users” tab. To add someone add level 100, you would type “100:someone” and more would go on the lines below.
Quote
--------------------------------------------------------------------------------
:TEXT:
--------------------------------------------------------------------------------
This is the form of the command; in this case its plain text. Other options are ACTION (/me kicks), NOTICE, and many, many more. The most important ones of basic bot making are TEXT, ACTION, and CHAT.
Quote
--------------------------------------------------------------------------------
hello
--------------------------------------------------------------------------------
The command it’s self. Sometimes bot makers will throw in a “!” or “`” before the command so it doesn’t get mixed up with other text. Every single word in the command that is separated by a space is a variable. For ours hello is the variable $1, this variable (called an identifier), only lasts for the command (whatever’s in {}). Another example is if we had a command that was “hello what is your name”; hello = $1, what = $2, is = $3, and so on. Another way to do it is; hello what is your name = $1- that “-“ means everything behind $1. Now your saying why does that matter, well you can wildcards (“*”) in your command. I’ll give you the wildcard table from the help file:
Quote
--------------------------------------------------------------------------------
* --- matches any text
& --- matches any word
text --- matches if text contains only this word
text* --- matches if text starts with this word
*text --- matches if text ends with this word
*text* --- matches if text contains this word anywhere
--------------------------------------------------------------------------------
So now we can execute our command without knowing what all the person said. I think we need some examples:
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello *:#:{
/msg $chan $2
}
--------------------------------------------------------------------------------
Now that command right there will send the second word the person said back to the channel. So if they said “hello world”, the bot would say “world”.
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello *:#:{
/msg $chan $2-
}
--------------------------------------------------------------------------------
When we add in the “-“ behind the $2 the bot now says everything after hello. So if they said, “hello how are you?” the bot would say, “how are you?”
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello * are *:#:{
/msg $chan $2 $4
}
--------------------------------------------------------------------------------
Now the bot would say, “how you”, lets continue.
Quote
--------------------------------------------------------------------------------
:#:
--------------------------------------------------------------------------------
This symbol means the location where the command was given. A table from the help file:
Quote
--------------------------------------------------------------------------------
? --- for any private message
# --- for any channel message
#mirc --- for any messages on channel #mirc
* --- for any private or channel messages
--------------------------------------------------------------------------------
Continuing.
Quote
--------------------------------------------------------------------------------
{}
--------------------------------------------------------------------------------
This is where the command begins and ends. The code inside of these will be executed. And just in case your wondering…
Quote
--------------------------------------------------------------------------------
/msg
--------------------------------------------------------------------------------
Although this really isn’t part of the command syntax I’ll go ahead and say that this is the message command, it’s used like:
Quote
--------------------------------------------------------------------------------
/msg nick-or-channel your message
--------------------------------------------------------------------------------
Also $chan is an identifier, it’s whatever active channel your on.
Now that you know some of the basics its time to actually start making a bot, that’s what you wanted to do right? The first thing most people do when making your typical RPG battle bot is make the signup and character creation systems. These are usually linked together, so lets get started. The way to get someone to signup is to have them activate the command to start doing so, universally this having someone type !signup, !register, `signup, or `register, in either the channel or PM the bot. Let’s go with using “!” to proceed our commands with our bot.
On 1:TEXT:!signup:*:{
That’s the first line of our bot, now usually after this you want to check to make sure they aren’t already a player so lets say we have a file in out mirc directory named “existing.ini”…
So that’s our file. Your going to need to check something, to do so you need an “if/then statement”, after setting a temporary variable to hold the file’s list.
on 1:TEXT:!signup:*:{
set %list $readini(existing.ini,existing,list)
if ($nick isin %list) { /msg $nick Woah now, your already a member | halt }
In the above section of code I set the temp variable to the list in the file using the readini command. I then used the if statement, if the nick who typed the command is in the list of people in the existing file then message them with “Woah now, your already a member”, and the halt (stop). The “|” means another line. You could also write the above like this…
on 1:TEXT:!signup:*:{
if ($nick isin $readini(existing.ini,existing,list)) { /msg $nick Woah now, your already a member | halt }
I just didn’t use a temporary variable; this way is more efficient. You could also put the If statement on different lines.
on 1:TEXT:!signup:*:{
if ($nick isin $readini(existing.ini,existing,list)) {
/msg $nick Woah now, your already a member
halt
}
Well then, moving on. We need to give the person some sort of stats. Here's where you can go crazy with races, classes, etc. However, we'll cover some very basic stats so you can get the hang of this. Your going to need to write the stats to a players file, the char (.chr) file.
writeini $nick $+ .chr general hp 100
writeini $nick $+ .chr general mhp 100
That's how I usually do most of the stats, HP being the characters health and MHP being the maximum health. When they heal or something it sets the HP to MHP, HP will change when in a battle or something.
writeini $nick $+ .chr general hp 100
writeini $nick $+ .chr general mhp 100
writeini $nick $+ .chr general mp 50
writeini $nick $+ .chr general mmp 50
writeini $nick $+ .chr general atk 20
writeini $nick $+ .chr general matk 20
writeini $nick $+ .chr general def 10
writeini $nick $+ .chr general mdef 10
writeini $nick $+ .chr general weapon sword
writeini $nick $+ .chr general armor mail
writeini $nick $+ .chr general gold 0
writeini $nick $+ .chr general exp 0
writeini $nick $+ .chr general tnl 50
That's one way to do it, of course all RPGs are different so your future bots might not look anything like this. And here's our file that gets made...mine would be "gogg.chr"
For those of you that have programmed in other languages before, good at mIRC already, or just quick learners you may want to download my open source Dragon Ball bot and take a look at the programming. Some of you will be able to figure it out from there and start modifing the bot for your own needs or building your own bot utilizing some of the code from it. Good Luck!
Not familiar with mIRC? This all sounds a bit confusing? Look over this mIRC newbie guide first then: http://www.ircbeginner.com/ircinfo/mirc.html
First thing is to cover is everything that doesn’t deal with code. What exactly is a bot, and how is it setup? An IRC bot is a mIRC program/client that is running server side programming to tell it what to do when it gets commands from a client. So in essence the mIRC program (or any other programmable IRC client for that matter) is the game-server. Now for most MMO type games you have to download a client to play, with your bot the client to play is any program that can access IRC, or if you want to take it to another level you could have a specifically programmed mIRC client (script) that people would have to download to play. Usually that isn’t necessary, unless you’re going to be messing with graphics, because otherwise the commands that need to be sent to the server are plain text (ex. !stats).
To find out where your going to be programming all this open your mIRC program and on newer version of mIRC click on the icon with the green button with “/a” and a red dot on it. This is the scripts editor. You’re going to be using all the tabs except the “popup” section.
Here is what the help file says about the remote:
Quote
--------------------------------------------------------------------------------
The remote allows you to create scripts that react to IRC Server events, such as when a user joins a channel or sends you a message. This tool is the most complex part of mIRC and to use it you must already know how to use IRC Commands, how to create Aliases, and how to use Variables and Identifiers.
The remote consists of three distinct sections:
The Users section, where user addresses with assigned access levels are listed. Each User in your Users section can be assigned one or more levels. These access levels dictate which events a user will be able to access.
The Variables section, where the currently active variables are listed.
The Scripts section, where the scripts that you create are listed. You can load multiple scripts which work independently of each other. This means that a single IRC Server event can trigger events in one or more scripts. Scripts consist of events which can only be triggered by users who have the required access levels. You can also place Aliases in your scripts by using the alias prefix, and menus in your scripts by using the menu prefix.
--------------------------------------------------------------------------------
All done? Now you can learn about “ini” files. The files where your data is going to be are called “ini” files because they should end in .ini, but aren’t limited to that. For character files I usually use .chr instead, it’s all user preference. The ini file has three levels to divide your data: section, item, and value.
Here is what the help has to say about the writeini command (basic command to write to an ini file):
Quote
--------------------------------------------------------------------------------
/writeini -n
Writes to files in the standard INI file format.
If the -n switch is specified, mIRC will attempt to write to the .ini file even if it is larger than 64k.
A part of the mirc.ini file looks like this:
[DDE]
ServerStatus=on
ServiceName=mirc
You could achieve this with /writeini by using:
/writeini my.ini DDE ServerStatus on
/writeini my.ini DDE ServiceName mirc
You can delete whole sections or items by using the /remini command.
--------------------------------------------------------------------------------
Done? Let’s review. When you have you bot running you’ll have a mIRC client open that has the bot programming done to it. So if you wished to play your own game you’d need another copy of mIRC open, and joined to the same server and channel.
Another thing you might be wondering about is how a bot looks in action, here's some screenshots of MechSiege.
http://ognet.mybesthost.com/tut3.gif
http://ognet.mybesthost.com/tut4.gif
Ok, now that you know the basics well start on the scripting part of the tutorial, but first we need to set up where we’re going to be making the bot. By now you should have a copy of mIRC on your computer (most likely in C:Program FilesmIRC) (if not get it here: http://www.ircadmin.net/mirc/mirc616.exe). We’re going to take that directory and make a copy of it, this copy we make with be the bot/server. So copy the folder “mIRC” and paste it in “Program Files”, now rename it to “mIRC Bot Tutorial”. Go into the directory and open up “mirc.exe” and run the script editor by hitting Alt+R, or that green button with “/a” on it. Click the “Remote” tab and type
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello:#:{
/msg $chan world!
}
--------------------------------------------------------------------------------
Click “File > Save As” and name it “main.mrc”. And that my friend’s is an extremely basic command, now when someone enters the chatroom and says “hello”, the bot will say “world!” To test this, connect the bot to a server and empty chatroom. Now launch “C:Program FilesmIRCmirc.exe” and point it to the same server and chatroom and type “hello”. The other copy of mIRC you have running (the bot) will say “world!” Now everything so far should make perfect sense and be extremely easy. I will now run though each part of the command code quoted above.
Quote
--------------------------------------------------------------------------------
on 1
--------------------------------------------------------------------------------
This is the user level someone has to be to do the command, the default is 1. To define user levels above 1 use the “Users” tab. To add someone add level 100, you would type “100:someone” and more would go on the lines below.
Quote
--------------------------------------------------------------------------------
:TEXT:
--------------------------------------------------------------------------------
This is the form of the command; in this case its plain text. Other options are ACTION (/me kicks), NOTICE, and many, many more. The most important ones of basic bot making are TEXT, ACTION, and CHAT.
Quote
--------------------------------------------------------------------------------
hello
--------------------------------------------------------------------------------
The command it’s self. Sometimes bot makers will throw in a “!” or “`” before the command so it doesn’t get mixed up with other text. Every single word in the command that is separated by a space is a variable. For ours hello is the variable $1, this variable (called an identifier), only lasts for the command (whatever’s in {}). Another example is if we had a command that was “hello what is your name”; hello = $1, what = $2, is = $3, and so on. Another way to do it is; hello what is your name = $1- that “-“ means everything behind $1. Now your saying why does that matter, well you can wildcards (“*”) in your command. I’ll give you the wildcard table from the help file:
Quote
--------------------------------------------------------------------------------
* --- matches any text
& --- matches any word
text --- matches if text contains only this word
text* --- matches if text starts with this word
*text --- matches if text ends with this word
*text* --- matches if text contains this word anywhere
--------------------------------------------------------------------------------
So now we can execute our command without knowing what all the person said. I think we need some examples:
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello *:#:{
/msg $chan $2
}
--------------------------------------------------------------------------------
Now that command right there will send the second word the person said back to the channel. So if they said “hello world”, the bot would say “world”.
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello *:#:{
/msg $chan $2-
}
--------------------------------------------------------------------------------
When we add in the “-“ behind the $2 the bot now says everything after hello. So if they said, “hello how are you?” the bot would say, “how are you?”
Quote
--------------------------------------------------------------------------------
on 1:TEXT:hello * are *:#:{
/msg $chan $2 $4
}
--------------------------------------------------------------------------------
Now the bot would say, “how you”, lets continue.
Quote
--------------------------------------------------------------------------------
:#:
--------------------------------------------------------------------------------
This symbol means the location where the command was given. A table from the help file:
Quote
--------------------------------------------------------------------------------
? --- for any private message
# --- for any channel message
#mirc --- for any messages on channel #mirc
* --- for any private or channel messages
--------------------------------------------------------------------------------
Continuing.
Quote
--------------------------------------------------------------------------------
{}
--------------------------------------------------------------------------------
This is where the command begins and ends. The code inside of these will be executed. And just in case your wondering…
Quote
--------------------------------------------------------------------------------
/msg
--------------------------------------------------------------------------------
Although this really isn’t part of the command syntax I’ll go ahead and say that this is the message command, it’s used like:
Quote
--------------------------------------------------------------------------------
/msg nick-or-channel your message
--------------------------------------------------------------------------------
Also $chan is an identifier, it’s whatever active channel your on.
Now that you know some of the basics its time to actually start making a bot, that’s what you wanted to do right? The first thing most people do when making your typical RPG battle bot is make the signup and character creation systems. These are usually linked together, so lets get started. The way to get someone to signup is to have them activate the command to start doing so, universally this having someone type !signup, !register, `signup, or `register, in either the channel or PM the bot. Let’s go with using “!” to proceed our commands with our bot.
On 1:TEXT:!signup:*:{
That’s the first line of our bot, now usually after this you want to check to make sure they aren’t already a player so lets say we have a file in out mirc directory named “existing.ini”…
So that’s our file. Your going to need to check something, to do so you need an “if/then statement”, after setting a temporary variable to hold the file’s list.
on 1:TEXT:!signup:*:{
set %list $readini(existing.ini,existing,list)
if ($nick isin %list) { /msg $nick Woah now, your already a member | halt }
In the above section of code I set the temp variable to the list in the file using the readini command. I then used the if statement, if the nick who typed the command is in the list of people in the existing file then message them with “Woah now, your already a member”, and the halt (stop). The “|” means another line. You could also write the above like this…
on 1:TEXT:!signup:*:{
if ($nick isin $readini(existing.ini,existing,list)) { /msg $nick Woah now, your already a member | halt }
I just didn’t use a temporary variable; this way is more efficient. You could also put the If statement on different lines.
on 1:TEXT:!signup:*:{
if ($nick isin $readini(existing.ini,existing,list)) {
/msg $nick Woah now, your already a member
halt
}
Well then, moving on. We need to give the person some sort of stats. Here's where you can go crazy with races, classes, etc. However, we'll cover some very basic stats so you can get the hang of this. Your going to need to write the stats to a players file, the char (.chr) file.
writeini $nick $+ .chr general hp 100
writeini $nick $+ .chr general mhp 100
That's how I usually do most of the stats, HP being the characters health and MHP being the maximum health. When they heal or something it sets the HP to MHP, HP will change when in a battle or something.
writeini $nick $+ .chr general hp 100
writeini $nick $+ .chr general mhp 100
writeini $nick $+ .chr general mp 50
writeini $nick $+ .chr general mmp 50
writeini $nick $+ .chr general atk 20
writeini $nick $+ .chr general matk 20
writeini $nick $+ .chr general def 10
writeini $nick $+ .chr general mdef 10
writeini $nick $+ .chr general weapon sword
writeini $nick $+ .chr general armor mail
writeini $nick $+ .chr general gold 0
writeini $nick $+ .chr general exp 0
writeini $nick $+ .chr general tnl 50
That's one way to do it, of course all RPGs are different so your future bots might not look anything like this. And here's our file that gets made...mine would be "gogg.chr"
For those of you that have programmed in other languages before, good at mIRC already, or just quick learners you may want to download my open source Dragon Ball bot and take a look at the programming. Some of you will be able to figure it out from there and start modifing the bot for your own needs or building your own bot utilizing some of the code from it. Good Luck!
