Okay so I have never attempted to build a bot before and I just wanted to make a simple help bot. it got bigger as the day went on and maybe you could rate and give me some ideas, I am not the greatest at coding but I'm learning. Btw ** represents different remotes that must be separated if you attempt to use it. I am still using chatspace inputs because most of them still work on my server.
on *:start:{
/server -m crysys-chat.net 6667
}
********************************************************************************************************************
on *:TEXT:*Servant*bot*:#: {
/msg $chan Yes $nick $+ , I am a bot. You may type !help for my information system.
halt
}
on *:TEXT:!link*:#: {
/msg $chan $nick Java users can use the link 4http://crysys-chat.net/java and IRC users can use 4crysys-chat.net $+ 7 6667
halt
}
on *:TEXT:!help*:#: {
/msg $chan $nick My current help commands are !link !regnick !regroom !id !rules !sop !aop !hop !vop !colors !games (only works in #GameRoom.)
halt
}
on *:TEXT:!regnick*:#: {
/msg $chan $nick To register your nickname you must first be on that nickname then type /register password Email. For example I could type /register fingerfood myemail@myprovider.com
halt
}
on *:TEXT:!regroom*:#: {
/msg $chan $nick to register your own free room type /join #roomname then once you are in your room type /cs register #roomname password description For example I might type /cs register #funnestroom thisismypass A place of fun! 4 You must register your nickname to do this!!!
halt
}
on *:TEXT:!id*:#: {
/msg $chan $nick identifying your nick is the way to make the server know it's really yours, to do this type /ns identify password
halt
}
on *:TEXT:*help*room*:#: {
/msg $chan $nick there is a help room. type /join #Services or find it on the list and double click it. But please only use that room for real chat related help.
halt
}
on *:TEXT:*!Rules*:#: {
/msg $chan $nick Do not post other Chats, Do not post porn links, do not conduct any unlawful activities on this server nor cyber chat about unlawful activities. Do not run bots on this server without direct permission from a head admin.
halt
}
on *:TEXT:*!aop*:#: {
/msg $chan $nick to add a perm mod to your room type /cs aop #yourroomname add nickname To delete one type /cs aop #yourroomname del nickname
halt
}
on *:TEXT:*!sop*:#: {
/msg $chan $nick to add a perm owner to your room type /cs sop #yourroomname add nickname To delete one type /cs sop #yourroomname del nickname
halt
}
on *:TEXT:*!vop*:#: {
/msg $chan $nick to add a perm voiced to your room type /cs vop #yourroomname add nickname To delete one type /cs vop #yourroomname del nickname
halt
}
on *:TEXT:*!hop*:#: {
/msg $chan $nick to add a perm half mod to your room type /cs hop #yourroomname add nickname To delete one type /cs hop #yourroomname del nickname
halt
}
********************************************************************************************************************
on *:TEXT:*love you servant*:#: {
/msg $chan Well Thank you $nick $+ , I love you too! <333
halt
}
on *:TEXT:*servant meet*:#: {
/msg $chan Nice to meet you $3
describe $chan Shakes $3 $+ 's hand
halt
}
on *:TEXT:*ty Servant*:#: {
/msg $chan You're Welcome $nick $+ .
halt
}
on *:TEXT:*thank you Servant*:#: {
/msg $chan You're Welcome $nick $+ .
halt
}
on *:TEXT:*Thanks Servant*:#: {
/msg $chan You're Welcome $nick $+ .
halt
}
on *:TEXT:*lol*servant*:#: {
/msg $chan $nick laughed at me D:
halt
}
on *:TEXT:*!colors*:#: {
/msg $chan $nick If you are using IRC you can press ctrl+k to chose your colors in your text or your Scripts Editor. The format is text,background so 4,1 is red text and black background. On Java at the right side of the text input line you can simply click on the color you want. You may also click on the Font tab next to that to choose the font you want.
halt
}
on *:TEXT:*asl*servant*:#: {
/msg $chan $nick I am .001/niether/in Toms computer
halt
}
on *:TEXT:*servant*asl*:#: {
/msg $chan $nick I am .001/niether/in Tom's computer.
halt
}
on *:TEXT:*kill*bot*:#: {
/msg $chan NO! Please don't kill me, I can change! Kill $nick($chan,$rand(1,$nick($chan,0))) instead!
halt
}
on *:TEXT:*kill*Servant*:#: {
/msg $chan NO! Please don't kill me, I can change! Kill $nick($chan,$rand(1,$nick($chan,0))) instead!
halt
}
on *:TEXT:fu Servant*:#: {
/msg $chan No Thank you $nick I don't swing that way! :/
halt
}
on *:TEXT:*any*miss*me*:#: {
/msg $chan I missed you $nick $+ !!!
halt
}
on *:TEXT:*I'm lost*:#: {
/msg $chan ~Hands $nick a map~
halt
}
on *:TEXT:*Im lost*:#: {
/msg $chan ~Hands $nick a map~
halt
}
on *:TEXT:*I am lost*:#: {
/msg $chan ~Hands $nick a map~
halt
}
on *:TEXT:*I'm still lost*:#: {
/msg $chan ~Hands $nick a GPS~ There happy now?
halt
}
on *:TEXT:*Im still lost*:#: {
/msg $chan ~Hands $nick a GPS~ There happy now?
halt
}
on *:TEXT:*I am still lost*:#: {
/msg $chan ~Hands $nick a GPS~ There happy now?
halt
}
on *:TEXT:stfu Servant*:#: {
/msg $chan Um no. Like you I am programmed to never stop talking so I just go on and on just like you do and never quit just like you. :D
halt
}
on *:TEXT:*hugs*bot*:#: {
describe $chan Hugs $nick Back
halt
}
on *:TEXT:*hugs*servant*:#: {
describe $chan Hugs $nick Back
halt
}
on *:TEXT:*servant*dialup*:#: {
/msg $chan Dialup? omg smoke signals are faster than that!
describe $chan lights a fire for $2 $+ !
halt
}
on *:TEXT:*who*is*servant*:#: {
/msg $chan $nick I am a Service Bot Built By Sharky_Dude (Tom) to assist chatters, you may start by typing !help thank you.
halt
}
on *:TEXT:*hey servant*:#: {
/msg $chan Hello $nick $+ .
halt
}
on *:TEXT:*hello servant*:#: {
/msg $chan Hello $nick $+ .
halt
}
on *:TEXT:*!game*:#GameRoom: {
/msg $chan My currant game database consists of ANY ROOM: !8ball !slap #GAMEROOM ONLY: !roll (returns a 2 die 6) !d4 !d6 !d8 !d10 !d12 !d20 d30 !d50 !100 !flip (Heads or Tails) #Adults ONLY: !fml
halt
}
********************************************************************************************************************
on *:TEXT:!8ball*:#:{
/set %fact $rand(1,20)
if (%fact == 1) msg $chan Yes.
if (%fact == 2) msg $chan No.
if (%fact == 3) msg $chan Maybe.
if (%fact == 4) msg $chan Ask me later.
if (%fact == 5) msg $chan Yes but not now.
if (%fact == 6) msg $chan Absolutely.
if (%fact == 7) msg $chan Absolutely Not.
if (%fact == 8) msg $chan Sure.
if (%fact == 9) msg $chan Never.
if (%fact == 10) msg $chan Hell, Why not.
if (%fact == 11) msg $chan Hell no.
if (%fact == 12) msg $chan What will you give me if I say yes?
if (%fact == 13) msg $chan Are you serious?
if (%fact == 14) msg $chan Sorry but I'm undecided.
if (%fact == 15) msg $chan Hmm, maybe you should ask $nick($chan,$rand(1,$nick($chan,0))) instead.
if (%fact == 16) msg $chan I don't think so.
if (%fact == 17) msg $chan I'm not sure.
if (%fact == 19) msg $chan Yea.
if (%fact == 20) msg $chan ask $nick($chan,$rand(1,$nick($chan,0))) they may know.
}
********************************************************************************************************************
on *:TEXT:!slap*:#:{
/set %fact $rand(1,20)
if (%fact == 1) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a large gay 4r7a8i3n11b6o13w trout~
if (%fact == 2) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a 2x4~
if (%fact == 3) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) then blames it on $nick($chan,$rand(1,$nick($chan,0))) $+ ~
if (%fact == 4) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a lawsuit, you owe me $1,000,000,000!
if (%fact == 5) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) a pool stick~ Oh, sorry I didn't mean to sharpen it first...
if (%fact == 6) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a metal bat~ Oh crap, I ment to use the foam one.
if (%fact == 7) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a semi truck~ Hey it was only going 60mph!
if (%fact == 8) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with $nick($chan,$rand(1,$nick($chan,0))) $+ 's used sock~
if (%fact == 9) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a live granade~
if (%fact == 10) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a wet noodle~
if (%fact == 11) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with an icy snowball~
if (%fact == 12) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a sharp axe~
if (%fact == 13) msg $chan ~Sneaks through $nick($chan,$rand(1,$nick($chan,0))) $+ 's modem and slaps them up side the head with a rubber chicken~
if (%fact == 14) msg $chan ~Pimp slaps $nick($chan,$rand(1,$nick($chan,0))) $+ ~
if (%fact == 15) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) limp wristed~
if (%fact == 16) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a large dead trout~
if (%fact == 17) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with a pissed off skunk~
if (%fact == 19) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) in the face with a pissed off house cat~
if (%fact == 20) msg $chan ~Slaps $nick($chan,$rand(1,$nick($chan,0))) with $nick($chan,$rand(1,$nick($chan,0))) $+ ~
}
********************************************************************************************************************
on *:TEXT:!fml*:#Adults:{
/set %fact $rand(1,15)
if (%fact == 1) msg $chan So I was in an elevator today with some stranger who asked me, "Can I smell your pussy?" "Hell no!" I replied. So he said, "Must be your feet!" FML
if (%fact == 2) msg $chan At the bar last night this really cute guy kept staring at me then gave me a piece of paper with a number on it. when I got home I decided to call him, opened the paper and it said 911. FML
if (%fact == 3) msg $chan My husband dropped me off at work. Ten minutes later He sent me a text saying "dropped the bitch off I'll be there in a few sexy. Later I asked him about it and he said "I don't know what you're talking about Pam" my name isn't Pam. FML
if (%fact == 4) msg $chan I opened the card my parents gave me for my birthday, it had a $ $+ 20 iTunes card in it that came free with the ipad they bought my little sister. FML
if (%fact == 5) msg $chan Getting sick of hearing the couple in the next room getting freaky I called my boyfriend to ask him to take me out. I heard his phone ring through the wall. FML
if (%fact == 6) msg $chan Today I swerved out of the way to avoid hitting a wild squirrel, in doing so I hit a cop. FML
if (%fact == 7) msg $chan I put in for Harvard, and was excited when they called. " $+ $nick($chan,$rand(1,$nick($chan,0))) $+ ," the man said. "With grades like yours we can pay you $8 and hour to clean commodes." FML
if (%fact == 8) msg $chan "Honey pack your shit I won the lottery" My husband said, "Where are we going?" I asked. So he said "I don't care where you go just get the fuck out!" FML
if (%fact == 9) msg $chan So I went to the doctor about my red swollen face, headaches, and ringing in my ears. The doctor told me I had only 30 days to live so I spent my millions on parties, prostitutes, and drugs to go out with a bang. I took my last $5000 to buy a suit from a tailor, gave him my measurements and he said "You cant wear a size 14 collar that will give you a red swollen face, headaches, and ringing in your ears. FML
if (%fact == 10) msg $chan In an argument with my husband I decided to fuck with him and told him I'm dying, He quit drinking and he's happier now. FML
if (%fact == 11) msg $chan Yesterday my husband and I decided to get drunk for the first time together and have sex. We heard a car door outside and he jumped up screaming, "My wife's home!" FML
if (%fact == 12) msg $chan Being sexy I wanted to send a text to my boyfriend saying "Take it all off." I looked at the reply, "What are you talking about I'm your dad!" FML (hehe that DID happen to someone in this room)
if (%fact == 13) msg $chan When I got home my mother told me she had bought me a Nintendo Wii, I got to my room and found a broken Atari! FML
if (%fact == 14) msg $chan I was hired for a modeling job, I couldn't believe it $2000 just to stand there for 5 minutes. They even let me wear my own clothes. When I saw the commercial they were asking for money for the homeless. FML
if (%fact == 15) msg $chan I had been begging my boyfriend to take me to this expensive restaurant, when he finally agreed, the hostess asked "Not bringing the wife today I see?" FML
}
********************************************************************************************************************
on *:Input:#:{
If ($$1 == +o) { Mode # +o $2 }
If ($$1 == <3) { Mode # +o $2 }
If ($$1 == -o) { Mode # -o $2 }
If ($$1 == </3) { Mode # -o $2 }
;
If ($$1 == +v) { Mode # +v $2 }
If ($$1 == -v) { Mode # -v $2 }
;
If ($$1 == +q) { Mode # +q $Address($2,4) | mode # +q $2 | notice $2 You are now silenced in # }
If ($$1 == -q) { Mode # -q $Address($2,4) | Mode # -q $2 | notice $2 You may now talk in # }
If ($$1 == +stfu) { Mode # +q $Address($2,4) | mode # +q $2 | notice $2 You are now silenced in # }
;
If ($$1 == +b) { Ban # $Address($2,4) }
If ($$1 == +nb) { Mode # +b $2 | Kick # $2 Change your name please. }
If ($$1 == -b) { Mode # -b $Address($2,4) | Mode # -b $2 }
;
If ($$1 == +k) { Kick # $2 $3- }
If ($$1 == +kb) { Kick # $2 $3- | Ban # $address($2,4) }
If ($$1 == +ab) { Kick # $2 $3- you are to old for this room, please join #AdultChat | Ban # $address($2,4) | ban # $2 }
If ($$1 == +fuckoff) { Kick # $2 $3- }
;
If ($$1 == +t) { Topic # $2- }
If ($$1 == +i) { Invite $2 # }
;
If ($$1 == +sop) { Services Sop # Add $2 }
If ($$1 == +sop) { /cs aop # add $2
If ($$1 == -sop) { Services Sop # Del $2 }
;
If ($$1 == +aop) { Services Aop # Add $2 | mode # +o $2 | notice $2 You now have auto-op in # . }
If ($$1 == ~aop) { /cs aop # add $2 }
If ($$1 == +x) { Services Aop # Add $2 | mode # +o $2 }
If ($$1 == -aop) { Services Aop # Del $2 }
;
If ($$1 == +vop) { Services Vop # Add $2 | mode # +v $2 | notice $2 You now have auto-voice in # . }
If ($$1 == -vop) { Services Vop # Del $2 }
;
if ($$1 == +vo) { mode # -o+v $2 $2 }
if ($$1 == +ov) { mode # -v+o $2 $2 }
If ($$1 == +a) { say $Address($2,2) }
If ($$1 == +touch) { say ~ Touches $2 ~ }
If ($$1 == +slap) { say ~ slaps $2 ~ }
;
}
********************************************************************************************************************
on *:TEXT:!flip*:#GameRoom:{
/set %fact $rand(1,2)
if (%fact == 1) msg $chan 4 $+ $nick flips, 4Tails!
if (%fact == 2) msg $chan 4 $+ $nick flips, 4Heads!
}
********************************************************************************************************************
on *:TEXT:!d4*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,4)
}
on *:TEXT:!d6*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,6)
}
on *:TEXT:!d8*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,8)
}
on *:TEXT:!d10*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,10)
}
on *:TEXT:!d12*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,12)
}
on *:TEXT:!d20*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,20)
}
on *:TEXT:!d30*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,30)
}
on *:TEXT:!d50*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,50)
}
on *:TEXT:!100*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,100)
}
on *:TEXT:!roll*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,6) and4 $rand(1,6)
}
To shorten the code.
Make all your 8ball answers in a text file.
on *:TEXT:.8ball *:#:{
msg $chan $read($shortfn($mircdir) $+ 8ball.txt)
}
Same with slaps
on *:TEXT:.slap *:#:{
describe $chan slaps $2- with a $read($shortfn($mircdir) $+ slaps.txt)
}
Why would your bot have an input command?
Also you don't need the /
msg $chan (or #) works just as well.
SunnyD, I'll tell you as a humble human being: regex is never a piece of cake. I'm still learning about it these days. A self-satisfied person usually thinks I've learned them all and mastered regex, but you'll be surprised there are more than you think in the language of regex, which you'll find yourself scratching your head hard over it.
you also may want to tak "#gameroom" out
on *:TEXT:!flip*:#GameRoom:{
/set %fact $rand(1,2)
if (%fact == 1) msg $chan 4 $+ $nick flips, 4Tails!
if (%fact == 2) msg $chan 4 $+ $nick flips, 4Heads!
}
on *:TEXT:!d4*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,4)
}
on *:TEXT:!d6*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,6)
}
on *:TEXT:!d8*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,8)
}
on *:TEXT:!d10*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,10)
}
on *:TEXT:!d12*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,12)
}
on *:TEXT:!d20*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,20)
}
on *:TEXT:!d30*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,30)
}
on *:TEXT:!d50*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,50)
}
on *:TEXT:!100*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,100)
}
on *:TEXT:!roll*:#GameRoom:{
msg $chan 4 $+ $nick rolls4 $rand(1,6) and4 $rand(1,6)
}
Collecting from previous comments, if you're going to release a snippet to the public it might be a good idea to do your best to make it as bullet-proof and 'variable'd' as possible because hard-coding isn't flexible for other users and doesn't generally adapt well. "Stress Testing" it could be another worthy measure to consider; make sure it can withstand anything the user throws at it. I do realize this is considered a site to gain insight to better yourself, but some users come here to look for a snippets to use as example. Often times I do the same; looking for techniques demonstrated by the poster.
For one you can call the actual commands for your text events using $1
For example:
on *:TEXT:*:#:{
if ($1 == !sop) {
;commands for !sop here
}
if ($1 == !aop) {
;etc
}
}
$1 refers to the first token in the string so $1 in "Hello my name is Power." it would reference "Hello", $2 would reference "my" and so on. Even $0 plays a part in the string as it returns the total number of tokens within said string so "Hello my name is Power" would return 5.
a example of the script that doesn't work for every IRCd:
on *:TEXT:!regnick*:#: {
/msg $chan $nick To register your nickname you must first be on that nickname then type /register password Email. For example I could type /register fingerfood myemail@myprovider.com
halt
}
For people who use Anope it's /ns register, and it's different for every other service package out there (some are in common however).
You can condense this in many ways using ethier by making it have some regex, or even making a list of if statements that use one on text event.
I hadn't thought about that I just copied and pasted all of it. I still figure 99.9% of everyone on here is smart enought to know to change it to thier own server of choice. just like the bot name should be changed to a new name if they want to use it. also anyone wanting to use this should change the roomnames in it because if you don't they wont work unless you are on channels named the same thing or piss someone off. Sorry I didnt think to make it generic, I just want some help on making it better.