mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#155604 - 08/08/06 04:59 AM $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
this is a really dumb and simple feature suggestion, but i think it will speed up the ability to script considerably, and it seems as if it would be quite trivial to add support for it.

anyway, no modification to the way tokens currently work, but i think it would be excellent to have the ability to use something like:

$1(text goes here) would return text

$2-3(testing token scripting methods) would return token scripting.

$-1(well then) would return then

$1-(bunch of text goes here) would return bunch of text goes here

have it determine which token you would like to use either by always assuming space, or even better use the character that was used when the tokenize command was issued..

hopefully this isn't a feature so small that it's overlooked. i believe it would improve the speed [speed of writing, not speed of processing] and readability of scripts.

Top
#155605 - 08/08/06 05:13 AM Re: $1 token extension
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
$gettok works in the same manner, just with a different format

Yours:$1(text goes here)
Current:$gettok(text goes here,1,32)

Yours:$2-3(testing token scripting methods) would return token scripting.
Current: $gettok(testing token scripting methods,2-3,32)

Yours:$-1(well then) would return then
Current:$gettok(well then,-1,32)

Yours:$1-(bunch of text goes here) would return bunch of text goes here
Current:$gettok(bunch of text goes here,1-,32)

Not everyone uses the space character to separate items in a token list, and in some case (eg: having a list of nicks to send a message to) the token separator has to be a comma for the command to work with the list

Sorry, but I can't say that I support this.

Top
#155606 - 08/08/06 06:39 AM Re: $1 token extension
Rand Offline
Fjord artisan

Registered: 28/02/05
Posts: 342
I don't really support this either..

If you really need to do that, you should take a look at /tokenize.

Example:

//tokenize 32 one two three four | echo -ag $2-3

Would echo "two three" to your active window. (I add the g switch, because I usually don't like my script echos appearing in my log, and g prevents it from being logged.)

Top
#155607 - 08/08/06 04:32 PM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
no mean to be rude or anything, but did either of you actually read my post in its entirety?

the reason for wanting this is nothing more than making scripting faster and more legible. 99% of the $gettok's i use are for spaces, or the current token i'm using.

that's why i said
"have it determine which token you would like to use either by always assuming space, or even better use the character that was used when the tokenize command was issued"

i am very familiar with the gettok command, too familiar even. it's getting annoying to do $gettok(,1,32) every time that could just do $1().

granted, this is not the most innovative feature ever, but i think it would add a nice touch is all.

Top
#155608 - 08/08/06 04:57 PM Re: $1 token extension
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
You basically want a shorter $gettok alias, right?

I don't see $gettok as being a hassle. Maybe make an alias to make the work easer? Make gs for gettok with a spece delimiter, gc for colon, g? for whatever else? Use $gs(this is a sentance,2).
_________________________
-KingTomato

Top
#155609 - 08/08/06 05:29 PM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
you got it.. i guess you're right, i could do that. it would be grand if mirc came that way though. especially since $1() isn't used for anything and since the way tokens work, there's really no way for scripts to modify the token alias, so this wouldn't break anything currently working, either.

Top
#155610 - 08/08/06 09:24 PM Re: $1 token extension
Loki12583 Offline
Hoopy frood

Registered: 22/01/04
Posts: 1252
alias simpletok { return $gettok($1-,$prop,32) }

$simpletok(here's a bunch of text).1 returns "here's"
$simpletok(here's a bunch of text).-1 returns "text"
$simipletok(here's a bunch of text).2-3 returns "a bunch"

I've though about a $1() alias a few times as well but this is probably the closest thing we'll get.


Edited by Loki12583 (08/08/06 09:32 PM)

Top
#155611 - 09/08/06 12:03 AM Re: $1 token extension
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Yes I did read it in it's entirety, and there's a perfectly good way of doing what you're asking for already available. Additionally, with yours, the token separators would have to be a fixed item, rather than letting the programmer decide if they want to use something else.

Top
#155612 - 09/08/06 04:23 AM Re: $1 token extension
Om3n Offline
Fjord artisan

Registered: 06/07/03
Posts: 655
It is just plain inpractical, where would it even end?

range of $-999() / $999() ??
_________________________
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby

Top
#155613 - 09/08/06 05:05 AM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
"Additionally, with yours, the token separators would have to be a fixed item, rather than letting the programmer decide if they want to use something else. "

ok, first and foremost, i'm not requesting that an alias $gettok be replaced, i'm asking for one to be added on. so get off of your high horse of saying "that isn't dynamic" "that limits your abilities" etc etc. it does not, this is a lie. it uses the exact same token delimiter as $1 itself does, so are you saying the same thing about $1 and $2 and $3 etc etc?

"It is just plain inpractical, where would it even end?

range of $-999() / $999() ?? "

the hell? you DO realize those are already tokens anyway, right? THOSE ALREADY EXIST.

for you scripting "geniuses" out there (who apparently are convinced i'm a newb, for some strange reason) lets try a little exercise.

//alias 999 return hi | echo -a $999

hmmz, didn't work, did it? that's because $999 is a freaking token, just like normal mirc.

what my question is, is why don't you guys just go to the bug reports forum right now and complain ZOMFG YOU DON'T NEED $1 $2 $3 $4 ETC ETC CUZ YOU CAN DO IT BY SETTING A VARIABLE TO THE SAID TEXT AND PARSE IT USING GETTOK! WTF KHALED YOUR STUPID FOR ADDING $1- SUPPORT WHEN YOU COULD HAVE JUST USED $GETTOK ON A VARIABLE!!!

get over yourselves and admit, you just want to argue the point that this is a bad idea to prove your scripting superiority and my scripting inferiority, when in the end, the truth is, you have no clue how good i am or am not of a scripter.

thanks, and have a nice day.

Top
#155614 - 09/08/06 05:57 AM Re: $1 token extension
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
You've made your arguments for this, I've given you my opinion on it.
I'm not saying that some people might find it handier, but I am saying that, if it's implemented, it should have a variable location to indicate what character is being used a the token separator. As I said earlier, sometimes using the space character just doesn't work.

Top
#155615 - 09/08/06 06:27 AM Re: $1 token extension
Rand Offline
Fjord artisan

Registered: 28/02/05
Posts: 342
Quote:

//alias 999 return hi | echo -a $999

hmmz, didn't work, did it? that's because $999 is a freaking token, just like normal mirc.


Actually, $999 is a builtin identifer that points to the 999th space delimited position of a tokenized string. I'm sure you already knew this, but you worded it rather poorly. You can't replace $calc() either. (Though it will work with /1 and /calc)

Quote:
what my question is, is why don't you guys just go to the bug reports forum right now and complain ZOMFG YOU DON'T NEED $1 $2 $3 $4 ETC ETC CUZ YOU CAN DO IT BY SETTING A VARIABLE TO THE SAID TEXT AND PARSE IT USING GETTOK! WTF KHALED YOUR STUPID FOR ADDING $1- SUPPORT WHEN YOU COULD HAVE JUST USED $GETTOK ON A VARIABLE!!!


That's just ridiculous. I pointed out earlier you can: /tokenize 32 %var, and backreference it using $1-.

Yours: //echo -ag $1-4(This is a test and only a test.)
mIRC's: tokenize 32 This is a test and only a test | echo -ag $1-4

Someone already posted above how to do it in a fashion that you want.:
Code:
alias _ { return $gettok($1-,$prop,32) } 


//echo -ag $_(This is a test and only a test).1-4



Quote:
get over yourselves and admit, you just want to argue the point that this is a bad idea to prove your scripting superiority and my scripting inferiority, when in the end, the truth is, you have no clue how good i am or am not of a scripter.


This isn't the issue, the idea in itself isn't a horrible suggestion. The entire issue is that what you want is already easily done using either an alias, or /tokenizing the text and then using $1 to reference the parameters.

I certainly am not judging your scripting abilities. There really is no need to get too defensive over it, especially since it's just a suggestion. Many suggestions never make it into the client. (Take emoticons for example, how many people have actually suggested those over the years (answer: countless))

Top
#155616 - 09/08/06 06:55 AM Re: $1 token extension
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Quote:
range of $-999() / $999() ?? "

the hell? you DO realize those are already tokens anyway, right? THOSE ALREADY EXIST.


I disagree, i doubt $999 exists i doubt it very much. Proof i ask for!
PS: consider first that you cant execute a command over 950 (or so) characters

And on this $N() etc I think your just being a bit lazy, the whole idea is to reduce the need to type "gettok" and "," and ",32" I mean omg come on!

But if u insist, here it is with one simple alias added, two extra characters "_" and "," and the "(" typed a bit earlier.

alias _ return $gettok($2,$1,32)

$_(1,text goes here) will return text
$_(2-3,testing token scripting methods) will return token scripting.
$_(-1,well then) will return then
$_(1-,bunch of text goes here) will return bunch of text goes here

* Personally i find these pointless as $gettok is only one of several token identifiers, what if u want all the tokens except for 5 ? $_(1-4,<text>) $_(6-,<text>) OR a MUCH SIMPLIER $deltok(<text>,5,32) next you well want a shorter deltok!

Top
#155617 - 09/08/06 07:00 AM Re: $1 token extension
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
SHHHH No need to give him ideas.. laugh

Top
#155618 - 09/08/06 07:12 AM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
sorry if i was too harsh, and i do appreciate your responding to my query rationally.

i do think it's a bit of a rediculous statement to say that this isn't needed because it can already be done. one may argue that you can do it through other methods, or that it's just too small of an improvement to mirc to even consider adding, but i feel it's injust to complain that it is completely invalidated by the fact that it can be done with $gettok. that isn't true, as i've explained as well as i can -- sorry, my gift is not communication, especially not typed communication.

i do know what $999 is and why it's there. that's the point i was trying to make, it will never be used for anything else anyway, so it will not modify mirc in an adverse way, just simply make an extension of its existing capabilities.

i was not getting defensive about my scripting abilities, but i was getting rather frustrated with people responding saying "oh, this can be done with $gettok". i obviously know that (though i made the mistake of not plainly stating that in my original post, and i realize that). when someone says that a feature is not needed because it's already there when the specifics of my request or not, that's a direct offense against my knowledge of how scripting works, point blank.

i do appreciate the suggestions of loki and king tomato giving scripting examples, but really that wouldn't be as convenient as using it the way i suggested.

i really do not have a problem with people thinking i'm uneducated in the scripting ways. even if i weren't, i would become upset if someone would say that my idea is invalid simply because there are working examples of how to "get this done" when the beef of the feature suggestion is not to make some ground breaking changes, but to simply allow scripters to type a little less.

Top
#155619 - 09/08/06 07:22 AM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
"I disagree, i doubt $999 exists i doubt it very much. Proof i ask for!"

if you would take the time to read and understand what has been written, you would have known that i've already provided proof.

//alias 999 return Test | echo -a $999

i don't care about deltok or puttok or anything for that matter, i am just saying why the hell not add on to the current functionality of the $1 and so on identifiers? of course, i will not ask for a shorter deltok, because that is already available via using normal textual aliases. my idea, however, utilizes currently existing identifiers, and i feel that's what makes it a feature worthy of suggesting.

edit: for arguments sake, you could even do

//alias 123456 return hi | echo -a $123456

and it doesn't work. even if it did, that truly doesn't have anything to do with my feature suggestion. the end of my feature suggestion would be to end where mirc itself ends with its tokens. i don't see anything wrong with that.

edit2: just for kicks, i just tried the following and it doesn't even work.

//alias 12345678901234567890-12345678901234567890 return hi | echo -a $12345678901234567890-12345678901234567890

for proof that this example would work in the event that it was a real idenitifier, add a - to the beginning like so:

//alias -12345678901234567890-12345678901234567890 return hi | echo -a $-12345678901234567890-12345678901234567890

apparently, you don't know much about programming outside of mirc scripting. khaled does not have a new alias for every single token combination available, he just has a simple chunk of code in the aliases function which identifies if an alias is a number and if it has - in it or at the end, and if so it executes the token identifier routine. it would be quite trivial for him to add support for what i've said, but even then, i don't have a clue if it would be something he'd be interested in doing. and depending on his code, it might not be as simple as it first appears to be.


Edited by Dromedary (09/08/06 07:38 AM)

Top
#155620 - 09/08/06 09:34 AM Re: $1 token extension
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Quote:
if you would take the time to read and understand what has been written, you would have known that i've already provided proof.
//alias 999 return Test | echo -a $999


LOL if you had read what I said you would have understood that there CAN NOT be a $999

PS...
//alias 999 return Test | echo -a $999
* /echo: insufficient parameters

Hmmm your proof would appear to indercate that $999 doesnt exist.

Quote:
i don't care about deltok or puttok or anything for that matter, i am just saying why the hell not add on to the current functionality of the $1 and so on identifiers?

The current functionality of the $N system doesnt even extend to what you were specifying N as , your 3rd original example has no matching $N directive
//alias -1 return Hi | echo -a $-1
Hi

Your also wishing to extend the functinality of something in a direction that it really has no connection to. $N represents the passed parameters of a command or idetifier called alias, they have nothing to do with your idea of selecting some/all/no words in a sentence and evaluating to them. The only thin connection it has is that $N are loaded using space seperated words when passed as a command.

Quote:
apparently, you don't know much about programming outside of mirc scripting. khaled does not have a new alias for every single token combination available, he just has a simple chunk of code in the aliases function which identifies if an alias is a number and if it has - in it or at the end, and if so it executes the token identifier routine. it would be quite trivial for him to add support for what i've said, but even then, i don't have a clue if it would be something he'd be interested in doing. and depending on his code, it might not be as simple as it first appears to be.


Your just a little to arrogant for your own good really arent you, anyone disagrees with you and you start hurling insultive behavour out. I have been coding for longer than likely half the people here have been alive, and I still can admit that in no way am i gonna know a tenth of what everyone else combined knows, likely less than a thenth of that even. However yes i do know he doesnt need to code an "alias" for each possablity, in fact i think you would be hard pressed to show where i said he did need to, so on what you said, ill reply just once with I agree it would likely take stuff all to extended the $N identifier subroutines from returning said $N identifiers, to also return the equvilant of $gettok($1,N,32) [$1 being the passed text, N being 2-3 or what ever $N N was], BUT then again it wouldnt be hard to add $join(%varname,text) to take the same action as %varname = $+(%varname,text) but would it make sence to obscure the use of JOIN for such a different purpose?

Top
#155621 - 09/08/06 09:51 AM Re: $1 token extension
Dromedary Offline
Ameglian cow

Registered: 08/08/06
Posts: 26
"yes i do know he doesnt need to code an "alias" for each possablity, in fact i think you would be hard pressed to show where i said he did need to"

your post was in response to [seemingly backing up] the statement made here:

"It is just plain inpractical, where would it even end?

range of $-999() / $999() ??"

sorry if i figured you wrong for that. either way, your explaination of $999 "doesn't exist" is a bit of a moot point, because it technically does exist, it's what the identifier points to that doesn't exist. that was the point i was making.

Top
#155622 - 09/08/06 10:07 AM Re: $1 token extension
jizzy Offline
Vogon poet

Registered: 09/05/06
Posts: 122
Nice idea, your right most tokens are used with 32 (space character). Hopefull the jibberish above gets ignored, and your suggestion is considered by khaled.
_________________________
If only women came with popup menus and online help.

Top
#155623 - 09/08/06 12:59 PM Re: $1 token extension
Zerg Offline
Ameglian cow

Registered: 01/10/03
Posts: 25
anyway, arguing over the internet about an identifier is *quite* lame. for both sides. as for the suggestion, i'd say it might be a good idea, but i doubt khaled will ever do it.

Top
Page 1 of 2 1 2 >