mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2021
Posts: 33
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Nov 2021
Posts: 33
Just run the test below; if the dynamic variable is at the beginning of $calc, there is no problem, but if it is after, it is not counted.

alias mirc.scalc.var.dinamic {
var %xa 2
echo -a $calc(1 + %x [ $+ [ a ] ]) // $calc(%x [ $+ [ a ] ] + 1) // $calc(1 + %xa)
}

How would I get this to work?

tks!

Joined: Sep 2003
Posts: 44
O
Ook Offline
Ameglian cow
Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 44
Using $($+(..),2) works.

Code
alias mirc.scalc.var.dinamic {
  var %xa 2
  echo -a $calc(1 + %x [ $+ [ a ] ]) // $calc(%x [ $+ [ a ] ] + 1) // $calc(1 + %xa)
  echo -a $calc(1 + $($+(%,x,a),2)) // $calc($($+(%,x,a),2) + 1) // $calc(1 + %xa)
}

Joined: Dec 2002
Posts: 3,896
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 3,896
As Ook mentioned, $() can resolve the issue. However, one of the reasons why it's not working in your example is that [ ] brackets must be space-separated from everything around them. In your example the ] bracket is attached to the ) bracket.


Link Copied to Clipboard