mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#78241 06/04/04 10:33 PM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Ok, this is really annoying now. I am trying to create a bot for my new server (not open to public yet though) and it will just NOW do any commands. The one which I am having most trouble with is the !op command. I test it by opening two clients and using one as the bot with the script loaded. Here is the code:

Code:
on !6:TEXT:!mopop *:#: {
  if ($ulevel == 6) {
  mode $1 +o $2 }
  else {
  msg $nick You don't have the user levels to do that! }
}


Now. When I use the client non-bot client to activate the script, there is no response. I have set my hostname to work with level 6 commands. HELP! The deop command and basicly all commands that require user levels don't respond!


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78242 06/04/04 11:25 PM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
There's a bit of redundancy here:

on !6:TEXT:!mopop *:#: {
if ($ulevel == 6) {
mode $1 +o $2 }
else {
msg $nick You don't have the user levels to do that! }
}


Ok, so you want only user level 6 to be able to trigger this. So let's try a few things. First, how many ON TEXT events do you have of level 6 nature in the same remote file? More than one can cause problems. Also, try some of the code below:


on !6:TEXT:!mopop *:#://mode $1 +o $2

In the above the blue is not needed because on text events CANT be triggered by the script host (the one running the script). Im alos going to assume by your code that the format for said command is !mopop #channelname nickname

Something else you can do is:

on +6:TEXT:!mopop *:#://mode $1 +o $2

The above script because of the + means ONLY level 6 users can trigger said event. Another solution would be (since it appears you want to respond to NON level 6 users with a message):

on *:text:!mopop *:#: {
if ($ulevel == 6) { mode $1 +o $2 }
else { msg $nick You don't have the user levels to do that! }
}

Another idea you could try is:

on @*:text:!mopop *:#: {
if ($ulevel == 6) { mode $1 +o $2 }
else { msg $nick You don't have the user levels to do that! }
}

In the above, the @ means "dont trigger this event UNLESS I (the one running the script) am opped

You COULD (if you wanted to) even combine things from above like this:

on @+6:TEXT:!mopop *:#://mode $1 +o $2

The above means:
1) If I am opped
2) the user triggering the event has level 6 access
3) perform the script


I hope all of this helps you out. Im not the best iwth userlevels, but this is jsut an example and shoudl give you ideas smile


Those who fail history are doomed to repeat it
#78243 06/04/04 11:41 PM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Ok, it at least messages me with the You Dont have Levels message. So, tht means I have a problem with me users file.
BUT, it even does it when I have the default user level at 6. Wierd!

Code:
on :TEXT:!request MoPBoT *:#: {
if ($ulevel == 6){ join $3 }
else { msg $nick You don't have the user levels to do that! }

on *:text:!mopop *:#: {
  if ($ulevel == 4) { mode $1 +o $2 }
  else { msg $nick You don't have the user levels to do that! }
}

on *:text:!mopdeop *:#: {
  if ($ulevel == 4) { mode $1 -o $2 }
  else { msg $nick You don't have the user levels to do that! }
}

on *:text:!moptopic *:#: {
  if ($ulevel == 4) { topic $1 $2 }
  else { msg $nick You don't have the user levels to do that! }
}

on *:text:!mopvoice *:#: {
  if ($ulevel == 4) { mode $1 +v $2 }
  else { msg $nick You don't have the user levels to do that! }
}


ALL of those functions have the same result. That stupid User Levels query.

Last edited by masterofpuppets; 06/04/04 11:44 PM.

Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78244 07/04/04 12:13 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Ok, it COULD be (unless it's just a typo HERE) that you're missing a bracket AND missing a space on the first blue section:

{code}
on :TEXT:!request MoPBoT *:#: {
if ($ulevel == 6) { join $3 }
else { msg $nick You don't have the user levels to do that! }
}
on *:text:!mopop *:#: {
if ($ulevel == 4) { mode $1 +o $2 }
else { msg $nick You don't have the user levels to do that! }
}

on *:text:!mopdeop *:#: {
if ($ulevel == 4) { mode $1 -o $2 }
else { msg $nick You don't have the user levels to do that! }
}

on *:text:!moptopic *:#: {
if ($ulevel == 4) { topic $1 $2 }
else { msg $nick You don't have the user levels to do that! }
}

on *:text:!mopvoice *:#: {
if ($ulevel == 4) { mode $1 +v $2 }
else { msg $nick You don't have the user levels to do that! }
}
[/code]

Also, you could do this (tho I MIGHT screw up the coding a bit so be warned):

Code:
on *:text:*:#: {
  if ($ulevel == 4) {
    if (!mopop == $1) { mode $1 +o $2 }
    if (!mopdeop == $1) { mode $1 -o $2 }
    if (!moptopic == $1) { topic $1 $2 }
    if (!mopvoice == $1) { topic $1 +v $2 }
  }
  if ($ulevel == 6) {
    if (!request*MoPBoT iswm $1-) { join $3 }
  }
  else { msg $nick You don't have the user levels to do that! }
}



The above code would also allow for more comparisons and less event titles making things a bit clearer (possibly) for you and also remove a lot of repetitive code. See if that helpsand if anybody else spots an error in my coding, PLEASE correct it smile


Those who fail history are doomed to repeat it
#78245 07/04/04 12:30 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
OOOOOOOOO I see another problem here. Try this:

Code:
on *:text:*:#: {
  if ($ulevel == 4) {
    if (!mopop == $1) { mode [color:blue]#[/color] +o $2 }
    if (!mopdeop == $1) { mode [color:blue]#[/color] -o $2 }
    if (!moptopic == $1) { topic [color:blue]#[/color] $2 }
    if (!mopvoice == $1) { mode [color:blue]#[/color] +v $2 }
  }
  if ($ulevel == 6) {
    if (!request*MoPBoT iswm $1-) { join $3 }
  }
  else { msg $nick You don't have the user levels to do that! }
}


Stupid me, how can you set any moes on $1 if $1 is the !trigger?? *smack* (among another typo I found in the voice command) . Also, in the !request MoPBoT part, is $3 the actual channelname?


Those who fail history are doomed to repeat it
#78246 07/04/04 12:33 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Nope, it didn't work. Totally unresponsive!


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78247 07/04/04 12:39 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Is somebody OTHER than the script hlder testing this? You should be getting SOME KIND of response. Hmm, try this (for error checking):

Code:
on *:text:*:#: {
  echo -a On Text worked
  if ($ulevel == 4) {
    echo -a It recognized user level 4
    if (!mopop == $1) { mode # +o $2 }
    if (!mopdeop == $1) { mode # -o $2 }
    if (!moptopic == $1) { topic # $2 }
    if (!mopvoice == $1) { mode # +v $2 }
  }
  if ($ulevel == 6) {
    echo -a It recognized user level 6
    if (!request*MoPBoT iswm $1-) { join $3 }
  }
  else { msg $nick You don't have the user levels to do that! }
}


if it still doesnt trigger anything, somebody else'll have to help you as Im missing somthing (probably really stupid). Also, what do you normally keep your own (the mirc that runs the scripts) default user level at? Are you trying it at default level as 1? Another number? If at another number, try it at one and see what happens


Those who fail history are doomed to repeat it
#78248 07/04/04 12:44 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Ok, the ontext worked and it recognised user level 6. But nothing happened.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78249 07/04/04 12:49 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Ok, for now Im gonna pass this on to somebody else who knows more than I do cause it LOOKS right to me, but Im prolly making a SIMPLE mistake somehwere that Im just not seeing (cause I wrote the code lol). Hopefully one of the better scripters can guide you beyond here smile


Those who fail history are doomed to repeat it
#78250 07/04/04 12:51 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Hi, there. Tested... this works fine for me:
Code:
on *:text:*:#: {
  if ($ulevel == 4) { 
    if (!mopop == $1) { mode # +o $2 } 
    if (!mopdeop == $1) { mode # -o $2 }
    if (!moptopic == $1) { topic # $2 }
    if (!mopvoice == $1) { mode # +v $2 }
  }
  [color:red]elseif[/color] ($ulevel == 6) { 
    if ([color:red]!request MoPBoT == $1-2[/color]) { join $3 }
  } 
  else { msg $nick You don't have the user levels to do that! }
}


landonsandor, you did a good job man, just a little red things. grin


velicha dusha moja Gospoda
#78251 07/04/04 12:53 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
What's your default user level in ALT + R --> Options --> Default Level? Same to you masterofpuppets, what's your default userlevel when you're testing the script? Im not keen on user levels when the script owner has a default level other than 1. BTW milosh, thanks for the backing up, I thought it looked right to me, but again, I coded it so I can sometimes overlook simple issues smile



Those who fail history are doomed to repeat it
#78252 07/04/04 12:54 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
It's still totally defunc.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78253 07/04/04 01:04 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
landonsandor, def level 1
masterofpuppets, cerate a new script file, enter the landonsandor's code with two corrections (see my post).
Type !mppop <nick> to give <nick> the op, type !request MoPBoT #channel, to make the bot enter the channel.

Oh, give level 4 and 6 to your own nick (the nick who's executing the commands)

Last edited by milosh; 07/04/04 01:07 AM.

velicha dusha moja Gospoda
#78254 07/04/04 01:07 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Didnt think of the $1-2 thing milosh. I knew about it, just didnt think about it lol Hope that made sence lol Also, i didnt think it would matter if I used elseif vs another if, but hey, if it works, then fine, that's all that matters


Those who fail history are doomed to repeat it
#78255 07/04/04 01:12 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
But the thing is, it DOESN'T work fine. Even with those corrections! Wierd.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78256 07/04/04 01:16 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Let's say you put if instead of elseif and you don't have 4 or 6. Then you will not get the error msg (msg $nick You don't have the user levels to do that! will NOT be executed).
It WILL be executed only if you have level 6 and do not type !request MoPBoT. That's why I did elseif to your code. :tongue:


velicha dusha moja Gospoda
#78257 07/04/04 01:18 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Can you tell us what are you typing, what are the commands, give an example, like I did: !mopop <nick> will op the <nick> in current channel.


velicha dusha moja Gospoda
#78258 07/04/04 01:22 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
I tried without any user levels at all. It was un-responsive.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78259 07/04/04 01:26 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Did you made a new script file and post the code in? I hate this short post, but what can man do. smirk
With no level you will get You don't have the user levels to do that!


velicha dusha moja Gospoda
#78260 07/04/04 01:34 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
It didn't query me saying about that I don't have the user levels. It didnt even RESPOND! BUT! The request script works fine. The other ones don't.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78261 07/04/04 01:45 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Paste your code here, please. The code I gave you should work fine.


velicha dusha moja Gospoda
#78262 07/04/04 01:46 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Code:
on *:text:*:#: {
  echo -a On Text worked
  if ($ulevel == 4) {
    echo -a It recognized user level 4
    if (!mopop == $1) { mode # +o $2 }
    if (!mopdeop == $1) { mode # -o $2 }
    if (!moptopic == $1) { topic # $2 }
    if (!mopvoice == $1) { mode # +v $2 }
  }
  elseif ($ulevel == 6) {
    echo -a It recognized user level 6
    if (!request MoPBoT == $1-2) { join $3 }
  }
  else { msg $nick You don't have the user levels to do that! }
}


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78263 07/04/04 02:03 AM
Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Give yourself level 4. Type in the channel where bot is: !mopop <YourNick>
If he(bot) doesn't give you op, then I don't know what's the problem, it WORKS here.
Also, you should get private msg if you do not have any access...


velicha dusha moja Gospoda
#78264 07/04/04 02:13 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Absoloutly NO response! It is basicly DEAD.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78265 07/04/04 03:05 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
/remote on


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#78266 07/04/04 03:10 AM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Nope. No difference.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78267 07/04/04 01:44 PM
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
Here's a general checklist you and others can use to try and debug remote issues:

1) What version is the bot on? (ideally 6.14 would be nice, any of the 5.X versions or older may have problems with this code.) If you're on an older version please test your code on a new version (in a different directly if you like) to see if the version is the problem or upgrade it outright.

2) Have the bot add you in the remotes using: "/guser <level> <your nick> 3" (without the quotes of course,) and make sure it returns the appropriate line in the active window saying you've been added by address.

3) Move the script/event/aliases in question to the top of the first file in the remote window (you can use the file menu to change order of files if you need to.) This ensures another event in another file won't /halt the event before this one triggers.

4) Double check that the bot's remotes are on, in that client type: /remote and if necessary: /remote on

5) I see you have some debugging code, you may want to add a public message:
Code:
&lt;your on text line&gt; {
  msg $target Event triggered: $script - $scriptline
  &lt;the rest of your code&gt;
}


6) On version 6.14 or later you can use error capturing too:
Code:
&lt;your on text line&gt; {
  msg $target Event triggered: $script - $scriptline
  &lt;the rest of your code&gt;
  :error
  msg $target Event error: $error - $script - $scriptline
}


I hope this helps track down the problem.


-
MIMP
#78268 08/04/04 12:36 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I worked fine here.. i just some little changes:

Code:
on *:text:*:#: {
  if ($ulevel == 4) {
    if (!mopop == $1) { mode  [color:red]$chan[/color] +o $2 }
    [color:red]elseif[/color] (!mopdeop == $1) { mode  [color:red]$chan[/color] -o $2 }
    [color:red]elseif[/color] (!moptopic == $1) { topic  [color:red]$chan[/color] $2 }
    [color:red]elseif[/color] (!mopvoice == $1) { mode  [color:red]$chan[/color] +v $2 } 
  }
  elseif ($ulevel == 6) {
     if (!request MoPBoT == [color:red]$$1 $2[/color]) { join $3 }
  }
  else { msg $nick You don't have the user levels to do that! }
}


The $chan identifier will make sure that the bot makes the mode change in the channel that the event took place (if the bot is in more than 2 chans, it can mix them up)

To activate those command, the string should be: !mopop <nickname>, !mopdeop <nickname> and so on..
and !request MoPBoT #channel

Hope this helps!


"All we are saying is give peace a chance" -- John Lennon
#78269 08/04/04 05:06 PM
Joined: Feb 2004
Posts: 33
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
It works now. I used the /guser to add all of the users and I even made a little login system. So, when the person msgs the bot, and the login is correct, it gusers the person to the levels I have set in the code. If it is incorrect it msgs the user saying "That username and/or password don't exist! You cannot login!". Nice eh. And it works.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
#78270 08/04/04 05:30 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Cool then laugh


"All we are saying is give peace a chance" -- John Lennon
Page 1 of 2 1 2

Link Copied to Clipboard