mIRC Home    About    Download    Register    News    Help

Print Thread
#123646 25/06/05 08:38 PM
F
FromTheSun
FromTheSun
F
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,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
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
F
FromTheSun
FromTheSun
F
ohw really?? ohw sorry, i didnt know, been crawling google all about it

#123649 25/06/05 11:53 PM
M
mIRCManiac
mIRCManiac
M
Try crawling mirc.hlp, it's all in there. smile
/help custom identifiers

#123650 26/06/05 12:02 AM
D
DaveC
DaveC
D
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
D
DaveC
DaveC
D
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