mIRC Home    About    Download    Register    News    Help

Print Thread
Prob with a bot #125544 19/07/05 11:13 AM
Joined: Jul 2005
Posts: 13
C
Clyde_The_Glide Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jul 2005
Posts: 13
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
  }
}


 

Re: Prob with a bot #125545 19/07/05 01:28 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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 
  } 
}

Re: Prob with a bot #125546 19/07/05 01:30 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: Prob with a bot #125547 19/07/05 01:51 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: Prob with a bot #125548 19/07/05 04:03 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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


Invision Support
#Invision on irc.irchighway.net
Re: Prob with a bot #125549 19/07/05 05:08 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
just mucking around here, what about

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

Re: Prob with a bot #125550 19/07/05 06:09 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
Re: Prob with a bot #125551 20/07/05 06:09 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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