mIRC Homepage
Posted By: copman i need help on my script !autohost script - 13/06/15 03:51 AM
i need help on my script it does not work
this need to change every 30 min but it does not work


on *:text:!autohost*:#:{
if ($nick isop #) {
if ($2 == on) {
msg # /me Auto Hosting is now enabled.
.timerSelect 0 10 msg # searching for a channel to host.
var %NowHosting $read(NowHosting.txt)
.timerWho 0 13 msg # /me Now Hosting, %NowHosting
.timerHost 0 14 msg # /host %NowHosting
}
else if ($2 == off) {
msg # /me Auto Hosting is now disabled.
.timer 1 2 msg # /unhost
.timerSelect off
.timerWho off
.timerHost off
}
}
}
Uhh. There is quite a bit of stuff that is just wrong.

To start with, do you really want this to message your channel every 10 second -- Searching for a channel to host?
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 04:17 AM
that was for a test
What exactly doesnt work?
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 07:21 AM
When i type !autohost it does nothing
Code:
on *:text:!autohost*:#:{
    if ($istok(%owners,$nick,32)) {
      if (($2 == on) && (!$timer(.hostON))) {
        msg # /me Auto Hosting is now enabled.
        searchhost $chan
        .timer.hostON 0 1800 searchhost
        ;0 10 msg # searching for a channel to host.
        ;var %NowHosting $read(NowHosting.txt)
        ;.timerWho 0 13 msg # /me Now Hosting, %NowHosting
        ;.timerHost 0 14 msg # /host %NowHosting
      }
      else if ($2 == off) && ($timer(.hostON)) {
        msg # /me Auto Hosting is now disabled.
        .timer.hostON off
        msg # /unhost
      }
    }
}

alias searchhost {
  var %nowhosting = $read(NowHosting.txt)
  var %chan = $1
  msg %chan /me Now hosting $qt(%nowhosting)
  msg %chan /host %nowhosting
}


p.s.: %owners nick1 nick2 nick3
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 09:46 AM
i still can't get it to work i type !autohost in and it dose not work frown

thanks
1. Read Help about $istok
2. Add "checker":
Code:
on *:text:!autohost*:#:{
  echo -agt THIS IS TRIGGERING AT LEAST
  if ($istok(%owners,$nick,32)) {
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 09:57 AM
this is what it says THIS IS TRIGGERING AT LEAST but still no host frown
Then check 1.
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:04 AM
how do i check 1 ??
Posted By: westor Re: i need help on my script !autohost script - 13/06/15 10:06 AM
1. Try to put the code into a new file
2. Check if the %owners global variable exists (via Alt +r -> Variables) , if not exists use: /set %owners NICK1 NICK2
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:09 AM
i see %owners in variables
thanks for the help smile

but still no host
Not just "%owners", it has to be "%owners copman splinny westor" - contain SPACE separated nicks.
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:18 AM
ok let me try that like this %owners alaskastatetrooper64
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:20 AM
still no host
Ok, you want to tell that your nick is "alaskastatetrooper64", you typed "!autohost on" in channel where you bot is and nothing happened?
btw, change:
Code:
.timer.hostON 0 1800 searchhost

to
Code:
.timer.hostON 0 1800 searchhost $chan

Lines starting with ";" can be deleted.
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:30 AM
ok

yes nothing happens
and my twitch name is alaskastatetrooper64
and what about "!autohost off"?
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:34 AM
this is my code and host yet


on *:text:!autohost*:#:{
echo -agt THIS IS TRIGGERING AT LEAST
if ($istok(%owners,$nick,32)) {
if (($2 == on) && (!$timer(.hostON))) {
msg # /me Auto Hosting is now enabled.
searchhost $chan
.timer.hostON 0 1800 searchhost $chan
;0 10 msg # searching for a channel to host.
;var %NowHosting $read(NowHosting.txt)
;.timerWho 0 13 msg # /me Now Hosting, %NowHosting
;.timerHost 0 14 msg # /host %NowHosting
}
else if ($2 == off) && ($timer(.hostON)) {
msg # /me Auto Hosting is now disabled.
.timer.hostON off
msg # /unhost
}
}
}

alias searchhost {
var %nowhosting = $read(NowHosting.txt)
var %chan = $1
msg %chan /me Now hosting $qt(%nowhosting)
msg %chan /host %nowhosting
}
Posted By: westor Re: i need help on my script !autohost script - 13/06/15 10:36 AM
Try to use this code:

Put this code into the "REMOTES" tab into a new file

To add access use: /set %owners NICK1 NICK2

Code:
ON *:TEXT:!autohost*:#:{
  if (!$istok(%owners,$nick,32)) { .msg $chan ( $+ $nick $+ ): Error, You have NOT access for this command! | return }
  if ($2 == on) {
    if ($timer(.hostON)) { .msg $chan ( $+ $nick $+ ): Error, The AUTOHOST is already enabled! | return }
    var %f = nowhosting.txt
    if (!$isfile(%f)) { .msg $chan ( $+ $nick $+ ): Error, The $qt(%f) file does NOT provide any nickname(s) for hosting! | return }
    if (!$lines(%f)) { .msg $chan ( $+ $nick $+ ): Error, The $qt(%f) file does NOT provide any nickname(s) in the list for hosting! | return }
    msg # /me Auto Hosting is now enabled.
    searchhost $chan
    .timer.hostON 0 1800 searchhost $chan
  }
  elseif ($2 == off) {
    if (!$timer(.hostON)) { .msg $chan ( $+ $nick $+ ): Error, The AUTOHOST is already disabled! | return }
    msg # /me Auto Hosting is now disabled.
    .timer.hostON off
    msg # /unhost
  }
}

alias searchhost {
  if (!$1) { return }
  if ($me !ison $1) { return }
  var %f = nowhosting.txt
  if (!$isfile(%f)) { return }
  if (!$lines(%f)) { return }
  var %r = $read(NowHosting.txt,n)
  msg $1 /me Now hosting $qt(%r)
  msg $1 /host %r
}
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:41 AM
thanks that works smile
Posted By: westor Re: i need help on my script !autohost script - 13/06/15 10:42 AM
It was the same as splin ^^ lol
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 10:47 AM
lol
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 11:14 AM
it work so nice Thanks a lot
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 02:04 PM
it was working but know it is not
Posted By: copman Re: i need help on my script !autohost script - 13/06/15 02:20 PM
i got it to work i am a had to type !autohost on
© mIRC Discussion Forums