Decrementing in an if statement

My character is feeding the chickens.

This works (as long as there's no space between { and @ (else it becomes null):

[give them some corn]:
{if corn>0:{@corn -= 1}}
You now have {corn} handful of corn.

But this doesn't decrement the value

[give them some corn]:
{if corn > 0:{@dec corn}}
You now have {corn} handful of corn.

How come the second statement doesn't work?


I tried this, too:

{if corn > 0:{@corn = @dec corn}}

and

{if corn > 0:{@set corn = @dec corn}}

Ah, I know why. @dec has to be on it's own line. This works:

[give them some corn]:
{if corn > 0:{
@dec corn
}}
You now have {corn} handful of corn.

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums