mIRC Friend Code Database

By #Warizardworks on Oct 08, 2009

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 $+ *)
    }
  }
}

Comments

Sign in to comment.
#Warizardworks   -  Nov 22, 2009

Hmm, I'm not sure. A scripting friend made a script like this using hash tables. I'm wondering if I should try that out...
~ Wariopower

 Respond  
Ghost-writer   -  Oct 11, 2009

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.

 Respond  
slub77   -  Oct 11, 2009

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"
}
 Respond  
gooshie   -  Oct 10, 2009

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

 Respond  
slub77   -  Oct 10, 2009

OMG dude u stole what i said XD jethro look up i put that just simpler lol XD

 Respond  
Jethro   -  Oct 10, 2009

Nothing's wrong with it. It was only a suggestion regarding > if ($me == YOURBOT)However, you can do it this way:

on *:LOAD:{
  set $+(%,YOURBOT,$chr(32),$$?"enter your bot's name here")
}
ON *:TEXT:!*:#: {
  if ($me == %YOURBOT) {
 Respond  
sk68   -  Oct 10, 2009

on *:LOAD:{
/echo $$?"enter your bot's name here"
set $+(%,bot) $!
}

whats wrong with on *:LOAD: set %bot $$?"enter your bot's name here"

 Respond  
Jethro   -  Oct 10, 2009

BTW.. wouldnt messaging the channel to tell peeps
to wait 10 seconds sorta negate the whole flood
protection provided by %b ???
Ouch, I totally overlooked the fact about that. Thanks for the tweak, gooshie. You made it better than it was. ^^

 Respond  
gooshie   -  Oct 09, 2009

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.
    }
  }
}
 Respond  
#Warizardworks   -  Oct 09, 2009

Wow, cool. Thanks guys for all your awesome suggestions. As I advance in my scripting abilities, I'll use these other better methods way more than I do now. :P
~ Wariopower

 Respond  
slub77   -  Oct 09, 2009

why not have it so you have it use on *:load: ?

on *:LOAD:{
/echo $$?"enter your bot's name here"
set $+(%,bot) $!
}

then in the bit's where it says YOUR NOTS NAME change it to %bot

 Respond  
Jethro   -  Oct 09, 2009

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.

 Respond  
gooshie   -  Oct 08, 2009

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.
    }
  }
}
 Respond  
#Warizardworks   -  Oct 08, 2009

Haha, well. I use my personal bot "WariBot" and insert his name if if ($me == YOURBOT) { so I can use the friend code script myself, so yeah. :P
~ Wariopower

 Respond  
sk68   -  Oct 08, 2009

why the if ($me == YOURBOT) ? seems kinda pointless

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.