Case 1: The disappearing space.
Consider this function, whose purpose is to hide output if the variable "private" in the calling macro is set to 1.
Code: Select all
[r, if(private == 0), code: {
[r: " "+input]
};{
[s,g,r: " "+input]
}]
A space is included so that it can be formatted not to leave a gap if information is hidden. For instance, if you want "Rolling." vs "Rolling 12." to appear, the idea is you would input:
Rolling[r: privateOutput(12)].
and if private == 1, it should output "Rolling." to everyone but the GM(s) and the invoking user, who see "Rolling 12."
Here's the weird part, though:
Code: Select all
[h: private = 0]Rolling[r: privateOutput(12)]
Case 2: The disappearing plus sign.
I run into a lot of cases where the rules of a game, by convention, prepend things with a plus sign if it's positive. I wanted to make a UDF to automate this. Thus, getSign:
Code: Select all
[h, if(arg(0) >= 0): result = "+ "+arg(0); result = "- "+abs(arg(0))]
[h: macro.return = result]
Code: Select all
[h, if(arg(0) >= 0): result = "+"+arg(0); result = arg(0)]
[h: macro.return = result]