alias currencyconvert {
; set up the currencies (in relation to each other)
; format: code1 unit1 rate1,code2 unit2 rate2,...
var %currencies = USD $ 1,GBP £ 0.4839,EUR € 0.6941,CAD C$ 0.9553,CHF sFr. 1.1627,JPY ¥ 114.8122
; set the floating point (round)
var %float = 2
var %from, %to
; error checking
if ($1 !isnum 0-) { return }
$iif(($wildtok(%currencies,$2 * *,1,44)),%from = $v1,return)
$iif(($wildtok(%currencies,$3 * *,1,44)),%to = $v1,return)
; calculation and return according to properties
return $iif(($istok($prop,long,44)),$1 $gettok(%from,1,32) to $gettok(%to,1,32) $+ :) $&
$round($calc($1 * (1/ $gettok(%from,3,32)) * $gettok(%to,3,32)),%float) $&
$iif(($istok($prop,unit,44)),$gettok(%to,2,32))
}