mIRC Home    About    Download    Register    News    Help

Print Thread
#123646 25/06/05 08:38 PM
Joined: Jun 2005
Posts: 21
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jun 2005
Posts: 21
How about an option to create identifiers?
Functions that return a value.

Aliasses are nice, but they dont return anything.
Would make alot of scripting easier, more tidy and nicer work.

#123647 25/06/05 08:39 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Aliases can be used to create identifiers, for example:

/alias times2 { return $calc($1 * 2) }
//echo -a $times2(100)

#123648 25/06/05 08:50 PM
Joined: Jun 2005
Posts: 21
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jun 2005
Posts: 21
ohw really?? ohw sorry, i didnt know, been crawling google all about it

#123649 25/06/05 11:53 PM
Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Try crawling mirc.hlp, it's all in there. smile
/help custom identifiers

#123650 26/06/05 12:02 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
heres some (all?) of the relevent things
/return
$isid
$result

As shown RETURN X returns to the caller X, this can be done if in a alias or identifier call, if as an alias $result contains the solution, $isid is $true or $false baed if the alias was called as an identifier.

alias times2 {
if ( $isid ) { echo -a BLAH }
return $calc( 2 * $1 )
}

//echo -a $times2(123)
BLAH
236

//times2 123 | echo -a $result
236

#123651 26/06/05 04:33 PM
Joined: Sep 2004
Posts: 18
E
Pikka bird
Offline
Pikka bird
E
Joined: Sep 2004
Posts: 18
//echo -a $times2(123)
BLAH
246

//times2 123 | echo -a $result
246

#123652 26/06/05 10:51 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
DOh!
/me switches to BS explanation mode!

Well you see its due to me using the small value accumulator of 123, which when multipled results in a destortion of the small differential in valuation of numbers to produce a second column alteration in the final value.

/me switches on the non BS explanation mode!

I think my finger might have hit the wrong key 3 instead of 4, then i duplicated the line the second time without looking closely at it. That i just cant do math well!

#123653 27/06/05 06:34 PM
Joined: Sep 2004
Posts: 18
E
Pikka bird
Offline
Pikka bird
E
Joined: Sep 2004
Posts: 18
The two explanations are good. :-) Greetings.


Link Copied to Clipboard