Using Turn Script to output time???

DillonJHonore
12 Oct 2016, 03:48Would it be possible to configure a turn script that would display a changing time instead of a turn counter?

onimike
12 Oct 2016, 05:11Here is a clock library http://docs.textadventures.co.uk/quest/libraries/clock_library.html
Not sure if thats what your looking for
But here is a tutorial I made with a simple army time clock with day count here https://www.youtube.com/watch?v=vdk0KuLjnqM
Hope it helps.
Mike
The Pixie
12 Oct 2016, 08:03Here is an updated version of ClockLibrary, with explanation on how to use it. This would also be a good way to set up the phone you mentioned in another thread; you could do that as an event to go off at a certain time (timers can be unreliable for people playing on-line).
You need to be using the off-line editor to use libraries by the way.
https://github.com/ThePix/quest/wiki/Clock-Library
XanMag
14 Oct 2016, 05:10Not sure if this would be helpful or not, but in a game I am working on, I have a pretty neat day loop. Below is the explanation from my tutorial on how to loop a day. If you need help with it or clarification, please ask.
1. I placed a script on 'after entering room'. This is on 'scripts' tab of the room. By placing it here, this script only runs in this room. Usually you would want this kind of script on your entire game, but that doesn't make sense for this tutorial. The option #1 below only works IF you want to loop some events particular to that room. You can use this to loop a cycle, like a patrolling guard within a room, or as a puzzle that presents a solution only every 'increment of time', or if you want a phone to ring repeated in that room for a set number of turns within a larger cycle of turns. Option #2 can be used to loop an entire day throughout your entire game.
Option #1 (TS with Run script after set number of tunrs):
1. I created an object and called it 'day'. I made this object invisible by unticking the box in 'Setup' of the object 'day'. This object is just here so I could place flags on it. Remember, if it is not a 'day' you are looping but a puzzle or a guard, you would want to change this invisible objects name to something more suitable.
2. I added a ''First Time' script in the section called "After entering room". Here, I added a flag on object 'day' called 'morning' as well as a print message script that said "It is now morning."
3. Also in the 'after entering room' section, I choose to a 'Run script after set number of turns'. For the example, I simply chose two turns to speed things up, but chose a number that is more realistic to the length of your game. After two turns, I unset the morning flag and chose a 'set object flag' from the pop-up menu. It's under 'variables'. I set the next object flag as 'noon'. After two turns, I dropped the noon flag and added the evening flag, etc, etc.
4. At the end of this script, I set the object flag to morning and unset the flag midnight. This will cause the event to loop.
AGAIN: This is more applicable to looping other cycles other than a day. To loop a day, follow the slightly more complex steps below.
1. You will add an object 'day' to the game.
2. On the object 'day' click on the attributes tab.
3. In the bottom box, click 'add'. Name the attribute 'DayCount'. Set it as an integer equal to zero.
4. Click on the 'DayCount' attribute and find 'Add change script'. This will open another attribute. In the drop down box at the bottom, select 'Script'.
5. Add an 'IF' script and select 'If object attribute equals' at the first drop down.
6. It should look like this: If object attribute equals object object Day attribute DayCount equals 1
7. To the 'THEN' part of this script, add a flag and call it morning' and 'unset flag name dawn'.
8. Add a bunch of 'ELSE IF's scripts to this. Change the attribute 'DayCount' to however many turns above the previously set number. Add a flag that sets the new time of day and unset the previous set flag. For example, in my most recent game, I have the intervals set at 1, 15, 30, 45, 60, 75, 90, and 105. In order, my time of days are set as morning, noon, afternoon, dusk, evening, midnight, dawn. There are 8 intervals and only 7 times of day. This is because we want midnight, which begins at 90 and ends at turn 105 to happen. At 105, I added a 'Set attribute or variable' script. In the box you need to type in Day.DayCount and set it equal to 1. This will loop the day repeatedly throughout your game.
9. For each new turn that triggers a new time of day, you can add a print message script to let the player know that the time of day has changed. You can also use a 'move object' script to move certain NPCs from the room (or a 'make object invisible' script to make them invisible) to move them when it gets to a certain time of day. For example, in the game I am working on... when evening is triggered at 75 turns, I have moved all of my merchant NPCs to my 'Items Room'. I also made the 'Juju man' disappear. At midnight (105), I moved the Juju man to the cemetery and at dawn I moved him back to his home AND made all the NPCs return to the market room.
10. There are lots of things you can do with this. I love this loop a day thing because it gives the game a LOT of variety and, once learned, it really isn't that hard to incorporate!
Good luck.