Re: pushing text down the screen, you will have to use nobr (short for no line break) to prevent this from happening and to collapse the relevant lines. There are three options
Tag the relevant passage with nobr
Wrap the relevant text in <<nobr>>...</nobr>>
Add Config.passages.nobr to a passage tagged script
I prefer the third option, as it removes line breaks from the entire story. Then you can add line breaks into your story manually just by typing <br> at the end of a line
Add Config.passages.nobr to a passage tagged script
I prefer the third option, as it removes line breaks from the entire story. Then you can add line breaks into your story manually just by typing <br> at the end of a line
Adding a tag script to a passage. Does that require me to add the Config.passages.nobr to a widget or some other passage, like making a passage named script and add it there first?
Sorry for being thick, but that is my default setting.
<<button "  Go home  ">><<minutes_incr 0>><<goto "Room 23">><</button>>
<<check_date '0' '23' 'The shop is open, [[click here to enter]]' 'The shop is closed'>>
and in widgets, I have this:
<<widget "minutes_incr">>
<<set $CurDate_inc to new Date(Math.trunc($CurDate) + $args[0] * 60 * 1000)>> <<set $CurDate to $CurDate_inc>>
<</widget>>
/*<<widget "check_date">>
<<set $CheckDateA to new Date($args[0])>>
<<set $CheckDateB to new Date($args[1])>>
<<if Math.trunc($CurDate) gte Math.trunc($CheckDateA) and Math.trunc($CurDate) lt Math.trunc($CheckDateB)>>
<<print $args[2]>>
<<endif>>
<</widget>>*/
<<widget "check_hour">>
<<set $CheckHourA to $args[0]>>
<<set $CheckHourB to $args[1]>>
<<if $CurDate.getHours() gte Math.trunc($CheckHourA) and $CurDate.getHours() lt Math.trunc($CheckHourB)>>
<<print $args[2]>>
<<else>>
<<if $args[3] neq undefined>><<print $args[3]>><<endif>>
<<endif>>
<</widget>>
But all I see is: Error: macro << check_date>> does not exist.
On the Room 23 passage, which is the home passage, I had your track birthday code:
Which also displays the: Error: macro << check_date>> does not exist.
If I remove the /* */ from your previous code widget “check_date” there is no error message, but the button to Go Home no longer functions. It throws up an error message: Error: Invalid time value with a long stack trace.
If I move the /* */ from your previous code widget “check_date” to the current “check_hour” it throws up the error message: Error: Invalid time value with a long stack trace.
I’m guessing that the check_date and check_hour codes that I have in widgets, clash with each other, but again I don’t know enough about coding to clean it up myself.
I take it you are trying to comment out each widget to see which one is causing the error in isolation? That would explain the I am not sure why you commented out the check date widget with /* */ but that is probably why you are getting the macro does not exist error.
It does not look like you have updated or editing the first widget so it should still work.
However, I think that you can’t use the widget twice in the same passage due to the way I used $CheckHourA and $CheckHourB. Are you checking twice in the same passage?
Yes, sorry if I wasn’t clear before. I am trying to be scientific in figuring out my problem. When using the:
<<widget "check_date">>
<<set $CheckDateA to new Date($args[0])>>
<<set $CheckDateB to new Date($args[1])>>
<<if Math.trunc($CurDate) gte Math.trunc($CheckDateA) and Math.trunc($CurDate) lt Math.trunc($CheckDateB)>>
<<print $args[2]>>
<<endif>>
<</widget>>
I don’t see an immediate error, but nothing else relating to time or date appears on the page, and when I click on the button to return, I get Error: Invalid time value with a long stack trace. Plus the button doesn’t take me anywhere, I am stuck on that page.
When I use the:
<<widget "check_hour">>
<<set $CheckHourA to $args[0]>>
<<set $CheckHourB to $args[1]>>
<<if $CurDate.getHours() gte Math.trunc($CheckHourA) and $CurDate.getHours() lt Math.trunc($CheckHourB)>>
<<print $args[2]>>
<<else>>
<<if $args[3] neq undefined>><<print $args[3]>><<endif>>
<<endif>>
<</widget>>
I get the Error: macro << check_date>> does not exist message…
I am using this:
<<check_date '0' '23' 'The shop is open, [[click here to enter]]' 'The shop is closed'>>
and I have this in the StoryInit:
<<set $CurDate to new Date('August 19, 1575 23:15:30')>>
The widgets passage has a widget tag.
I also have an extra code passage with
Config.passages.nobr = true
StoryCaption has:
Date: <<print $CurDate>>
I don’t know if any of that is relevant, but that’s all I can find that might be in conflict.
but nothing shows up. The time/date works in all other regards, but not this one yet. Is it the difference in using the ‘0’ ‘23’ as opposed to the full ‘August 21, 1575 00:00:00’ ‘August 21, 1575 23:00:00’?
Not trying to second guess you, but hoping to get a better understanding of this so I don’t have to bombard you with questions.
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()`>>
<</link>>
<<else>>
Rent up to date, do not pay
<<endif>>
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…