mIRC Home    About    Download    Register    News    Help

Print Thread
#216829 04/12/09 01:01 AM
Joined: Dec 2009
Posts: 7
P
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
P
Joined: Dec 2009
Posts: 7
I have this script it works great:

Code:
on *:join:#MyChannel: {
  if ($nick != $me) { describe $chan offer $nick $+ ! a $read(Drinks.txt) & toasts #MyChannel IRC network! }
}



I like to make it also where a person can order a drink with:

!order or !Order

and it'll serve them a drink

Pauls74462

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
on !*:join:#MyChannel:describe # offers $nick $+ ! a $read(Drinks.txt) & toasts # IRC network!
on $1:text:/!order/iS:#MyChannel:describe # serves $nick $+ ! a $read(Drinks.txt) & toasts # IRC network!

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'm curious why you'd use a regular expression, Tomao. I don't see any reason why that would be more efficient or useful. Maybe it is? Just wondering.

And, pauls... why do you want a ! after the nick?

bot offers nick! a mai tai... and so on. Probably would be better without it, but that's up to you of course. smile


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2009
Posts: 7
P
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
P
Joined: Dec 2009
Posts: 7
Originally Posted By: Riamus2
I'm curious why you'd use a regular expression, Tomao. I don't see any reason why that would be more efficient or useful. Maybe it is? Just wondering.

And, pauls... why do you want a ! after the nick?

bot offers nick! a mai tai... and so on. Probably would be better without it, but that's up to you of course. smile


If you see the scuipt with topic of "onjoin bartender script" you'll see why the "!" is used, thought it was apart of the command.


Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
$nick $+ ! just adds the ! to the $nick. You can remove $+ ! and you'll have the sentence without the ! in the middle. I put it there in my original script to you because of how I worded it. Since you changed the wording, you can change the punctuation as well.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: Riamus2
I'm curious why you'd use a regular expression, Tomao. I don't see any reason why that would be more efficient or useful. Maybe it is? Just wondering.
Well, I used for stripping the control codes, hence the /S flag. Yes, I could've used the simple text event, but that'd mean an additional if statement with the $strip() identifier. I simply found it convenient is all.

Actually it just hit me that I could have done it like this:
Code:
on 1:TEXT:$( $+ $strip(!order) $+ ):#:

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ah, ok. Makes sense. I tend to make people type without control codes if they want to use my scripts. I'm mean that way. Lol!


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2009
Posts: 7
P
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
P
Joined: Dec 2009
Posts: 7
Thanks all for the help on my bartender script! smile

Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
Code:
on 1:TEXT:$( $+ $strip(!order) $+ ):#:

will do the same as:

on 1:TEXT:!order:#:


The $strip would only be applied to the word !order
since you didnt put any control codes there is
nothing to strip..

Your original regex is the best way to filter
out the control codes but to be the same you need
to do:

Code:
on $1:text:/^!order$/iS:#:


Link Copied to Clipboard