mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Re: New Operator for if-then-else #43065 24/08/03 12:41 AM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
You have to understand that some people do not understand regular expressions, and not everybody goes to this webboard.


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: New Operator for if-then-else #43066 24/08/03 12:48 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well regex was just to make the script shorter, regex was NOT needed. All that is needed is $left.
alias isurl {
if (($left($1-,7) == http:// || $left($1-,6) == ftp:// || $left($1-,9) == gopher:// || $left($1-,4) == www. || $left($1-,4) == ftp.) && $len($1-) < 257) return $true
return $false
}

I just used $regex to make it cleaner. Using $left is very basic and if you can't figure that out, imo you don't have a need for an isurl because you're not that good at scripting yet. Also I don't see what going to the forum has to do with it, I found out how mIRC defines a url by looking in the helpfile. It determines it by what the text begins with and how long the text is. To check what the text begins with, I want the left part of the text, therefore I use $left. To get the length I use $len. I don't see why you'd need to come to the forum to figure that out, /help should be enough.

Re: New Operator for if-then-else #43067 24/08/03 01:03 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
I frequently read this board and can't even count how many thousands of times I've read you calling someone/something dumb or stupid. You say you come here to discuss as the description of the board says, but I'm yet to discover what is the value of this post of yours as a discussion here. Regardless of what your point is, no one here needs or wants to know what you think it's dumb, so I guess you can't say things like this here.

My post was not valuable? He asked for a way to tell if something was a URL, I gave him a script to do it. How is that not valuable? Seems valuable to me. As I said, if he didn't actually want someone to provide a script, he never should have asked for it. If he would have just said "mIRC needs an isurl" I would have left it at my first post, there is no uniform way to define a URL. However, he also said he wanted a script that does it and he provided the definition of the URL he wanted used, I therefore provided the script. He then complained about the script. All I meant was, if he didn't want a script, why did he ask for one? After that he then corrected himself saying he meant was there already an isurl builtin, and if you notice, at that point I said nothing further. I don't see how any of that is invaluable.

Quote:
In this specific thread, the guy wants the identifier built-in, he thinks your solution is complex, so what?

First off, he DID NOT ask for a built in identifier (originally), he asked if there was a way to do it already, I've now provided him with two seperate ways of doing it in a 2 line script.

Quote:
It's his view, not yours; you don't have the right to throw to him your personal view as a better one and diminish his one. It's simple.

Yes it is his view, and thats fine. However, I don't see why mIRC should be made slower by having to process an additional operator simply because he doesn't want to copy/paste a 1 line script. As I said, if that is ok, well then I want a $gt because I hate typing out $gettok each time. Typing $gt will make it take me half the time to type it. However if I made a post "mIRC needs $gt because $gettok is too long" you and I both know I'd get nothing but laughs.

Quote:
excessively disgusting to read someone flaming the way you do (and I can see in other threads that I'm not the only one).

You yell at me for flaming him... what are you doing right now, useful dialog? Did you forget that this formum has a private message feature and that you could send your complaint directly to me? I doubt it; you chose to post this in public, for all to see. How exactly does that give you the right to tell me what to do? You're doing the same exact thing.

Quote:
That said, please stop being rude here and there when you can't seem to convince a person. It's ridiculous, disgusting, it decreases both your credibility and the level of this board - this one being what a lot of people here are concerned with. People could lose the interest of posting suggestions if they expect someone to come, disagree and call them dumb for a reason they don't know yet.

I did not call him dumb, so please don't imply that I did. I said saying a ONE LINE SCRIPT is complex is dumb. He wants an alias made that is an alias for that single $regex line. I mean if this is added, then we need tons of other things. isemail, ischannelname, is...... All of those can be scripted very easily. Fine, you can say $regex is complex, but as I've demonstrated, and you should know, this same thing can be done using only $left, which is far from complex.

Furthermore, I'm tired of people saying I "attack" people and then attacking me as a result. If you don't like me, when you see "By: codemastr" you can just skip right over it to the next post. If you don't want to read what I have to say, then don't read it, don't complain to me because you don't like what I say. Except for maybe 1-2 incidents, the person I supposidely insulted has never complained to me about what I've said, it has always been people, like yourself, who had nothing to do with the original debate who decided to jump into it. If the original poster did not like what I had to say, how come he/she didn't complain to me? But, if you or anyone else feels like writing a post like this again, what I suggest you do is, to paraphrase the standard Unix BOFH phrase, just delete it instead, because that's all I'm going to do anyway.

Re: New Operator for if-then-else #43068 24/08/03 01:24 AM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
Well, I understand a little of $regex, and of course $left.

And what I meant was that if $regex was the only way, not everybody would understand it, and for $isurl to work, that person would have to see your example, which isn't too practical. However, I support $isurl being added.


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: New Operator for if-then-else #43069 24/08/03 01:49 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Quote:
However if I made a post "mIRC needs $gt because $gettok is too long" you and I both know I'd get nothing but laughs.

/me now begins to wonder why $r was added into mirc when $rand existed :tongue:


new username: tidy_trax
Re: New Operator for if-then-else #43070 24/08/03 01:57 AM
Joined: Dec 2002
Posts: 339
D
Doomstars Offline OP
Fjord artisan
OP Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
mIRC can already tell if something is a URL or not. When I move my mouse over something, if it's an URL, I can double click it and it will go to the site. I'm suggesting that Khaled makes an isurl (or as some suggested it, $isurl) to see if the given word is an URL recognized by mIRC.

Re: New Operator for if-then-else #43071 24/08/03 02:02 AM
Joined: Dec 2002
Posts: 339
D
Doomstars Offline OP
Fjord artisan
OP Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
I bet I have an idea why. "$rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z)" is lengthy compared to "$r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z)"

One solution would be to modify $rand so this could be done. $remove($rand(a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z),$chr(32)). Where $rand(a,z,1,9) would return "D 4" for example.

Re: New Operator for if-then-else #43072 24/08/03 04:36 AM
Joined: Dec 2002
Posts: 196
T
trenzterra Offline
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
Wrong thread?


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Re: New Operator for if-then-else #43073 24/08/03 02:36 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thats the exact reason why he said it would get laughs


new username: tidy_trax
Re: New Operator for if-then-else #43074 24/08/03 03:41 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If I remember, and I might be wrong, $r existed before $rand and $r just still exists for backwards compatibility.

Re: New Operator for if-then-else #43075 24/08/03 04:01 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
either way, if $rand existed why add $r, if $r existed why add $rand crazy


new username: tidy_trax
Re: New Operator for if-then-else #43076 24/08/03 04:40 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
If $r() existed first (which versions.txt suggests it did) then it makes sense to change it to $rand() because $r() is a completely ambiguous name. I hate when people still use $r() in scripts simply for the sake of 3 characters. It makes reading the script a lot harder, particularly for people new to scripting who wouldn't even know what $r() is.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: New Operator for if-then-else #43077 24/08/03 04:52 PM
Joined: May 2003
Posts: 2,265
P
pheonix Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i suppose...., but 1 trip to the help file(/help $r) would of solved that problem :tongue:.


new username: tidy_trax
Re: New Operator for if-then-else #43078 24/08/03 06:16 PM
Joined: Feb 2003
Posts: 2,626
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,626
I personally like this idea, and meant to post sooner.

isurl would check if the string is identified as being an url, using the same formula that mIRC uses to determine hotlinks and url catching. Whether it catches ALL TYPES of urls is irrelevant, and best discussed in a seperate thread titled "Why doesn't mIRC recognize nntp:// urls?"

In response to codemastr's question: "And how does one define what a url is? There is no general way to do it. Every URL scheme defines its own format." As I stated above, it will use the same scheme that mIRC uses to detect these formats currently, however limited/ incomplete/ inaccurate it may be.

I propose the following formats:

if ( string isurl ) // checks if string can be identified as an url by any known schemes.
if ( string isurl protocol ) // checks if string can be identified as an url of said protocol.

Examples:
if ( http://google.com/ isurl ) { true }
if ( www.google.com/ isurl ) { true }
if ( ftp.google.com isurl ) { true }

if ( www.mirc.com isurl http ) { true }
if ( ftp.mirc.com isurl ftp ) { true }
if ( ftp://ftp.mirc.com isurl http ) { false }
if ( ftp.mirc.com:80 isurl http ) { true }

You get the idea.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: New Operator for if-then-else #43079 25/08/03 12:20 AM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I seccond the suggestion, or even an identifier $isurl would be fine too.. however it could be, it would be a fine small addition.


* cold edits his posts 24/7
Re: New Operator for if-then-else #43080 25/08/03 05:29 AM
Joined: Dec 2002
Posts: 339
D
Doomstars Offline OP
Fjord artisan
OP Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
$isurl($1-).prop

.prop would be http ftp gopher and any other types of URLs. Also -http would see if it's anything other than http.

$isurl(http://www.mirc.com).-http would return false

$isurl(http://www.mirc.com).-ftp would return true.

$isurl(http://www.mirc.com,-ftp) would NOT work. Cause some may have comas in the possible URL causing error.

$isurl(http://www.mirc.com) would return $true

$isurl(http://wwmirc).-ftp would return true since it's anything but a FTP working URL

Re: New Operator for if-then-else #43081 25/08/03 12:40 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
To find if something wasn't a certain protocol why couldn't people just use $isurl(blah) && !isurl(blah,notthisprotocol)? And making it a property just so that you could have commas directly in the parameters wouldn't make sense because no other identifier allows commas, there's no point changing that for a single identifier.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: New Operator for if-then-else #43082 25/08/03 03:55 PM
Joined: Dec 2002
Posts: 339
D
Doomstars Offline OP
Fjord artisan
OP Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
Cause $isurl(http://dictionary.reference.com/search?q=test,test) would break the identifier so to speak.

http://dictionary.reference.com/search?q=test,test

Re: New Operator for if-then-else #43083 25/08/03 05:42 PM
Joined: Feb 2003
Posts: 2,626
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,626
Obviously you would pass %2C instead of a comma. This IS the uri standard. It is the fault of Internet Explorer and other browsers for relaxing this restriction and allowing their plain use.

Take for example your own post and how UBBThreads failed to underline it completely.

http://dictionary.reference.com/search?q=test%2ctest


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: New Operator for if-then-else #43084 25/08/03 05:53 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
$file(c:\blah,blah.txt) 'breaks' that identifier too. There's little point breaking consistency and removing the possibility of extra parameters in the future just to save assigning a value with a comma to a variable before using it.

I'm pretty sure I had this exact same conversation with you just a few weeks ago.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Page 2 of 2 1 2