mIRC Home    About    Download    Register    News    Help

Print Thread
#169180 20/01/07 02:09 AM
Joined: Jan 2007
Posts: 31
J
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2007
Posts: 31
Im new at this and the one things that bothers me is that I can't use my own commands :P.

I dont know how to set them up without using a "remote" activator.

For instance, im a halfop on a pretty popular channel and I have commands to kick, and kick ban people.
I made them easy, common commands, !k,!kb
Here they are...
Php Code:
on *:TEXT:!k*:#:{
  if ($nick isop $chan) || ($nick ishop $chan) || ($readini(botstaff.ini, Staff, $address($nick, 3))) {
	/kick $chan $2 $3
  }
}
on *:TEXT:!kb*:#:{
  if ($nick isop $chan) || ($nick ishop $chan) || ($readini(botstaff.ini, Staff, $address($nick, 3))) {
	.Ban $chan $2
	/kick $chan $2 $3
  }
} 


So all I want to know is how to I make it so I can use my own !k,!Kb commands while Im the bot?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help on INPUT

on INPUT is set up similar to on TEXT, but it is different, so make sure you look at it. You'll need to basically duplicate your on TEXT in an on INPUT event to make them work for you as well.

Code:
on @*:input:#:{
  if ($1 == !k) {
    kick $chan $2 $3
  }
  elseif ($1 == !kb) {
    .Ban $chan $2
    kick $chan $2 $3
  }
}


Note that I combined them into one to make it easier. You could use multiple on INPUTs just like the multiple on TEXTs if you want.

Also, I removed the isop/ishop check and used @ on the event line to indicate that it should only work if the bot is opped. You should include the @ on your on TEXT lines as well to prevent errors if the bot isn't opped when someone does that command. Don't remove the isop/ishop line on the on TEXT events, though.

A word of warning. Your current on TEXTs will fail when someone does !kb unless you change the order so that !kb* is before !k* or unless you put a space before the *'s -- !k *, and !kb *. The reason is because only the first matching event will trigger in a single script file. Because !k* matches !kb, you will trigger the !k* event instead of the !kb* event.

You may want to also include basic error checking... such as making sure someone actually included a nick/address with the command.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 31
J
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2007
Posts: 31
Originally Posted By: Riamus2

A word of warning. Your current on TEXTs will fail when someone does !kb unless you change the order so that !kb* is before !k* or unless you put a space before the *'s -- !k *, and !kb *. The reason is because only the first matching event will trigger in a single script file. Because !k* matches !kb, you will trigger the !k* event instead of the !kb* event.


Thanks alot, and ill make sure ill change the order.

Joined: Jan 2007
Posts: 31
J
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2007
Posts: 31
Riamus2, I have one more question.

Using my !kb script is there anyway to make a !unban NICK script, that will removed the banmask of a given nick?

Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
FYI, newer mircs have the ban -k option for a kick so you no longer need multiple commands for a kickban smile Just something to look into. For example:

Code:
on *:TEXT:!k*:#: {
  if ($nick isop $chan) || ($nick ishop $chan) || ($readini(botstaff.ini, Staff, $address($nick, 3))) { /kick $chan $2 $3 }
}

Code:
on *:TEXT:!kb*:#:{
  if ($nick isop $chan) || ($nick ishop $chan) || ($readini(botstaff.ini, Staff, $address($nick, 3))) { .ban -k $chan $2 $2 $3 }
}


Or something similar.


Those who fail history are doomed to repeat it
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The problem with -k is that you cannot use an address mask in the ban command.

/ban -k Riamus!*@* You're banned!

Will not work because -k needs a nick to kick instead of a banmask. Obviously, you can work around that, but if you want to allow someone to enter something like:

!kb Riamus!*@* You're banned

Then you can't use -k.

Also, you had $2 twice for some reason in the /ban -k one. You don't need to have it twice unless you want the person's nick to be part of the kick reason.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
oops about the repeat of $2 smile

As for addresses, you can't use addresses in that? I thought you could (I KNOW you can use $address masks - Ive done it before).


Those who fail history are doomed to repeat it
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, you can use an address mask. That would be the workaround. You can have people use something like:

!kb nick mask reason

You'd just have to error check to see if mask is used or not.

In most cases, people are happy enough to just use nicks in such a command. I was just pointing out that if they want to use addresses as well, then the -k wouldn't work.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 31
J
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2007
Posts: 31
so no way to "!unban" someone if their still on the sever...

Using !unban basically to lookup their nick to find their /ban-hostmask and remove it from the bans list?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Oh, sorry. Forgot that you asked that. laugh

This should work as long as the nick is on the server still.
Code:
on @*:TEXT:!unban *:#:{
  mode $chan -b $2
} 


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2007
Posts: 31
J
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2007
Posts: 31
Code:
on @*:input:!unban *:#:{
  if ($nick isop $chan) || ($nick ishop $chan) || ($readini(botstaff.ini, Staff, $address($nick, 3))) {
    mode $chan -b $2
  }  
}


I did that and it didnt work lol. I suck with these inputs.
oh and btw with a on INPUT, i dont need a on TEXT anymore version of the script for the other ops,hops to use...?

Last edited by Justin_F; 20/01/07 04:32 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You still need on TEXT for them. on INPUT only affects you. Also, there is no such thing as $nick in an on INPUT. You are $me. But you don't need to check to see if you're an op/hop or on your list. Having the @ there checks if you are an op already and since it's you, you don't care about your list.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2006
Posts: 46
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Dec 2006
Posts: 46
I am confused about this on INPUT line, does one just move the line that triggers the on text line below the the on INPUT

Code:
[/code]on *:text:You purchased*including tax*:#: {
  var %price = $calc($remove($gettok($1-,$calc($gettok($1-,0,32) - 2),32),$chr(44),$) / $remove($3,$chr(44)))
  msg $chan Unit Price: $round($calc(%price / 1.06),0) Demo: $round(%price,0) Comm: $round($calc(%price / 1.1),0)
}
[code]


would I make the code like yours in this message?
on *:input:#{
if {1 == You purchased*including tax*) {
msg $chan Unit Price: $round($calc(%price / 1.06),0) Demo: $round(%price,0) Comm: $round($calc(%price / 1.1),0)
}

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I didn't know on input was the same as on text. I thought on input was when you entered text in the edit box and pressed enter. Which wouldn't work for a text command.

The problem with putting k* before kb* is because k* == kb* so kb* would never get triggered. You could put them in the same code.

on *:text:!k*:#:{
if ($1 !ison $chan) msg $nick $2 does not exist.
if ($1 == !kb) mode +b $chan $nick
kick $chan $2
}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Close:

Code:
on *:input:#{
  if (You purchased*including tax* iswm $1-) {
    var %price = $calc($remove($gettok($1-,$calc($gettok($1-,0,32) - 2),32),$chr(44),$) / $remove($3,$chr(44)))
    msg $chan Unit Price: $round($calc(%price / 1.06),0) Demo: $round(%price,0) Comm: $round($calc(%price / 1.1),0)
  }
} 


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
DJ_Sol, he wants it to work for others (on TEXT) *and* for him (on INPUT). So you need both. The actual script is almost identical for both of them. You just need to keep in mind that $nick isn't correct (use $me) and that you put the trigger below the on INPUT event line.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard