mIRC Homepage
Posted By: Sableye2 disabling a script - 20/06/06 05:19 AM
I have the 8ball script installed on a bot. Sometimes, the 8ball script gets overused. I would like a script that can disable and enable the 8ball script.

For example, "!disable 8ball" would disable the script, and "!enable 8ball" will turn it back on. I also would only like operators to use those two commands. So how would I do this?
Posted By: Doqnach Re: disabling a script - 20/06/06 05:32 AM
you could use a seperate script to /load and /unload commands...


or you can put the entire script in a #group , and turn that on of off with a script
Posted By: Lpfix5 Re: disabling a script - 20/06/06 05:36 AM
Well first off you would need to add a command to the !8ball trigger
Secondly you can use a /load /unload feature in a seperate script
thirdly you can use a group enabler and disabler

where if !8ball == true then play, elseif false then stop

there should be a on text command in the script that executes everything its hard to know without seeing it but add this where you see the !8ball trigger

if ($2 == on && $nick isop $chan) { %8ball.status = true }
elseif ($2 == off && $nick isop $chan) { %8ball.status = false }

then the whole script should be in the middle of something like this

if (%8ball.status == true) {
whole 8 ball script here excluding the Variables...
}
elseif (%8ball.status == false) {
msg $nick Unfortunently 8Ball script is off.
}

I can't say much more then that since I dont see the script sorry
Posted By: Sableye2 Re: disabling a script - 20/06/06 05:50 AM
Here is the script.

on *:TEXT:!8ball*:#:{
/set %8ball $rand(1,6)
if (%8ball == 1) .msg $chan 10No
if (%8ball == 2) .msg $chan 10Yes
if (%8ball == 3) .msg $chan 10Maybe
if (%8ball == 4) .msg $chan 10Of course
if (%8ball == 5) .msg $chan 10Not sure
if (%8ball == 6) /msg $chan 10How should I know?
Posted By: Lpfix5 Re: disabling a script - 20/06/06 06:00 AM
on *:TEXT:!8ball*:#:{
if ($2 == on && $nick isop $chan) { %8ball.status = true }
elseif ($2 == off && $nick isop $chan) { %8ball.status = false }
if (%8ball.status == true) {

/set %8ball $rand(1,6)
if (%8ball == 1) .msg $chan 10No
if (%8ball == 2) .msg $chan 10Yes
if (%8ball == 3) .msg $chan 10Maybe
if (%8ball == 4) .msg $chan 10Of course
if (%8ball == 5) .msg $chan 10Not sure
if (%8ball == 6) /msg $chan 10How should I know?
}
else { msg $nick Unfortunently 8Ball is off }
}
Posted By: Sableye2 Re: disabling a script - 20/06/06 06:11 AM
Okay, I tested out the code. It seems that "!8ball on" and "!8ball off" are the commands. How can I install a message that says "8ball has been turned on" when I type in !8ball on?
Posted By: truguce Re: disabling a script - 20/06/06 06:52 AM
change this line
Code:
if ($2 == on && $nick isop $chan) { %8ball.status = true [color:red]| msg $chan 8Ball now active [/color] }
Posted By: Sableye2 Re: disabling a script - 20/06/06 12:50 PM
Great, that there works. Just one more thing:

[07:45:56] <@Sableye> !8ball enable
[07:45:57] <@[PN]Bot> The 8ball has been enabled again
[07:45:57] <@[PN]Bot> How should I know?

That's what it is above. Is there a way to make it so that when I type in "!8ball enable," it does not use this:

[07:45:57] <@[PN]Bot> How should I know?

I just want it to say "The 8ball has been enabled again," but when someone uses the 8ball, then it gives a response such as "How should I know." I hope this makes sense...
Posted By: Kurdish_Assass1n Re: disabling a script - 20/06/06 05:20 PM
I haven't read everyone's post in here, but, can't you use "/remote off"? I think so there's a way to make only one remote turn off, but, I'm not sure, haven't looked too deep into that.
Posted By: MikeChat Re: disabling a script - 20/06/06 05:28 PM
just needed a "return" which actls like a "soft halt"

also you had some / in the code which I removed/replaced

Code:
on *:TEXT:!8ball*:#:{
  if ($2 == on &amp;&amp; $nick isop $chan) { set %8ball.status true | msg $chan 8Ball now active | return }
  elseif ($2 == off &amp;&amp; $nick isop $chan) { unset %8ball.status | msg $chan 8Ball now off | return  }
  if (%8ball.status) {
    set %8ball $r(1,6)
    if (%8ball == 1) .msg $chan 10No
    if (%8ball == 2) .msg $chan 10Yes
    if (%8ball == 3) .msg $chan 10Maybe
    if (%8ball == 4) .msg $chan 10Of course
    if (%8ball == 5) .msg $chan 10Not sure
    if (%8ball == 6) .msg $chan 10How should I know?
  }
  else { notice $nick Unfortunently 8Ball is off }
}
Posted By: hmtX Re: disabling a script - 20/06/06 05:34 PM
instead of the returns he could simply change the 3rd conditional to
elseif (%8ball.status) {
Posted By: MikeChat Re: disabling a script - 20/06/06 05:51 PM
good, and I changed the $2 to $2- in the conditional so you could use on or off as the first word in the question without it stopping the bot.

Code:
on ^*:TEXT:!8ball*:#:{
  haltdef
  if ($2- == on &amp;&amp; $nick isop $chan) { set %8ball.status true | msg $chan 8Ball now active }
  elseif ($2- == off &amp;&amp; $nick isop $chan) { unset %8ball.status | msg $chan 8Ball now off }
  elseif (%8ball.status) {
    set %8ball $r(1,9)
    if (%8ball == 1) .msg $chan 10No
    if (%8ball == 2) .msg $chan 10Yes
    if (%8ball == 3) .msg $chan 10Maybe
    if (%8ball == 4) .msg $chan 10Of course
    if (%8ball == 5) .msg $chan 10Not sure
    if (%8ball == 6) .msg $chan 10How should I know?
    if (%8ball == 7) .msg $chan 10Ask again later.
    if (%8ball == 8) .msg $chan 10Message garbled, no answer available.
    if (%8ball == 9) .msg $chan 10Never on $day $+ s.
  }
  else { notice $nick Unfortunently 8Ball is off }
}
Posted By: Sableye2 Re: disabling a script - 22/06/06 01:51 AM
Thank you. That worked out perfectly. Now how would I do it with this one? I tried doing the same thing with the 8ball script, but this script seems to be a bit more complicated.

on 1:TEXT:!catch:#: msg $chan $nick caught a $read(pokemon.txt)

You basically use !catch, and it reads off a text file.
Posted By: RusselB Re: disabling a script - 22/06/06 02:42 AM
Code:
on *:text:!catch*:#:{
if ($nick isop $chan) {
set %pokemon $iif($2 == on,$true,$iif($2 == off,$false))
}
if %pokemon {
.msg $chan $nick caught a $read(pokemon.txt)
}
else .msg $chan Sorry Pokemon catch is off
}
  
Posted By: Sableye2 Re: disabling a script - 22/06/06 03:41 AM
Thanks. The only problem is that whenever I type in !catch, it says that the pokemon catch is off. It seems that it only works if you type in !catch on.
Posted By: MikeChat Re: disabling a script - 22/06/06 04:46 AM
use the same format that the 8ball used
Code:
on ^*:text:!catch*:#:{
  haltdef
  if ($2- == on &amp;&amp; $nick isop $chan) { set %pokemon true | msg $chan pokemon now active }
  elseif ($2- == off &amp;&amp; $nick isop $chan) { unset %pokemon | msg $chan Pokemon now off }
  elseif (%pokemon) {
    .msg $chan $nick caught a $read(pokemon.txt)
  }
  else .msg $chan Sorry Pokemon catch is off
}
© mIRC Discussion Forums