mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
is there a way to count the number of quotes ( " ) in a message, and then let the bot say << quote >> if the number is odd?
thanx!

ps: I have scripted all day, and i am messy in my head, and I need to get this bot done asap... you see how tired i am? I wrote ", and I" 2 times in a row!!:)

Last edited by Crap; 22/11/05 08:17 PM.

#indierpgs @ magicstar.net Your indie-rpg fix. Online.
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Take a look at /help $count

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
alias testcount {
var %string = $input(put some quote delimited text in here,e)
var %quantity = $count(%string,$chr(34))
echo -a . %quantity
if (2 \\ %quantity) { echo -a odd } 
elseif (2 // %quantity) { echo -a even }
else { echo -a error: no quotes }
}

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
hmm, fixed the error line so that if no " are in the string it returns an error message correctly
Code:
alias testcount {
  var %string = $input(put some quote delimited text in here,e)
  var %quantity = $count(%string,$chr(34))
  if (%quantity == 0) { echo -a Error: $chr(34) Not found in text | return }
  if (2 \\ %quantity) { echo -a odd } 
  if (2 // %quantity) { echo -a even }
}

Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
okej... that is a bit above my head, and reading the helpfiles dont make me more familar with the $input-identifier, so tell me, does it test all post in one channel (yes, after you make it a none-alias)? that is what I would like it to do...


But if you dont whant to answere, I think I can get it anymay when I get home.

Last edited by Crap; 23/11/05 06:57 AM.

#indierpgs @ magicstar.net Your indie-rpg fix. Online.
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I used the $input as a way for you to test the rest
if you are using an on text type event then you are going to be using $2- identifier (or whichever) to get the line of text with the " in it.
if you want to learn you are going to have to read something, so why not the help file?
what I thought you said you wanted was that if the number of " quote marks was even or odd, do something
the 2 // or 2 \\ is that if the %var is divisible by two or not divisible bye two (with no remainder) which can then be used in mIRC to see if a number is even or odd.

/help if then else
"the operators" heading on that page describes the // or \\

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
on *:text:!Checkquote *:#:{
  var %string = $2-
  var %quantity = $count(%string,$chr(34))
  if (%quantity == 0) { msg $chan Error: $chr(34) Not found in text | return }
  if (2 \\ %quantity) { msg $chan odd } 
  if (2 // %quantity) { msg $chan even }
}


try that, adjust it to do what you want

Joined: Oct 2005
Posts: 35
C
Crap Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
Okey, thanx. I'll look more into it in the evening. And I DO want to read untill I understand, but yesterday when I poasted I were so tired I couldent even look at the Remote section, and today I hadnt time to look at the files for more than 5 minutes, but I give it a try later. Cya


#indierpgs @ magicstar.net Your indie-rpg fix. Online.

Link Copied to Clipboard