Author Topic: Bot Scripting  (Read 1625 times)

Offline gamerscd0

  • Jr. Member
  • **
  • Posts: 84
Bot Scripting
« on: May 26, 2005, 01:21:59 PM »
i wish to make a bot and any help or ideas would be appreciated
iwold like to have auto voiceing, quotes , also auto topic
change , when you say a sware word auto kick ,and can answer some questions (like fishbot) also auto invite

thanks for your help
« Last Edit: May 26, 2005, 01:31:45 PM by gamerscd0 »

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1195
    • http://www.eddy-b.com
Bot Scripting
« Reply #1 on: May 27, 2005, 05:28:40 AM »
What client are you planning to use (if any) ?
The choice of client determines the language you will be scripting in.
[size=8]Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1[/size]
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4112
Bot Scripting
« Reply #2 on: May 27, 2005, 06:59:49 AM »
Im sure hes gonna be using mIRC, and scripting in mIRC lang.

Open mIRC and goto Tools > Scripts Editor, select the Remote tab.

A simple on text reply is done like this:
Code: [Select]
on *:TEXT:<The Text Said>:#<chan name>:{ msg $chan Hello! }
The text said is what is typed to get the command to run. for channel name, if you dont specify a channel it will run in any channel.
The msg means its a msg command being run, and it is doing to msg to the channel where the text was said. If you did msg $nick it would private message the nick who said the text.
If you did notice $chan or $nick it would notice the message to that channel or nick. Notices are not shown in the channel, they are like private messages, but dont bring up a new window on mIRC. Also they will show in the active window of the user who recives the message.

For auto voicing, you want to do it when a user joins the channel, so:
Code: [Select]
on *:JOIN:#:{ mode $nick +v }
Any status commands are modes, like op or voice, so we use the mode command.

For kick on word:
Code: [Select]
on *:TEXT:<Word>:#:{ kick $nick <Kick Reason>}

Here is the quote system e-m00 wrote for his bot:
To use it, put the code in a file called quote_system.mrc then save that to mirc folder and then add this to the remote box with ur other commands:
Code: [Select]
on *:LOAD:{ load -rs quote_system.mrc }
Code: [Select]
on *:TEXT:!delquote*:#chan:{
  if (%delquoteavailable == yes) {
    if ($read(quotes.txt, $2) == $null) && ($2 !isalpha) && ($2 isnum) {
      if ($hget(normalin, $address($nick,2)) == yes) || ($hget(uberin, $address($nick,2)) == yes) {
        msg #chan Quote $2 does not exist.
        halt
      }
      else {
        halt
      }
    }
    if ($read(quotes.txt, $2) != $null) && ($2 !isalpha) && ($2 isnum) {
      if ($hget(normalin, $address($nick,2)) == yes) || ($hget(uberin, $address($nick,2)) == yes) {
        msg $chan $nick would like to delete quote $2 $+ . The channel will now vote on deletion of quote $2 $+ . /msg $me yea to vote in favor of deletion, and nay to vote against. Votes cast during the next 30 seconds are valid.
        set %quotevote on
        set %quoteinquestion $2
        set %delquoteavailable no
        timerquotevote 1 30 checkquotevote
      }
      else {
        halt
      }
    }
    elseif ($2 isalpha) || ($2 isnum) {
      halt
    }
  }
  else {
    notice $nick There is a delquote vote in progress, please wait for it to finish before deleting another quote.
    halt
  }
}
on *:NOTICE:!addquote*:{
  if ($hget(voicein, $address($nick,2)) == yes) || ($hget(semiin, $address($nick,2)) == yes) || ($hget(normalin, $address($nick,2)) == yes) || ($hget(uberin, $address($nick,2)) == yes) && ($2 != $null) {
    write quotes.txt $2- Submitted by $nick at $time(h:nn TT) on $date(mmmm d yyyy)
    msg $chan Quote added as quote number $calc(%quotes + 1) $+ , use !quote to get a random quote or !quote quotenumber for a specific quote.
    inc %quotes
  }
  else {
    halt
  }
}
on *:TEXT:!hmq:#:{
  if (%quotes != 1) && ($2 == $null) {
    msg $chan There are %quotes quotes in the database. Use !quote for a quote or type !quote <quote number> for a specific quote.
    halt
  }
  if (%quotes == 1) && ($2 == $null) {
    msg $chan There is %quotes quote in the database. Use !quote for a quote or type !quote <quote number> for a specific quote.
    halt
  }
}
on *:TEXT:!quote*:#outpost2.lobby:{
  if (!quote == $1) {
    if ($read(quotes.txt, 1) != $null) && ($2 == $null) {
      msg $chan Random quote: $+ $read(quotes.txt) Quote $readn
      halt
    }
    if ($read(quotes.txt, 1) != $null) && ($2 != $null) && ($read(quotes.txt, $2) != $null) && ($2 !isalpha) && ($2 isnum) {
      msg $chan Quote $2 $+ : $+ $read(quotes.txt, $2)
      halt
    }
    if ($read(quotes.txt, 1) != $null) && ($2 != $null) && ($read(quotes.txt, $2) == $null) && ($2 isnum) {
      msg $chan Quote $2 does not exist.
      halt
    }
    if ($read(quotes.txt, 1) == $null) {
      msg $chan No quotes in database.
    }
    elseif ($2 isalpha) || ($2 !isnum) {
      msg $chan Invalid quote request.
    }
  }
  elseif (!quote != $1) {
    halt
  }
}
alias checkquotevote {
  if ($calc(%yea + %nay) >= 3) {
    if (%yea > %nay) {
      write -dl $+ $2 quotes.txt
      msg $1 Vote successful. Quote %quoteinquestion deleted.
      msg $1 Vote results: Yea - %yea vs. Nay - %nay $+ .
      write -c quotevoted.txt
      set %yea 0
      set %nay 0
      unset %quotevote
      unset %quoteinquestion
      dec %quotes
      set %delquoteavailable yes
      close -m
      halt
    }
    elseif (%yea < %nay) {
      msg $1 Vote unsuccessful. Quote %quoteinquestion will not be deleted.
      msg $1 Vote results: Yea - %yea vs. Nay - %nay $+ .
      set %yea 0
      set %nay 0
      unset %quotevote
      unset %quoteinquestion
      write -c quotevoted.txt
      set %delquoteavailable yes
      close -m
      halt
    }
    elseif (%yea == %nay) {
      msg $1 The channel is undecided. Quote %quoteinquestion will not be deleted.
      msg $1 Vote results: Yea - %yea vs. Nay - %nay $+ .
      set %yea 0
      set %nay 0
      unset %quotevote
      unset %quoteinquestion
      write -c quotevoted.txt
      set %delquoteavailable yes
      close -m
      halt
    }
  }
  else {
    msg $1 A combined minimum of 3 voters is required to continue a vote. Quote %quoteinquestion will not be deleted.
    msg $1 Vote results: Yea - %yea vs. Nay - %nay $+ .
    set %yea 0
    set %nay 0
    unset %quotevote
    unset %quoteinquestion
    write -c quotevoted.txt
    set %delquoteavailable yes
    close -m
    halt
  }
}

To do multi commands on a event use a | to seprate them, eg:
Code: [Select]
on *:JOIN:#:{ msg $chan Hello | msg $chan Welcome }

The command in the brackets is just like if you typed it, so msg is /msg etc.

Make sure you take a look at a mIRC help. Also the mirc scrpting channel for help on QuakeNet is #help.script.
« Last Edit: May 27, 2005, 07:16:53 AM by Leviathan »

Offline thablkpanda

  • Full Member
  • ***
  • Posts: 249
Bot Scripting
« Reply #3 on: May 27, 2005, 07:05:10 PM »
:: Pretends To Understand and Nods his head ALOT ::

Panda

Offline gamerscd0

  • Jr. Member
  • **
  • Posts: 84
Bot Scripting
« Reply #4 on: May 28, 2005, 06:49:17 PM »
i have c++ too so...

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4112
Bot Scripting
« Reply #5 on: May 29, 2005, 10:37:17 AM »
use mirc for ur bot, mirc scripting is easy.

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1195
    • http://www.eddy-b.com
Bot Scripting
« Reply #6 on: May 29, 2005, 01:52:15 PM »
Quote
i have c++ too so...
i got c++ code that allows bot creation :D
[size=8]Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1[/size]
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4112
Bot Scripting
« Reply #7 on: July 03, 2005, 04:59:16 PM »
eg

on *:TEXT:op2:#outpost2.lobby:{ msg #Outpost2.lobby op2 owns }

op2 is the text

#Outpost2.lobby the channel

and the cmd is msg #Outpost2.lobby with op2 owns