Hey guys, it's Wariopower. I haven't posted a snippet or scripted on mIRC in a long while so I decided to make this. It's a mIRC Friend Code Database! Here's how it works:
How it works: What you do is type !fc for basic commands your bot will list. Those commands are
!addfc Person(Game): Friend Code and !findfc Person(Game). Edits: I changed the YOURBOT option to setting a %botnick, much easier.
How to activate it: Place this script in the remote tab and you are good to go!
That's about it. Later I might change this script from .txt files to hash tables, we'll see. :P I hope you all enjoy!
~ Wariopower
~ This script was made by Wariopower at #WarizardWorks on irc.purplesurge.com ~
on *:load: { set %botnick $$?="Botnick?" }
alias changebot { set %botnick $$?="Botnick?" }
on *:TEXT:*:*: {
if ($1 == !fc) {
if ($me == %botnick) {
.timer 1 1 msg $chan Thank you for using Wariopower's Friend Code System.
.timer 1 2 msg $chan Type !addfc Person(Game): FriendCodeHere to add a friend code.
.timer 1 3 msg $chan Type !findfc Person(Game) to view stored friend codes.
}
}
elseif ($1 == !addfc) {
if ($me == %botnick) {
.timer 1 1 write fc.txt $2-
.timer 1 2 msg $chan $2- has been added.
}
}
elseif ($1 == !findfc) {
if ($me == %botnick) {
.timer 1 1 msg $chan $read(fc.txt,w,* $+ $2 $+ *)
}
}
}
How did i not comment on this yet :|! and why so compliated people? Just do this my friend, the easy way.
on *:load: {
set %bot $$?"What is your bots name?"
}
menu * {
Bot-Name: set %bot $$?"What is your bots name again?"
}
if ($me != %bot) { halt }
To be honest, i was just testing somthing with this post.
lol ok
on *:LOAD:{
set $+(%,YOURBOT,$chr(32),$$?"enter your bot's name here")
echo YOu have saved your bots name as $! i am not sure why and i can not be bothered to find out either It may be $mnick or by my other name as $anick , i could find out but again don't have the time so yea if you do want to edit this just go to variables find it and change it other wise :P }
But then again if he wanted to change it he could all ways add this in
menu * {
Change bot's name:/set $+(%,YOURBOT) $$?"Enter the bot's new name"
}
slub77
Scroll up. sk68 was quoting you and offering
a valid simplication of your suggestion. Jethro
was following up with his suggested clarification.
With my previous post I choose to not comment
on YOURBOT issue because I was sorta all about
not repeating that same if $me condition three
times when one time was enough/better. Mostly
I ignore issues about nick, channel, colors, etc
on the theory that we are all capable of modifying
those things the way we want.
on *:LOAD:set $+(%,YOURBOT,$chr(32),$$?"enter your bot's name here") | echo -a Your Bot's name set to: $! and you can never change it because I did not script a fancy 500 byte dialog box to edit it and even if i did you wouldnt remember the command to call it up three months from now when you change your bot's name.. you could always like goto variables section of your script editor.. but i digress.. wait.. is this like too long for an echo?..
I think my way is better.. lol d;-P
Jethro
Nice use of goto jumps.
Saves a little space.
Should run faster also.
Just a few tweeks.
BTW.. wouldnt messaging the channel to tell peeps
to wait 10 seconds sorta negate the whole flood
protection provided by %b ???
on *:TEXT:!*:#: {
if $me = YOURBOT {
if !%b {
inc -u9 %b | goto $strip($1)
:!findfc | msg # $read(fc.txt,w,$+(*,$2,*)) | halt
:!addfc | write fc.txt $2- | msg # $2- has been added. | halt
:!fc | msg # Thank you for using Wariopower's Friend Code System. $&
Type !addfc Person(Game): FriendCodeHere to add a friend code. $&
Type !findfc Person(Game) to view stored friend codes.
}
}
}
Or you could use a loop command, along with a simple flood protection:
on *:TEXT:!*:#: {
if ($me == YOURBOT) {
var %a = $strip($1)
if (!%b) {
set -z %b 10 | goto %a
:!findfc | msg # $read(fc.txt,w,* $+ $2 $+ *) | halt
:!addfc | write fc.txt $2- | msg # $2- has been added. | halt
:!fc | msg # Thank you for using Wariopower's Friend Code System. $&
Type !addfc Person(Game): FriendCodeHere to add a friend code. $&
Type !findfc Person(Game) to view stored friend codes. | halt
}
else { msg # $nick $+ , please wait 10 seconds before using the %a command. }
:%a | return
}
}
You don't need to make three /msg commands. Just use the line break identifier to make them into one.
Dont think the timers are needed.
Needs some type flood protection.
Should put everything within if $me condition.
Maybe rearrange if/elseif conditioms so most
used item is first.
ON *:TEXT:!*:#: {
if ($me == YOURBOT) {
if ($1 == !findfc) {
msg # $read(fc.txt,w,* $+ $2 $+ *)
}
elseif ($1 == !addfc) {
write fc.txt $2-
msg # $2- has been added.
}
elseif ($1 == !fc) {
msg # Thank you for using Wariopower's Friend Code System.
msg # Type !addfc Person(Game): FriendCodeHere to add a friend code.
msg # Type !findfc Person(Game) to view stored friend codes.
}
}
}