mIRC Home    About    Download    Register    News    Help

Print Thread
Com Result and close #191837 16/12/07 05:26 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline OP
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
Re: Com Result and close [Re: Mpdreamz] #191853 17/12/07 01:35 AM
Joined: Oct 2007
Posts: 51
T
Trashlord_ Offline
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.

Re: Com Result and close [Re: Trashlord_] #191858 17/12/07 02:59 AM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
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.

Re: Com Result and close [Re: Mpdreamz] #191864 17/12/07 04:14 AM
Joined: Dec 2007
Posts: 5
C
Champagne Offline
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

Re: Com Result and close [Re: Champagne] #191884 17/12/07 03:49 PM
Joined: Mar 2006
Posts: 393
T
The_JD Offline
Fjord artisan
Offline
Fjord artisan
T
Joined: Mar 2006
Posts: 393
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)
Re: Com Result and close [Re: Champagne] #191903 17/12/07 10:46 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline OP
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
Re: Com Result and close [Re: Mpdreamz] #191919 18/12/07 01:50 AM
Joined: Dec 2007
Posts: 5
C
Champagne Offline
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

Re: Com Result and close [Re: Mpdreamz] #191923 18/12/07 02:52 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
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"
Re: Com Result and close [Re: argv0] #191932 18/12/07 10:14 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline OP
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