mIRC Home    About    Download    Register    News    Help

Print Thread
funbot / barbot / bar script please help #111717 18/02/05 07:42 AM
Joined: Feb 2005
Posts: 344
B
Bullseye Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
I'm trying to make a barscript or barbot or funbot whatever you like to call it.
My problem now is that i want multiple responds for the bot to pick from.
One way to do that is via a txt file.
The problem there is that you can't give the line a command how to show up in the channel.
Example:
I have 5 responds for cola.
3 of them have to show up as a action in the room that means using the /me command.
on 1:TEXT:*:#:{
if ($1 == .cola) {
/msg $chan $read cola.txt
As you see this kind of script is using /msg to send the text from the txt file.
But I can't seem to get it working with a /me command.
I don't know if it is possible whit this kind of scripting.
Isn't there a way to put the responds in the script like this:
if ($1 == .cola) {
/me is going to get some icecold cola for $nick
/me throws a can of pepsi to $nick
/say sorry we're out of cola $nick
}
instead of a txt file?

Re: funbot / barbot / bar script please help #111718 18/02/05 08:42 AM
Joined: Oct 2003
Posts: 37
R
Rumie Offline
Ameglian cow
Offline
Ameglian cow
R
Joined: Oct 2003
Posts: 37
use /describe <chan> <msg>

Re: funbot / barbot / bar script please help #111719 18/02/05 09:11 AM
Joined: Feb 2005
Posts: 344
B
Bullseye Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Ok that helps me with the /me problem.
Now i have this:
if ($1 == .cola) {
/describe #club asks pepsi or coke ????
/describe #club gets a can of cola for $nick
/msg $chan We're out of cola $nick
}
This sends all the messages to the channel.
How do I make it pick one line??

Re: funbot / barbot / bar script please help #111720 18/02/05 09:19 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
using your original code unchanged you can do it.
Code:
on 1:TEXT:*:#:{
  if ($1 == .cola) {
    /msg $chan $read cola.txt

* note your using the old method of file $read here but I left it as is.

Simple add at the start of any of the lines to be /me the text inside "" ..... "ACTION "
In case that didnt come through in this forum you can make it using //echo " $+ $chr(1) $+ ACTION "
Copy only the text you get between the "" and paste that on the start of each /me line.

When you see the MSG in your channel it well look like <YourNameHere> ACTION your text here
Everyone else well see it as * YourNameHere your text here

What are u doing? your sending the additional information in your message to the channel that makes the text appear to everyone else as /me over /msg

OR

you can change your code to this

Code:
on 1:TEXT:*:#:{
  if ($1 == .cola) {
    $read(cola.txt,t)

* I dont actually endorse this as the best method.

And your cola.txt file contents to this...
describe $chan says boo to $chan
describe $chan looks around and sees no one important
msg $chan sees you $nick
etc

Whats happening?
you read a line of the cola.txt file and execute it as a line of your actual code, line 1 & 2 of the file is a /me but use /describe $chan which is the same as /me with a specific channel defined, in this case $chan, line 3 is a /msg $chan of course.
What to look out for is WATCH WHAT YOU PUT IN THE COLA.TXT FILE its executed as a command so if u put in a line that was part $chan guess what? your gonna part the channel!

another way could be

Code:
on 1:TEXT:*:#:{
  if ($1 == .cola) {
    var %t = $read(cola.txt,t)
    if $gettok(%t,1,32) == s { msg $chan $gettok(%t,2-,32) | return }
    if $gettok(%t,1,32) == m { describe $chan $gettok(%t,2-,32) | return }


And your cola.txt file contents to this...
m says boo to $chan
m looks around and sees no one important
s sees you $nick
etc

whats happeing?
It reads a line in if the lines first word $gettok(%t,1,32) is "m" it is a /me (using /describe $chan) if its a "s" its a /say (using /msg $chan)
$gettok(%t,2-,32) is word 2 onward

you choose your prefered method, these arnt the only ones of course.

Re: funbot / barbot / bar script please help #111721 19/02/05 07:39 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Reading this thread has made me thirsty. frown