mIRC Home    About    Download    Register    News    Help

Topic Options
#169180 - 20/01/07 02:09 AM Using my own commands?
Justin_F Offline
Ameglian cow

Registered: 18/01/07
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?

Top
#169184 - 20/01/07 02:18 AM Re: Using my own commands? [Re: Justin_F]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
/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

Top
#169185 - 20/01/07 02:22 AM Re: Using my own commands? [Re: Riamus2]
Justin_F Offline
Ameglian cow

Registered: 18/01/07
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.

Top
#169191 - 20/01/07 03:19 AM Re: Using my own commands? [Re: Justin_F]
Justin_F Offline
Ameglian cow

Registered: 18/01/07
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?

Top
#169192 - 20/01/07 03:21 AM Re: Using my own commands? [Re: Justin_F]
landonsandor Offline
Hoopy frood

Registered: 12/12/02
Posts: 1527
Loc: state of confusion
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

Top
#169193 - 20/01/07 03:30 AM Re: Using my own commands? [Re: landonsandor]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top
#169194 - 20/01/07 03:32 AM Re: Using my own commands? [Re: Riamus2]
landonsandor Offline
Hoopy frood

Registered: 12/12/02
Posts: 1527
Loc: state of confusion
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

Top
#169196 - 20/01/07 03:35 AM Re: Using my own commands? [Re: landonsandor]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top
#169197 - 20/01/07 03:37 AM Re: Using my own commands? [Re: Justin_F]
Justin_F Offline
Ameglian cow

Registered: 18/01/07
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?

Top
#169198 - 20/01/07 03:46 AM Re: Using my own commands? [Re: Justin_F]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top
#169199 - 20/01/07 04:29 AM Re: Using my own commands? [Re: Riamus2]
Justin_F Offline
Ameglian cow

Registered: 18/01/07
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...?


Edited by Justin_F (20/01/07 04:32 AM)

Top
#169200 - 20/01/07 06:07 AM Re: Using my own commands? [Re: Justin_F]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top
#169228 - 20/01/07 05:55 PM Re: Using my own commands? [Re: Riamus2]
danzigrules Offline
Ameglian cow

Registered: 05/12/06
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)
}

Top
#169243 - 20/01/07 07:49 PM Re: Using my own commands? [Re: Riamus2]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
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
}

Top
#169249 - 20/01/07 07:55 PM Re: Using my own commands? [Re: danzigrules]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top
#169251 - 20/01/07 07:57 PM Re: Using my own commands? [Re: DJ_Sol]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
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

Top