mIRC Homepage
Hello, I need some help with this little script plz.
I made this from topic I read
Quote:
on *:text:*whatever - Type !take* to whatever.:#: if ($nick == MyNickName) { msg # !take* }



Here is my goal, there is a number behind this * at the end of !take and I need to copy paste this number in my msg or copy paste the whole !take(with the number ofc)

It's a number from 1 to 99.

If anyone could help me please.
Thankyou for your time.
Can you give an example sentence and what you want to capture from it?
thx for your answer there is a full example

- 1 - Bot > Truc drop an Item - Type !take10 to take the Item.

- 2 - Trucluc > !take10

So, someone drop and item and bot answer with a number from 1 to 99 at the end of !take, then someone esle can write !take10 to take the Item.
Ok, this should capture a number from 0-99. At the moment I can't think of a way to capture 1-99 using only regex, but this will exit if the number is 0, so basically the same thing

Code:
on *:TEXT:*:#: {
if ($regex($1-,/^!take([1-9]?[0-9])$/i)) { 
var %number = $regml(1) 
if (%number == 0) { return }

}

}
/^!take([1-9][0-9]?)$/i looks ok to me, to match 1-99, just put the '?' on the second [0-9] character class, which can be written as \d btw.

/^!take([1-9]\d?)$/i
Oh, of course. Derppp^_^
thx both of u it works almost perfectly.
This code just work if the message it's "!take(number)" but in a complet sentense like in my example it doesnt work.

I have 3 issues:
1- do the code only, if ($nick == Bot)
2-find the number in any full sentence or juste in the example
3- write it with !take { msg # take$regml(1) } this doesnt work and I dont know how write text + var

I'm sorry for probably dumb question like the "third" issues but I'm very new at it.
Try this
Code:
on *:TEXT:*:#: {
if ($regex($1-,/!take([1-9]\d?)/i)) { 
if ($nick != BOT) { return }
var %number = $regml(1) 
msg # take $+ %number
   }
}
It works perfectly thx you smile
© mIRC Discussion Forums