How do you make time in Squiffy?

User72
26 Nov 2020, 23:42

I tried to make time in a squiffy game with attributes for the hours and minutes, and AM/PM, but something doesn't work.

@set hour = 10
@set min = 0
@unset pm
[[]]:
@inc min 15
{if min > 59:
@set min = 0
@inc hour
{if hour > 12:
@set hour = 1
{if pm:
@unset pm
}{else:
@set pm
}
}
}


Can you help at all?


mrangel
27 Nov 2020, 00:16

As far as I understand it, @set has to appear on its own on a line; because it's processed outside of the text processor. You can't use it inside an if statement.

If you want to set attributes conditionally, you need to use the short forms of the operators.

@set hour = 10
@set min = 0
@unset pm

[[]]:
@inc min 15
{if min > 59:
{@min=0,hour+=1}
{if hour > 12:
{@hour=1}
{if pm:
{@not pm}
}{else:
{@pm}
}
}
}

Bluevoss
28 Nov 2020, 03:14

You are correct (as always).


User72
28 Nov 2020, 23:14

Thanks!