|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Hello,
I wonder if this could be possible to be added into the mIRC
e.g:
ON *:TEXT:*:?: { if ($1- ischar) { echo -s WARNING: The $nick just used the $v1 character's private } }
Thanks, ^WeSt
Last edited by westor; 03/12/09 03:21 PM.
|
|
|
|
Joined: Jun 2007
Posts: 933
Hoopy frood
|
Hoopy frood
Joined: Jun 2007
Posts: 933 |
Could you please elaborate?
|
|
|
|
Joined: Jul 2006
Posts: 4,211
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,211 |
Do you mean if ($len($1-) == 1) { ? If so, probably won't be added, you're too lazy seriously ~
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Yeah, please elaborate on what you mean. ischar to mean seems like you're wanting to know that it's a character (i.e. not a number of symbol -- isalplha handles that). But what you put as the warning doesn't seem to make sense -- "character's private"?
Also, keep in mind that $v1 is the result of the check. An is___ check will return $true or $false, which I doubt is what you're expecting in your example.
If you meant it's a single character,then $len() == 1 is just as easy as mentioned. If you mean something else entirely, please explain. A sample input and output for the example script would help us to understand what you mean.
Last edited by Riamus2; 03/12/09 03:54 PM.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jul 2006
Posts: 4,211
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,211 |
Also, keep in mind that $v1 is the result of the check. An is___ check will return $true or $false, which I doubt is what you're expecting in your example.
So wrong, $v1 return the first part of the condition.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You're right. I always use it with X == Y format and when I actually think of that, I see my error. I wasn't thinking of is___ correctly (that "is" is basically the == and ___ is the second part of the condition). I was incorrectly thinking of it as all the first part of the condition. Oops. Shows how much I use those is___ checks while also displaying the result using $v1... i.e. never.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
if you actually mean to test $len($1) == 1 like the others are assuming, that should not be considered the behaviour of "ischar" imo.
The behaviour of the is* text matchers (isalpha, isalnum) don't test single characters, so if "ischar" would be misleading. "ischar" looks like you're asking the question: is $1 a set of characters? ..similar to "isalpha" (is $1 a set of alpha chars).
If this is really about testing a single char, you'd want if ($1 issinglechar), but that's just getting superfluous. Just use the len check if that's what you want.
If you mean something else, you need to *explain*. You can't expect people to understand you from a single line of an ambiguous example.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
I mean man when the $1- has any character's in then echo that the $1- has characters the $v1 was an silly example to saw you what i mean
e.g:
if ($1- ischar) { echo Yes the $1- is a char! }
|
|
|
|
Joined: Mar 2004
Posts: 54
Babel fish
|
Babel fish
Joined: Mar 2004
Posts: 54 |
A simple solution can be this:
if ($0) echo $1-
or, if $1- can be $null: (if alias is called like this: $test(,,) )
if ($1- != $null) echo $1-
Last edited by Zed; 04/12/09 04:07 PM.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
lol? that has not sence with that i want to tell you.
|
|
|
|
Joined: Jun 2007
Posts: 933
Hoopy frood
|
Hoopy frood
Joined: Jun 2007
Posts: 933 |
I mean man when the $1- has any character's in then echo that the $1- has characters the $v1 was an silly example to saw you what i mean
e.g:
if ($1- ischar) { echo Yes the $1- is a char! } You're still not making any sense. Give us examples!
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
As mentioned, give an example INPUT and OUTPUT rather than just the script as we obviously aren't understanding what you want. If all you're looking for is whether or not it's letters, that's what isalpha is for. If you want to know if there is data, use if ($1-) { } or just if ($1) { } . But without an actual example of input and what you expect the output to be, no one seems to know what you want.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
You want to test if "$1" has "characters" in it? As in, if $1 exists?
if ($1 != $null) { echo YES IT IS. }
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
OK, lets be more specific
ON *:TEXT:*:?: { ; THE FIRST IF IS THE USUAL EXAMPLE if ($1 == $chr(35)) { echo Yes the $1 is a character } ; THE SECOND IF IS THAT THAT I WANT TO GIVE YOU EXAMPLE if ($1 ischar) { echo Yes the $1 is a character } }
NOTE: I want to tell you that the ischar to return if there are any $chr(*) inside an IF, as there exist the if ($1 isnum) { echo Yes it is an number }, It's easy and you can understand what i mean, ok my english is little poor but it is an good idea who those who has understand!
Last edited by westor; 05/12/09 04:03 PM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
You need to tell us what you mean when you say "character".
Do you mean: letters? numbers? punctuation? control codes? (0-31) all basic ascii (32-127)? all extended ascii (128-255)? all ascii (32-255)? all unicode characters?
-genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
And how, realistically, is this different from if ($1 != $null) { echo Yes the $1 is a character} as suggested (with a slight alteration to the wording in the echo) by argv0 in the post located hereok, you'll have to scroll down, as referencing the reply directly only brings you to the top of the original topic
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
All the $chr(*) return character's
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
And how, realistically, is this different from if ($1 != $null) { echo Yes the $1 is a character} as suggested (with a slight alteration to the wording in the echo) by argv0 in the post located hereok, you'll have to scroll down, as referencing the reply directly only brings you to the top of the original topic I had never give this example just look the other new that i gave!
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
He was giving YOU an example with that. You still have not given a sample INPUT and OUTPUT (something I've requested multiple times). If you want to know if it is a single value, use: if ($len($1) == 1) {} That will tell you it's a single character. If you want only letters, use isalpha. If you want anything except numbers, use !isnum. If you want anything and any length, use: if ($1 != $null) {} A $chr() is any ascii character (including numbers). The only thing you'd filter out that way would be unicode. Is that what you're trying to do? Check if it's unicode? Really, you have to explain what you're looking for. If no one here knows what you are requesting, then it's a pretty good bet that you aren't explaining it well. Give input and output examples (not more script examples). Such as: <nick> H <bot> This is a character. <nick> Ha <bot> This is not a character. <nick> 1 <bot> This is a character. <nick> " <bot> This is not a character. <nick> テ <bot> This is a character.
This is the kind of example we need to know what you're asking for. Change it to show the right outputs and, if necessary, add or remove some of the examples in there.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
westor:
ANY text is a $chr(*), therefore ANYTHING ischar, therefore:
if ($1 != $null) is what you want.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
|