This is a little script I made within 2 days. It's very simple, I've also tryed to make it flexible as well so it's easy for new coders to add on to it.
I'll be adding on to it in the future and updating the script.
Commands:
!register - Registers your account, (You'll have to go through a verification stage in order to complete the registration)
!stats (nick) - Get's the statics of the nick you wish. If you leave the nick bit empty, it'll show you the stats of your self.
!cdrink - Get a glass of coke from the bot. (One person to be served at a time ;) )
Enjoy, please feel free to comment on suggestions and other things you feel necessary
on *:TEXT:!register*:#:{
if (!$2) {
if (%coke. [ $+ [ $nick ] ] == 1) {
echo ( $+ $time $+ -+- $+ $date $+ ) [4ERR] $nick tryed to register when they already had an account!
privmsg $chan $nick $+ , you already have an account.
}
else {
privmsg $chan $nick $+ , you will be noticed a code within 10 seconds to prove that you're a human.
set %reg. [ $+ [ $nick ] ] $rand(999999,999999999)
timer 1 10 /notice $nick Your code is $+ %reg. [ $+ [ $nick ] ] $+
timer 1 10 /notice $nick Inorder to complete your registration, type the following:
timer 1 10 /notice $nick !register %reg. [ $+ [ $nick ] ]
timer 1 10 /notice $nick If you do not do that command within 1 minute, the request will not longer be valid. :(
timer 1 70 /unset %reg. [ $+ [ $nick ] ]
}
}
else {
if ($2 == %reg. [ $+ [ $nick ] ]) {
privmsg $chan Thank you for registering $+($nick,.)
privmsg $chan I will now add you to my database...
set %coke. [ $+ [ $nick ] ] 1
set %coke. [ $+ [ $nick ] $+ ] . [ $+ [ time ] ] $ctime
set %coke. [ $+ [ $nick ] $+ ] . [ $+ [ network ] ] $network
set %coke. [ $+ [ $nick ] $+ ] . [ $+ [ cokes ] ] 0
$tip(Coke, Coke Registration!,$nick has successfully registered on my Coke system!,10)
unset %reg. [ $+ [ $nick ] ]
timer 1 5 privmsg $chan Done, you may now use the coke system :)
timer 1 5 privmsg $chan Enjoy! =D
}
}
}
on *:TEXT:!stats*:#:{
if ($2) {
if (%coke. [ $+ [ $2 ] ] == 1) {
privmsg $chan $2 registered $duration($calc($ctime - %coke. [ $+ [ $2 ] $+ ] . [ $+ [ time ] ] )) ago!
privmsg $chan They've drank %coke. [ $+ [ $2 ] $+ ] . [ $+ [ cokes ] ] cokes since they registered.
}
else {
privmsg $chan $2 isn't registered!
}
}
if ($2 == $null) {
if (%coke. [ $+ [ $nick ] ] == 1) {
privmsg $chan You registed $duration($calc($ctime - %coke. [ $+ [ $nick ] $+ ] . [ $+ [ time ] ] )) ago!
privmsg $chan You've drank %coke. [ $+ [ $nick ] $+ ] . [ $+ [ cokes ] ] cokes since you registered.
}
else {
privmsg $chan You ain't registered, try registering with !register
}
}
}
on *:TEXT:!cdrink:#:{
if (%coke. [ $+ [ $nick ] ] == 1) {
if (%cokes1 == 1) { privmsg $chan Please wait, $+($nick,!) I'm already serving somebody, I've only got 1 pair of hands! }
else {
set %cokes1 1
set %coke. [ $+ [ $nick ] $+ ] . [ $+ [ cokes ] ] $calc(%coke. [ $+ [ $nick ] $+ ] . [ $+ [ cokes ] ] + 1)
describe $chan grabs a glass and slowly puts coke in to the glass...
timer 1 5 msg $chan Ok... Almost done! Gives a few secs, just spilt it all over the counter :(
timer 1 10 msg $chan Done!
timer 1 12 describe $chan hands $nick a glass of coke
timer 1 15 msg $chan Adding it to your tab now. :)
timer 1 16 msg $chan Done!
timer 1 16 unset %cokes1
}
}
else {
privmsg $chan Please register by using !register
}
}
To make it clear for you to see, here is another example:
on *:TEXT:!register:#:{
if (!%coke. [ $+ [ $nick ] ]) {
set %coke. $+ $nick 1
}
else {
msg $chan $nick you already have an account!
}
}
The $2 is not necessary. Simply use the !register command. When you set a dynamic variable, you don't need to include the [ ] evaluation bracket.
Also, I realize this part doesn't quite make sense:> on :TEXT:!register:#:{
if (!$2) {
if (%coke. [ $+ [ $nick ] ] == 1) {
The $2 has nothing to do with the dynamic variable here. It should have been:
on *:TEXT:!register*:#:{
if (!%coke. [ $+ [ $nick ] ]) {
if (%coke. [ $+ [ $nick ] ] == 1) {
You're to check for the value, not compare them with $2 and the variable.
You'd have to do !stats !@host.here for it to work.Use:
$address($2,2)
For $nick inside the [ ] brackets, you use $wildsite ; for $2 inside the [ ], you use $address($2,2)
Like this:> if ($address($2,2)) {
if (%coke. [ $+ [ $address($2,2) ] ] == 1) {and you can still use $2 and $address($2,2) side by side to refer to his or her nickname and host.
Jethro, I understand what you're on about and as I was updating a few things I realised that if I use $wildsite, the !stats command would be annoying. You'd have to do !stats !@host.here for it to work. Any idea how I could use $wildsite and have the !stats command work with nicks still?
Thanks in advanced.
Well yes, rather than having 10-second notices per interval, you can make them as one notice display. It's more straightforward and less annoying this way. Lastly, I'm not certain why you'd use "privmsg" over msg. According to irc protocol: > PRIVMSG is used to send private messages between users.
is the nickname of the receiver of the message. can also
be a list of names or channels separated with commas.
else {
privmsg $chan $nick $+ , you will be noticed a code within 10 seconds to prove that you're a human.
set %reg. [ $+ [ $nick ] ] $rand(999999,999999999)
timer 1 10 /notice $nick Your code is $+ %reg. [ $+ [ $nick ] ] $+
timer 1 10 /notice $nick Inorder to complete your registration, type the following:
timer 1 10 /notice $nick !register %reg. [ $+ [ $nick ] ]
timer 1 10 /notice $nick If you do not do that command within 1 minute, the request will not longer be valid. :(
timer 1 70 /unset %reg. [ $+ [ $nick ] ]
}
You know that does nothing but annoy people right? If people wanna bot this game, it's not gonna stop them...
A friendly suggestion: change all the $nick to $wildsite in the evaluation brackets. People tend to change their nicknames every now and then, and if they do, mIRC won't be able to keep an accurate count or info. Another way is to make a nick event to detect nickname change and have the variable reflect it in real time, but that's a tad tedious.