Using time and date to set events

First it’s best to format the calculation like this

<<set $Gold -= 100>>

The way you formatted it will decrease the gold every time you visit the passage, as you noted.

The check_date widget will not really be useful because, presumably, you want recurrent payments and do not care what day they on. Here’s an straightforward way to make payments available every thirty days.

In your widgets passage, make new widget called rent_check

<<if Math.trunc($CurDate) gte Math.trunc($NextRentDate) or $NextRentDate eq undefined>>
<<link "Pay rent">>
<<set $Gold -= 100>>
<<set $NextRentDate to Math.trunc($CurDate) + 30*24*60*60*1000>>
<<goto `passage()`>>
Rent up to date, do not pay

Now you can type <<rent_check>> on any page and it will show the link that deducts the gold and refreshes the passage.

Handling what happens when the player does not pay rent is a different matter…

1 Like

Thank you, once again. I’ll try to work out something in game about rent not being paid.

No doubt that will result in another question or two for you.