I think there should be a \sign text macro so that you could do...
var x=1,y=-2
src<<"\sign[x]"
src<<"\sign[y]"
And it would output "+1" and then "-2"
Just a thought I had randomly. Something small that could be added easily.
ID:134112
Jun 6 2007, 10:11 am
|
|
This is mainly for convenience, it can be avoided but it would be easier with it.
I think there should be a \sign text macro so that you could do... var x=1,y=-2 And it would output "+1" and then "-2" Just a thought I had randomly. Something small that could be added easily. |
In response to Lummox JR
|
|
Lummox JR wrote:
It'd be quasi-useful, but at this point the prospect of adding new text macros is pretty bleak. You're better off soft-coding it. proc/NumPlus(n) Or for a slightly fancier version: proc/NumPlus(n) return "[n<0?"":"+"][n]" I think I'll stick that into a snippet, although I don't think it's unusual enough to mandate an actual post in my database... |
That also returns +0, but then when I've used this it's been for a Roguelike, where +0 makes sense. If you don't want that behavior, just change the if() to if(n<=0) instead.
Lummox JR