mIRC Home    About    Download    Register    News    Help

Print Thread
Scripts for an mirc bot #155635 08/08/06 04:30 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
Here are a few of the things I want to be able to do with my bot.

Take 3 nicks
Zaephyr
Darkhawk
Midnight

when the nicks enter the room I want my bot to say a certain message for each nick such as this

Welcome home, Mistress Zaephyr.
Greetings Master Darkhawk.
Hello Mistress Midnight.

another thing I want to be able to do is these

!bindf [nick]

would have Nisstyre perform this action:
Nisstyre takes [nick] and binds her hands securely.

and lastly I want my bot to say random things while its in the room.

Things like
actions:

Nisstyre wanders over to the bar and pours herself a drink.

or have her say things:

Nisstyre: God it's still monday.

Anyone that can help me do this, I'd really appreciate it.

Re: Scripts for an mirc bot #155636 08/08/06 04:54 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) Search for Greeting scripts. They've been done a fair bit, from very simple to very complicated.
2)
Code:
 on *:text:!bindf*:#:{
if !$2 {
.notice $nick You have to specify who you want to have bound
}
elseif $2 !ison $chan {
.notice $nick Sorry, but $2 has to be present for me to bind her
}
else {
describe # takes $2 and binds her hands securely
}
}

3) Create a text file with a different saying on each line
NOTE:This is NOT for actions
Code:
 on me:*:join:#:{
.timer 1 1800 .msg $chan $!read(saying.txt)
}
 

You will have to have the bot leave and rejoin the room. The bot will send a random message from the file saying.txt to the channel every 30 minutes

Re: Scripts for an mirc bot #155637 08/08/06 04:58 AM
Joined: Dec 2002
Posts: 1,527
L
landonsandor Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,527
In all the examples, replace #channel with the channel name.

Code:
on *:join:#channel: {
  if ($nick == Zaephyr) { msg # Welcome home, Mistress Zaephyr. }
  if ($nick == Darkhawk) { msg # Greetings Master Darkhawk. }
  if ($nick == Midnight) { msg # Hello Mistress Midnight. }
}


on *:text:!bindf *:#channel:/describe takes $2 and binds her hands securely.

As for the random actions, you'd need to do something like this (as an example):

on *:text:!ract:#:/msg # $read(random.txt)

You then place all kinds of random events in a Random.txt file in your mirc directory and the $read function would take a random line from it. If you wanted to combine the two ON TEXT events, try this:


Code:
on *:text:*:#channel: {
  if (!bindf == $1) { /describe takes $2 and binds her hands securely. }
  if (!ract == $1) { msg # $read(random.txt) }
  halt
}


Those who fail history are doomed to repeat it
Re: Scripts for an mirc bot #155638 08/08/06 05:13 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
I feel stupid, but I can get the script to work at all. Nothing happens. I dont know what I'm doing wrong.

I'm using the Dragonbot 1.4 found on www.geocities.com/irc_dragonbot/

I set the dragonbot.ini file to automatically open the greet.ini file

in the greet.ini I copy pasted the script

on *:join:#channel: { if ($nick == Zaephyr) { msg # Welcome home, Mistress Zaephyr. } if ($nick == Darkhawk) { msg # Greetings Master Darkhawk. } if ($nick == Midnight) { msg # Hello Mistress Midnight. }}

Exactly like it was shown when landon posted. But it wont do anything when I leave and reenter.

Re: Scripts for an mirc bot #155639 08/08/06 05:25 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The script does NOT go in the ini file. It goes into a remote file on the bot. Go to your bot's client, Press Alt R, click Remotes, click File - New, copy and paste the script into the new remote file that you just created.
Click OK to close the Script editor.

Personally I'm sceptical when it comes to codes that have the mIRC files included with the script and/or everything is contained in an executable. Also please note that the most recent version of DragonBot (according to the website) has mIRC 6.15 with it. There have been 3 releases of mIRC since that time. It has been roughly 2 years since 6.16 was released (although it came out only about a month after 6.15, which is the version that comes with DragonBot)

If you're having trouble working with/configuring DragonBot, then you should be corresponding with the author.

Last edited by RusselB; 08/08/06 05:38 AM.
Re: Scripts for an mirc bot #155640 08/08/06 05:41 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
is there a way to change landon's script for the !bindf so that if someone uses !bindf Midnight it doesn't appear in the room, only the results?

Re: Scripts for an mirc bot #155641 08/08/06 06:05 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
if i understand properly...
Code:
on ^*:text:*:#channel: {
  if (!bindf == $1) { /describe takes $2 and binds her hands securely. | haltdef }
  if (!ract == $1) { msg # $read(random.txt) }
}


-KingTomato
Re: Scripts for an mirc bot #155642 08/08/06 06:16 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes, it's possible
Code:
 on *:text:*:*: {
  if (!bindf == $1) { /describe #channel takes $2 and binds her hands securely. }
elseif (!ract == $1) { msg #channel $read(random.txt) }
} 

You'll have to replace #channel with the actual name of the channel/room.

Usage so that only the results show in the channel: /msg <bot's name> !bindf <nick>

The options that I had in my code, such as ensuring that there was a nick entered and that the person is on the channel have not been incorporated here.

Re: Scripts for an mirc bot #155643 08/08/06 06:16 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
I got that part now King, it needed to be /describe $chan to place it in the channel window.

But now I'm having more trouble.

would the !ract thing make the bot say things on its own? or would you have to type !ract in the room?

I needed something that made a bot speak randomly, with random times and such.

And with actions as well as speaking.

Re: Scripts for an mirc bot #155644 08/08/06 06:21 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
For the random messages, refer to my original post item #3.

Re: Scripts for an mirc bot #155645 08/08/06 06:32 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
But is there a way to randomize the timing a bit more? instead of just every 30 minutes, couldnt it be set to do at random times?

Re: Scripts for an mirc bot #155646 08/08/06 06:34 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Here's the entirety of what you were looking for. Make a new text file in your mIRC directory named brand.txt (you can use //run notepad.exe $+(",$mircdirbrand.txt,") to have notepad make it for you). Within in, put your acitions/msgs. For actions, prefix the messages with /me. E.g. for the two demo's you gave, make the text file read:

Code:
God it's still monday.
/me wanders over to the bar and pours herself a drink.


And here is the code:

Code:
alias -l brandtime {
  var %lowtime = 300  [color:blue]| ; quickest duration between messages (in seconds)[/color]
  var %hightime = 900 [color:blue]| ; longest duration between messages (in seconds)[/color]
  return $rand(%lowtime,%hightime)
}
alias brandmsg {
  var %rline = $read(brand.txt)
  if (/me* iswm %rline) /describe $chan $gettok(%rline,2-,32)
  else /msg $chan %rline
  .timer [ $+ [ $1 $+ $2 ] ] 1 $brandtime brandmsg $1-
}
on *:JOIN:#: {
  .timer [ $+ [ $chan $+ $server ] ] 1 $brandtime brandmsg $chan $server
  
  ; add a new message using %msg.&lt;nickname&gt; format
  ; use $nick for their name
  var %msg.Zaephy   = Welcome home, Mistress $nick $+ .
  var %msg.Darkhawk = Greetings Master $nick $+ .
  var %msg.Midnight = Hello Mistress $nick $+ .
  if (%msg. [ $+ [ $nick ] ]) /msg $chan $v1
}
on ^*:TEXT:!bindf &amp;:#: {
  /describe $chan takes $nick and binds her hands securely.
  /haltdef
}

*untested, let me know of any bugs

Last edited by KingTomato; 08/08/06 06:37 AM.

-KingTomato
Re: Scripts for an mirc bot #155647 08/08/06 06:46 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
that doesnt work, it wont randomly show up anything

Re: Scripts for an mirc bot #155648 08/08/06 06:54 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I'm sorry. Almost 3am here, brain farts. Try this: the rand messages were tested, just not the bindf or greetings.

[code]
alias -l brandtime {
var %lowtime = 300 | ; quickest duration between messages (in seconds)
var %hightime = 900 | ; longest duration between messages (in seconds)
return $rand(%lowtime,%hightime)
}
alias brandmsg {
var %rline = $read(brand.txt)
if (/me* iswm %rline) /describe $1 $gettok(%rline,2-,32)
else /msg $1 %rline
.timer [ $+ [ $1 ] ] 1 $brandtime brandmsg $1-
}
on *:JOIN:#: {
if ($nick == $me) .timer [ $+ [ $chan ] ] 1 $brandtime brandmsg $chan $server

; add a new message using %msg.<nickname> format
; use $nick for their name
var %msg.Zaephy = Welcome home, Mistress $nick $+ .
var %msg.Darkhawk = Greetings Master $nick $+ .
var %msg.Midnight = Hello Mistress $nick $+ .
if (%msg. [ $+ [ $nick ] ]) /msg $chan $v1
}
on ^*:TEXT:!bindf &:#: {
/describe $chan takes $nick and binds her hands securely.
/haltdef
}
[code]


-KingTomato
Re: Scripts for an mirc bot #155649 08/08/06 07:13 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
Ok, how do I set up the message to run like this.

For that last scripting, with the brand.txt file giving out the messages to run, how do I set the date to show the accurate date such as. God, is it still {day of the week}

Re: Scripts for an mirc bot #155650 08/08/06 08:17 AM
Joined: Aug 2006
Posts: 27
Z
Zaephyr Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Aug 2006
Posts: 27
Nevermind that last posting, I managed to figure out how to get it done, but now I have another question.

How would I write a line in the file brand.txt in order to make the bot do this as a random action.

Nisstyre kneels beside Mistress Zaephyr and asks softly, "Would you like something to drink Mistress?"

But instead of Mistress Zaephyr, I want it to pull a random nick from somebody in the room at the time.

So if there are five people, named A, B, C, D, E how would I write it for the bot to choose a nick randomly and then ask it using that nick?

Also, how could I add a title to the names as in

Mistress A
Master B

where if nick B is chosen she says Master B, or if nick A is chosen she says Mistress A

Re: Scripts for an mirc bot #155651 08/08/06 11:59 AM
Joined: Jul 2006
Posts: 26
I
Inky Offline
Ameglian cow
Offline
Ameglian cow
I
Joined: Jul 2006
Posts: 26
You can set welcome messages with the standard /botserv bots, put one of those in your channel, then type /botserv HELP, I'm sure it will explain how to set them up.


Very new to mIRC, don't know much.
Re: Scripts for an mirc bot #155652 08/08/06 03:28 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
The brand file accepts using mIRC commands. When the random action/msg is pulled, it is also evaluated.

If you wanted a random name, there is a few ways to go about it. One is if you want a random one form a specific list, you could use something like:

$gettok(A B C D E,$calc($rand(1,999) % 5 + 1),32)

The A B C D E would be the list of specific nicknames to use, the 5 is the number of names in that list. If you want a random nickname from the channel, use this:

$nick($chan,$calc($rand(1,999) % $nick($chan,0) + 1))

To ad Mistress or Master before either (You won't be able to do specify it based on gender, unless you coded a work-around, but if you wanted just a simple random, use:

$iif($calc($rand(1,999) % 2),Mistress,Master)

Add that before either of your random commands. Again, put any of this information in the brand file, and mIRC will evaluate it at the time of the random message.


-KingTomato