Probably I'd do this using the code in this post (also in this post). You could also define:
procedure(abWithinRange(wave min max)
In conjunction with abPositive in the earlier post, you'd do:
value(VT("/Vin") cross(abPositive(VT("/clk")-1)*abWithinRange(VT("/Vout") 0.1 0.8) 0.5 "rising"))
Something like that.
I'll link your earlier question to this, because I think it answers both. Your above approach won't really work because it doesn't output a single value - but you could of course alter the logic to return a single value and encapsulate it in a function definition.