mIRC Home    About    Download    Register    News    Help

Print Thread
#225207 28/08/10 04:48 AM
Joined: Dec 2009
Posts: 7
P
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
P
Joined: Dec 2009
Posts: 7
I need help on a script for a bar. I have this code:
Code:
on $1:text:/!beer/iS:#:describe # serves $nick a $$1 & toasts # IRC network!

when a person types:
Code:
!beer Corona

the channel output should be:
Quote:
Bartender serves {nick} a Corona & toasts # IRC network!

when a person types:
Code:
!beer Corona

the channel output is:
Quote:
Bartender serves {nick} a !beer & toasts # IRC network!


Please help

Pauls74462

pauls74462 #225208 28/08/10 04:52 AM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
As is obvious from your output, you need to use $$2 instead of $$1

Furthermore, there is no need to use a regex match here.
Code:
on 1:TEXT:!beer *:#:describe # serves $nick a $$2 & toasts # IRC network!

pauls74462 #225211 28/08/10 06:14 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
This is what you should do if you've decided to use regex:
Code:
on $1:text:/!(beer)\s(.+)/iS:#:{
  if ($regml(2) ison #) {
    describe # serves $v1 a $regml(1) & toasts # IRC network!
  }
}

Tomao #225279 29/08/10 08:47 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
No, that would say "* hixxy serves {v2} a beer & toasts # IRC network!" - whereas he wants to post the brand of beer and he wants to serve the nickname who used the command. Also, there is no point in capturing "beer" in brackets when it is hardcoded text.


Link Copied to Clipboard