mIRC Homepage
Posted By: Clyde_The_Glide Prob with a bot - 19/07/05 11:13 AM
I want when some one wirte "!ASK" the bot will read from answers.txt. And I want him to ignore for 5 sec
that's my code
Code:
 


on *:text:*:#wasted_generation:{
  if ( $1 == *!ask *) && ( %d != null ) { return } {
    .msg # $read(answers.txt)
    .set %d -u5 on
  }
}


 
Posted By: FiberOPtics Re: Prob with a bot - 19/07/05 01:28 PM
This will only trigger if they say "!ask" noting else, you'll need to add wildcards if you want to match more.

Code:
on *:text:!ask:#wasted_generation:{ 
  if !%d { 
    .msg # $read(answers.txt,tn) 
    inc -u5 %d 
  } 
}
Posted By: Riamus2 Re: Prob with a bot - 19/07/05 01:30 PM
Code:
on *:text:*:#wasted_generation: {
  if ($1 == !ask) && (%d == $null) {
    .msg # $read(answers.txt,tn)
    .set %d -u5 on
  }
}


I assume there's a reason you have the trigger within the event as an IF statement. If there isn't a reason for having it there, you can just use:

Code:
on *:text:!ask *:#wasted_generation: {
  if (%d == $null) {
    .msg # $read(answers.txt,tn)
    .set %d -u5 on
  }
}


Note also that you may want to consider another check on the trigger...

Code:
on *:text:*:#wasted_generation: {
  if ($1 == !ask) && (%d == $null) {
    if ($2 == $null) {
      .msg $chan Please ask a question.
    }
    else {
      .msg # $read(answers.txt,tn)
      .set %d -u5 on
    }
  }
}


You can make this a notice if you prefer and have it message the $nick or the $chan... whatever you prefer. You could also use a halt command instead of using the else statement, but I prefer else for trying to find problems later. Just my preference.
Posted By: FiberOPtics Re: Prob with a bot - 19/07/05 01:51 PM
The correct way would be:

set -u5 %d on

1. The -u5 comes before the %d.
2. Set only outputs information when using the -s switch, by default it is silent, so prefixing it with a dot won't do anything.
Posted By: Riamus2 Re: Prob with a bot - 19/07/05 04:03 PM
Thanks. Was copying his code and fixing things... I missed that one. frown

That'll teach me to not copy someone else's code and fix it, but to just write it over. smile
Posted By: DaveC Re: Prob with a bot - 19/07/05 05:08 PM
just mucking around here, what about

Code:
on *:text:$(%d,!ask):#wasted_generation:{
  .msg # $read(answers.txt,tn) 
   set -u5 %d $crlf
}
Posted By: FiberOPtics Re: Prob with a bot - 19/07/05 06:09 PM
It wouldn't work in that state, only if you changed it to something like: $(%d $+ !ask) but I assume you typoed.

It might be a bit too hard for the requester to understand... but it's a nice approach.
Posted By: DaveC Re: Prob with a bot - 20/07/05 06:09 AM
lol, and i came back and edited out a extra } as well, and still missed that, well at least ya knew what i was meaning, Dont know if it would speed things up much really, and does make it harder to follow frown
© mIRC Discussion Forums