mIRC Home    About    Download    Register    News    Help

Print Thread
#218785 24/02/10 06:13 PM
Joined: Jan 2010
Posts: 26
V
vinyltm Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Jan 2010
Posts: 26
trying to make a master control for my bot... i do not know if there is a prefix so that only the channel owner can do it but here is what i got sort of... it doesnt work at all except for the first set on/off

Quote:
on *:TEXT:!beepall*:#: {
if ($nick isop $chan) {
set $+(%,on.off,.,$network,.,$chan) $2
set $+(%,.,on.off,.,.,$network,.,$chan) $2
set $+(%,.,on.off,.,$network,.,$chan) $2
set $+(%,on.off,$network,.,$chan) $2
{
if ($2 == on) {
set %on.off on | .msg $chan All Beep's commands are now ON.
}
elseif ($2 == off) {
unset %on.off | .msg $chan All Beep's commands are now OFF.
}
}
}


now i want it so only the channel owner can do it and i cant figure out why its not turning each switch on and off since its on different lines, i figured it would just do line after line...

Last edited by vinyltm; 24/02/10 06:16 PM.
Joined: Jan 2010
Posts: 26
V
vinyltm Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Jan 2010
Posts: 26
also would it be possible to put a switch on a switch? such as
Quote:

on *:TEXT:!usercommands*:#: {
if ( $($+(%,.,.,.,.,on.off,.,$network,.,$chan),2) == $null) {
halt
}
elseif {
if ($nick isop $chan) {
set $+(%,.,on.off,.,$network,.,$chan) $2
{
if ($2 == on) {
set %on.off on | .msg $chan usercommands are now on.
}
elseif ($2 == off) {
unset %on.off | .msg $chan usercommands are now off.
}
}
}





then make the first switch channel owner only so that even the ops couldnt turn on the scripts if the bot was disabled

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Your easiest method would be enabling/disabling the part of the script that you want the turn on or off. /help /enable

Using that with user levels, you can just set the person you want to have the control as a specific user level and limit the control to that user level...

Code:
on 500:text:!trigger:#channel: { do this }


That will only work for someone in the users tab with 500 user level (or higher). Alternatively, you can name the user level instead of using a number, such as botowner...

Code:
on botowner:text:!trigger:#channel: { do this }


Just put the correct address mask into the user list with the correct user level you want to use and you're set. Note that if the person's address changes off and on, you can put in multiple masks for the person or use wildcards.


Btw, there's no reason to put commas between the .'s in your example script. Yes, you need a comma after the % so it evaluates correctly, but you can have something like $($+(%,....on.off.,$network,.,$chan),2). Though I can't see why you'd want so many .'s.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2010
Posts: 26
V
vinyltm Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Jan 2010
Posts: 26
i added the .'s to make it a different switch, there are a dozen different scripts all on different triggers, some people might not want greetings but do want link checker. and so on. so they are all on separate triggers.. so a channel owner in example channel = #username1 and user Username1 is the chat owner. the user level would be 500 as to an op level would be what?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Having a bunch of .'s as a way to separate different triggers isn't really a good method. You leave way too many possibilities of missing a "." or adding an extra. It's much better to use a word or something to distinguish between them... %greet.$network.$chan and %link.$network.$chan and %master.$network.$chan for example. That said, if you have many settings, hash tables are a useful method of handling multiple settings on multiple networks. You could have all networks/chans/settings in one table, or make a table for each network, then have the channels as the items and all settings as the data, or have the items be something like chan.greet and the data being On or Off. Or you can save all settings to a file (or files) and $read them to get the information. Those are just a couple ways it can be done. In any case, there are many better ways to handle multiple settings than using a bunch of .'s. And it's almost always better to avoid having a lot of variables (having 1 variable for every setting in every channel on every network is WAY more than you really should have).

As far as user levels, you can choose whatever you want. There's no set level (other than 1 because everyone is 1). One scripter might set ops as level 50, another might set them as 10, and another 200. It doesn't really matter as long as you're consistent. Just remember that if you use numbers instead of words, anyone with a higher number level will have access to the lower levels unless you include a limit in the event saying the person must have the exact level. Personally, I think named levels are best. They're easier to remember and are less likely to conflict with other scripts.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard