mIRC Home    About    Download    Register    News    Help

Print Thread
#191837 16/12/07 05:26 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
This is a rather silly shortcut suggestion.

With COM's one has to do

Code:
var %x = $com(com).result
.comclose com
return %x


I would love to be able to do something like:
Code:
return $com(com).return

Instead.

which returns the result and silently closes the com.

I can imagine this being rather simple to add but it would make me a happier scripter smile


$maybe
Joined: Oct 2007
Posts: 51
T
Babel fish
Offline
Babel fish
T
Joined: Oct 2007
Posts: 51
what if you need to use the object for more than just one call?
with that method, you would have to reopen it.

in fact, you would never get there, because it'd always get closed before it gets the second call.

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
He knows that, which is why he's suggesting a new property called .return rather than changing the current .result.

Joined: Dec 2007
Posts: 5
C
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
C
Joined: Dec 2007
Posts: 5
That's a very lovely suggestion in my opinion Mpdreamz. Although I understand your calling it silly, I think it's a perfectly valid idea as it is often the case (when returning one value) that we must place a COM's result in a variable, close the object, and then proceed to return the variables value. That's just plain annoying to you (assumption) and I and possibly others who like to explore COM objects. It would make me happy too <3

Joined: Mar 2006
Posts: 395
T
Pan-dimensional mouse
Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
I like this idea myself... Every time I use $com I wonder why its not there allready.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
-I've cooked up a hack method to do this but i have to refrain from posting it due to a challenge :p

Nonetheless (and challenge or not) i'd still love this wink

Last edited by Mpdreamz; 17/12/07 11:09 PM.

$maybe
Joined: Dec 2007
Posts: 5
C
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
C
Joined: Dec 2007
Posts: 5
Oh ? I'd be very interested in learning what it is you did when such information becomes available :P

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Please don't tell me it's

Code:
alias comresult { var %x = $com($1).result | .comclose $1 | return %x }

echo -a $comresult(x)



- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
I won't because it's not,

Please tell me if I'm wrong arv0, but your tone comes off very belittling. Though i can understand your reply, I would not suggest "hacks" to anyone which is why i suggested a valid shortcut.

If its just me not having had my coffee yet and your just joking then i guess i can laugh at it when i have had my coffee smile

Last edited by Mpdreamz; 18/12/07 10:15 AM.

$maybe

Link Copied to Clipboard