mIRC Home    About    Download    Register    News    Help

Print Thread
#170296 06/02/07 08:13 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Hi

I have this barbot called Sonja.
To order something you have to type: Bartender can i have a sprite please or Bartender give john and charles a beer.
On the second command the bot responds like: hey john and charles here a beer from Bullseye.
Now i would like to change "Bartender" into "Sonja" and that is where my problem is.
When ordering drinks for people from the nicklist it uses this code to check for the given nicks:
Code:
var %nicknum = $nick($chan,0) 
    var %nick1 = 1 
    while (%nicknum >= %nick1) { 
      if ($nick($chan,%nick1) isin $strip($1-)) { 
        var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 
      } 
      inc %nick1 
    } 


When adding "Sonja" as a trigger it also gives Sonja a drink.
I would like it to skip Sonja as Sonja is the one who gives the drinks.
Here is the full code with sonja as the trigger:
Code:
On 1:text:*beer*:#:{
  if (sonja == $strip($1)) { 
    var %nicknum = $nick($chan,0) 
    var %nick1 = 1 
    while (%nicknum >= %nick1) { 
      if ($nick($chan,%nick1) isin $strip($1-)) { 
        var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 
      } 
      inc %nick1 
    } 
    if (%nicklijst) {
      if ($regex($1-,/(?<= |^)(?:i|me)(?= |$)/Si)) { 
        timer 1 2 $read($scriptdir\drinks\beerme.txt,t) 
      }
      else {
        timer 1 2 $read($scriptdir\drinks\beerlist.txt,t) 
      }
    }
    else { 
      timer 1 1 $read($scriptdir\drinks\beer.txt,t) 
    }
  }
}

Thanks upfront for helping

Greetzz

Bullseye #170302 06/02/07 10:46 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Just change $1- to $2- here:

Code:
if ($nick($chan,%nick1) isin $strip($2-)) { 

Riamus2 #170353 07/02/07 04:07 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
OOOOOHHHHHHHHHH damn I'm going to shoot myself.
I know my problem ..... i think to much and to diffecult.


Link Copied to Clipboard