Hi,
Here is the calendar I use :
Here
My Question is :
Is it possible with the widget above, that at the end of a day a calcul is done? something like :
set $GMoney+=((random(1, 3)*$Population)/2)
And don't do that on Sunday. (I'm sure it will be to simple if I don't put a condition

)
Thanks.
Comments
There are many ways to do that sort of thing, with the simplest (and perhaps least reliable) method being something like this:
This approach is problematic though, because if you put <<addhours 72>> somewhere in your story to pass 3 days, the end of day code will only run once, even though you would want it to run 3 times in a row. You would also need to come up separate solutions for <<addmins>> and <<adddays>>.
A more robust approach might be something like:
It takes a bit more work to do it this way, but it's much harder to accidentally break it once it is up and running.
Thanks for the answer, I'll check that when I'll be back from work.
Have a good day.
That's working.
I extend it to month if some people is interrested in :
Thanks a lot.
eg. Somthing like the following: warning: The above was written without any testing, you may need wrap the <<display>> macro calls within <<silently>> macros.
@greyelf, do you know if this is valid usage? Can temporary variables persist across widgets like this? I'm not exactly sure which scope they reside in.
We should also page @TheMadExile to this question as well.
I also would like to know the answer to this question.
SEE: TwineScript > Variables.
Hi,
So if I understand, I create two passages named "earn" and "pay".
I write the the "Any code in here will run once per X" code in them.
I call them in the widget.
And in the passage I want it to run, I put the code you write (or something like that and maybe in a <<silently>> macro).
Sorry, my english and twine experience are not so advanced ^^.
Thx.
Basically yes, although I personally would not name the special passages earn and pay because that would make their names too similar to the widget names and could cause same confusion.
note:
I (automatically and maybe wrongly) used the passage names EOD and EOD, which stand for End-of-Day and End-of-Month respectively, because in the past I have worked on accounting/financial systems and those three letter acronyms describe the (well known in those sectors) events that are occurring.
One more thing, TME, a moment/turn changes with Passage traversal, right? Or in fact anything that changes the history? So, merely displaying passages doesn't change a turn?
Are you referring to the full batch of tasks that occurs during passage rendering? I.e. A temporary variable created in PassageHeader will still exist while PassageFooter is rendering, but won't exist when the user clicks on a setter link within the rendered passage?
A temporary variable set within any of the on navigation recurring special passages will exist until the start of a new navigation—e.g. a temporary variable created in PassageHeader will be available within PassageFooter.