mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
Hi IRC Experts

Could someone help me with a few remote scripts for a bot I'm using?

1) When I type !forum -> The bot replies with a PM link to a specified forum.

2) When I type !mod or !invite -> It replies with a PM. At the same time, the bot pings designated people online. Also, how should I set these designated people?

3) When I type !calc -> The bot does calculations?

And a general question, how I get the bot to join invite only channels? I'm doing /cs invite at the moment but I have to actually click it myself. How can I get the bot to automatically accept an invite?

Thanks guys!

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
In Options, IRC, there's an option "auto-join on invite", which should do the trick. Of course it would accept any invite, so other users would be able to invite your bot to weird places. Another solution would be:

Code:
on *:invite:#yourchannel: {
  /join -n $chan
}


You could also do:

Code:
on chanserv:invite:#: {
  /join -n $chan
}


And then add an entry for chanserv on your network on the Users tab. If you only need 1-3 channels, use the first method instead.

As for reacting to triggers, you're looking for:

Code:
on *:text:!forum:*: {
  /msg $nick The forum is located here.
}


Any kind of commands you can use yourself in the editbot, you can put in that script, and then some.

EDIT: Forgot code blocks.

Last edited by Thels; 26/08/10 09:51 AM.

Learning something new every day.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I think he wants the script to ask someone for an invite, not to actually invite someone or to join when invited.

Code:
on *:text:*:#yourchannel: {
  if ($1 == !invite) { msg $nick Requesting invite. | msg SOMENICK $nick requested invite to $chan $+ . }
  elseif ($1 == !mod) { msg $nick Requesting help from a mod. | msg SOMENICK $nick needs help. }
  elseif ($1 == !forum) { msg $nick Our forum is located at http://www.google.com/ }
  elseif ($1 == !calc) { msg $nick $calc($remove($$2-,$chr(36),$chr(124)) } 
}


Keep in mind with !calc that it will mostly only do basic calculations. Also, someone can verify if that is safe how I have it set up. I removed $ and | which should prevent any improper use of the command, but there may be other things that should be considered with such a command that I'm not thinking of.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: Riamus2
I think he wants the script to ask someone for an invite, not to actually invite someone or to join when invited.


From what I understood, the bot is automatically asking Chanserv for an invite, but then doesn't actually accept the invitation.

Y'know, an even easier method would just to be:

/cs invite #channel
.timer 1 5 join #channel

That basically assumes that Chanserv will give you the invite, and then try joining the channel 5 seconds later. Not the most clean way of doing it, but surely the easiest.


Learning something new every day.
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Originally Posted By: Riamus2

Keep in mind with !calc that it will mostly only do basic calculations. Also, someone can verify if that is safe how I have it set up. I removed $ and | which should prevent any improper use of the command, but there may be other things that should be considered with such a command that I'm not thinking of.


$calc($$2-) would be completely safe; the only potentially undesirable behaviour that could occur is evaluation of variables.


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
Hey guys

Wow, thanks for replying to quickly.

I've added the auto invite command into perform and it works great!

Re: The script for ! commands and calculator.

1) the SOMENICK part. I guess it's for one nick. Can I add multiple nicks? If so, how?

2) The calculator - Can I increase the limits of calculations?

Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
Hi all

It's me again. Just testing out the script.

A few issues:

1) When I type !invite, the bot says Incorrect command usage: !invite <nickname> and then says 'Requesting invite' and then messages a person saying I requested an invite. The problem is that it does this twice. Any idea why?>

2) When I type !calc, there's no reaction from the bot. The script has been loaded. Is there something else I need to active?

Thanks

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: GEFFO
1) the SOMENICK part. I guess it's for one nick. Can I add multiple nicks? If so, how?


Just copy/paste the command:

Code:
elseif ($1 == !mod) { msg $nick Requesting help from a mod. | msg SOMENICK1 $nick needs help. | msg SOMENICK2 $nick needs help. | msg SOMENICK3 $nick needs help. }


If you end up with a lot of moderators, it might help to store these in a hash file, and scan through that, and then check as well if they are only before blindly sending them text, but that's a little more advanced.

Quote:
2) The calculator - Can I increase the limits of calculations?


It does anything $calc() does. As said, it's recommended to replace/remove the $ and % characters, because otherwise other users would have access to your variables and routines.

If you want more than that, you'd have to script your own routine.


Learning something new every day.
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: GEFFO
Hi all

It's me again. Just testing out the script.

A few issues:

1) When I type !invite, the bot says Incorrect command usage: !invite <nickname> and then says 'Requesting invite' and then messages a person saying I requested an invite. The problem is that it does this twice. Any idea why?>

2) When I type !calc, there's no reaction from the bot. The script has been loaded. Is there something else I need to active?

Thanks


You're most likely have more than one script installed, or have more than one ON TEXT entry in your script.

Each event will only trigger a single ON event entry per Remote script, though you can load multiple Remote scripts and have each of them affect your text.


Learning something new every day.
Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
Hi

Everything is working now except one thing. The calculator.

The bot doesn't respond at all. Is there a code that I code copy and paste into the original set? This code should enable the bot to sent a message to the actual channel in which the math question is asked rather than a PM.

Thanks

Last edited by GEFFO; 26/08/10 11:38 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just change msg $nick to msg $chan.

As to it not responding, make sure you have only that script there and make sure you're using valid calculation requests. Try:

!calc 1+1

Considering you said the bot was replying with an error message (which wasn't included in what I wrote for you), most likely you have another script loaded and it's giving you the issues.

Also, you can usually use: msg nick,nick,nick some message to send a message to multiple nicks. There is a limit on the number you can send to at once though and that depends on the server. ** You may need spaces after each comma in that. I can't test right now.

You might also want to change the !calc line to:

Code:
  elseif ($1 == !calc) { msg $chan $2- = $calc($$2-) }


That will show the requested calculation along with the answer. And, per jaytea, we shouldn't really need to remove anything and I tried a few tests which don't give problems, so that should be fine.

Last edited by Riamus2; 26/08/10 12:21 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
That works sweeetly. Thank you!

One more dumb question.

I've added $chan $nick so that it pings the user. How do I get a : after their nick when it pings them?

Also, how do I add commas to my answers?

Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
Oh yeah - Another one to test everyones skills.

Say the bot is in a private room (A) where there is only ops. A person comes into a normal chan (B) and wants an invite to another private room (C). The person types !private. At this point, how do I get my bot to send through a msg to the channel A. How do I also script the bot so that when the ops type !invite $nick, the person in channel B gets an invite and a message saying you're invited to channel C?

P.S. My calculator can't seem to read or process commas lol. How do I get it to do this?


Joined: Jan 2009
Posts: 116
Vogon poet
Offline
Vogon poet
Joined: Jan 2009
Posts: 116
Originally Posted By: GEFFO
That works sweeetly. Thank you!

One more dumb question.

I've added $chan $nick so that it pings the user. How do I get a : after their nick when it pings them?

Also, how do I add commas to my answers?


Have a look at $+, it allows you to merge 2 tokens (words) together.

for example:

Code:
$+($nick,:)

or
Code:
$nick $+ :


The results of the above are the same. Do it however you like. ;_)


http://zowb.net

/server -m irc.p2p-network.net -j #zomgwtfbbq
(ssl on port 6697 and 7000)
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: GEFFO
Oh yeah - Another one to test everyones skills.


It's more about understanding what you want precisely. :P

Originally Posted By: GEFFO
Say the bot is in a private room (A) where there is only ops. A person comes into a normal chan (B) and wants an invite to another private room (C). The person types !private. At this point, how do I get my bot to send through a msg to the channel A. How do I also script the bot so that when the ops type !invite $nick, the person in channel B gets an invite and a message saying you're invited to channel C?


First, your bot needs to be on both channels #A and #B, since you want to pick up a message from #B and want to display it in #A.

Code:
on *:text:!private:#B: {
  msg #A $nick said !private in $+(#B, .)
}


Quote:
P.S. My calculator can't seem to read or process commas lol. How do I get it to do this?


In your script, you can use $chr(44) instead of a comma.


Learning something new every day.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Originally Posted By: GEFFO
P.S. My calculator can't seem to read or process commas lol. How do I get it to do this?
Calculations are done with the English period notation for decimal numbers.
You could probably replace commas by periods beforehand though:
Code:
$calc($replace($$2-,$chr(44),$chr(46)))

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: 5618
Originally Posted By: GEFFO
P.S. My calculator can't seem to read or process commas lol. How do I get it to do this?
Calculations are done with the English period notation for decimal numbers.
You could probably replace commas by periods beforehand though:
Code:
$calc($replace($$2-,$chr(44),$chr(46)))


Oh, I didn't even think he could mean that, and I live in a place where we use commas :P


Learning something new every day.
Joined: Aug 2010
Posts: 7
G
GEFFO Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Aug 2010
Posts: 7
All things moving ahead!

Another question - What's the script for sending an invite and a message to a person requesting a invite to a private room?

E.g. After a person requests an invite, the request is sent to a private where. All the mods have to do is to type !invite and an invite + msg is sent to the person from the bot?

It's the script for after mods typing !invite that I'm after.

Cheers

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Code:
/invite %nickname #channel


Of course you have to save the nickname to a variable when someone requests an invite.

Is also a little insecure, since if 2 people request an invite close behind each other, a mod could think he's inviting the first one, but then he happens to invite the second one.


Learning something new every day.

Link Copied to Clipboard