PDA

View Full Version : Date/time extension



Ikael
March 20th, 2009, 17:34
This morning I had this strange idea of making FG campaign character's wound recovery automated. To make a first step to achieve this I made small extension that manages dates/times in campaign.

I attached this extension to this post. It adds /date slashcommand which opens small windowclass which contains fields for year, day, month, weekday, hour and minutes. When I change one field it updates other fields if needed.
It's based on gregorian calendar but it may be modified to any other calendarsystem by hacking the utility_date.xml

Even without the automated recovery feature I noticed that this is kinda useful tool...

PneumaPilot
March 20th, 2009, 18:33
This is an awesome idea. It would be perfect for World of Darkness games.

Leonal
March 20th, 2009, 18:39
I just tried it and I really like this one. Great work!

I little comment though. Being able to click the month/day of week for example for quick changing could be considered in a future update? I have no idea if that'd be hard to code or not...
I realize you can just enter a day number, but it seems abit bugged. Entering day 200 while in January will change to next year. (Scrolling works perfect though)

Oberoten
March 20th, 2009, 19:33
Most useful. :)

Can I post this one along with the calc one you did on the Wiki?

- Obe

Ikael
March 20th, 2009, 21:29
I'm glad that today's work turned out to be more useful than I expected.

Leonal > You may change month/weekday by pressing Alt and clicking the label.

I know that filling these fields by keyboard editing _cause_ problems. I have tried to fix this by making alternative ways to handle value changing, until I realized that scrolling and dragging numbers to them are the best way to update these fields. At least that's the way I did it often :P

Oberoten > Sure, these extensions are completely free for anyone

PneumaPilot
March 20th, 2009, 22:32
I think that I will try to make an old clock from the early 80s (the kind that has pieces of numbers on wheels or something and it rotates the pieces to the proper time like a rolodex or an airport terminal sign). It would be cool to have a graphical clock like that with buttons you could press to add time in 1 minute, 15 minute, 30 minute, 1 hour, 8 hour, 1 day, 1 week, 1 year, etc. intervals. Then you could put the clock as an icon on the right-hand side of the screen and allow players to access it, but not change it.

You could also make it look like a watch...

Lot's of good ideas in my mind from this Ikael, thanks a ton!

PneumaPilot
March 20th, 2009, 22:35
I'm thinking something like this:
https://www.unplggd.com/uimages/unplggd/twemco_flip_clock.jpg

Leonal
March 21st, 2009, 02:49
Leonal > You may change month/weekday by pressing Alt and clicking the label.

I know that filling these fields by keyboard editing _cause_ problems. I have tried to fix this by making alternative ways to handle value changing, until I realized that scrolling and dragging numbers to them are the best way to update these fields. At least that's the way I did it often :P

Ah, thank you! I thought I had tried that, but I guess I had ctrl clicked/scrolled.
Then I have nothing more to suggest =)

Ikael
November 6th, 2009, 06:33
I did update the Campaign Calendar extension. In new updated version the calendar system itself can be easily modified by editing a single file which contains only the calendar system information. The default calendar system used in the extension is gregorian calendar system. In addition new calendar system can be made as additional extensions and applied to campaigns later. I attached the updated Campaign Calendar extension and included a sample calendar system extension, to illustrate how calendar system extension can be made.

PS: This extension can be uploaded to FG Wiki

unerwünscht
November 6th, 2009, 07:53
This is an awesome idea, and tho I can't think of any use I would have for it with my games/rulesets, I would like to ask on behalf of all the coders, could we bundle this with any rulesets that we make?

Fenloh
November 6th, 2009, 09:21
Thanks a lot for the extension. I already used the previous version. This is great for a german Ruleset (Das schwarze Auge, the Dark Eye in USA) since it uses a differen Calender and it was realy easy to convert. Great work and works great do far.

Thanks,

Fenloh

Ikael
November 6th, 2009, 09:27
Actually this is rip-off feature from my custom ruleset that was made to an extension. I have found this very useful because you can keep track of the time and date and drag-and-drop the current time to chat that players can see what's the current game time. For example when playres are doing research that takes lots of time I can easily notify them how much time was spend on it.

If you happen to integrate this to your ruleset you can also add some nice features involving time, such as automated recovery or keeping track of conditions that takes lots of time (even outside combat). I must admit that the automated recovery is one of the most useful, especially if the game has recovery rates like once per turn or once per minute. For example in WitchCraft RPG many players tend to recover from their essence uses/losts at very rapid rate (something like 1-4 points per minute), and that's painful process for GM/player to keep track on how many essences they have at the time. Luckily the automated recovery handles this out.

tdewitt274
November 6th, 2009, 14:13
Does the calendar have an option to update when the "Next Round" button is clicked or if the end of the round is reached?

I haven't installed this yet, but it sounds great!

Ikael
November 6th, 2009, 14:40
Does the calendar have an option to update when the "Next Round" button is clicked or if the end of the round is reached?


The extension itself can only keep track of the time and doesn't provide any other features. If you want to make it more useful with additional features you will probably have to make it build-in feature in your ruleset

Sigurd
November 6th, 2009, 20:43
I'd love to see a slightly richer 'status' report.

ie....

Date
Entered string for place
Entered comment.

It wouldn't have to be more than a string typed in from the DM. Perhaps two entry fields under the date window.

but beginning a session with.

April 22nd,
Munich Opera House
The king is dead


Would be very cool - would help with the chatlog too especially if there was a unique-ish character at the beginning of the entry. I could do global searches for the character.


sigurd

grimm182
January 24th, 2010, 14:41
Ok, i was looking to do a Warhammer Calendar. I went in and did the find/replace for weekdays and month plus i changed the number of days in each month.
Anything else i am missing?

Ikael
January 24th, 2010, 18:13
are you using the campaigndate extension or the newer CampaignCalendar extension?

If you are using the newer one then there is calendar-system.lua file where you can simply write your calendarsystem data (how many months, weekdays, names of weekdays and months etc). Below is an example content of calendar-system.lua file representing Cyradon calendarsystem:


weekdays = { "Antias ", "Oclius", "Sartis", "Ancrus", "Hebe", "Avlia" }
months = {"Cilia", "Festival of Arene", "Seius", "Lunia", "Trinius", "Festival of Helis", "Verus", "Celva", "Minia", "Festival of Paleron", "Salius", "Vestoria", "Helvina", "Festival of Drucaran", "Sirnis", "Dionis"}
daysInMonth = { 29, 3, 29, 29, 29, 3, 29, 29, 29, 3, 29, 29, 29, 3, 29, 29 }
hoursInDay = 24
minutesInHour = 60
leapyear = nil
positiveyear = "IR"
negativeyear = "AE"

Sadly the newer extension can only be found from this thread and not from FGwiki. The newer extension is packed to a archive file which contains the extension itself and an addition calendarsystem-cyradon extension which is an example of how you can make different calendarsystem as extension and not need to change the calendarsystem code from the main extension. Ie. you could have several different calendarsystems that you can choose to use for each game.

Ikael
January 24th, 2010, 18:26
Just to note that I did upload the updated CampaignCalendar extension to FGwiki site (https://oberoten.dyndns.org/fgwiki/index.php/Campaigndate)

grimm182
January 24th, 2010, 21:12
Sweet, i did indeed mix up the versions, a simple edit and Done!!
This is a very cool extension, thanks.

Here is the one i made for Warhammer, i used "*" to designate the intercalendary days.

adminwheel3
August 3rd, 2010, 15:51
Just found this - thanks for the work - it will be handy in dealing with RP over serveral days.

It would be great if someone to modify it so that you could click something and have it at a timestamp to the chat log along with a descriptor field. Sadly beyond my skills.

Ikael
August 3rd, 2010, 16:16
Hi, you can drag the time from calendar's any field (each field displays time in different precision) and drop it to your chat. That will make nice timestamp to your chatlog. At least I use this feature very often (just to let my players know what time it's). Adding description field would not be difficult at all, but unfortunately I lack interest in doing it, because you could easily just type the description to the chat manually :P (at least I do that)

adminwheel3
August 3rd, 2010, 18:41
That will work just fine, thank you.

Trenloe
May 20th, 2011, 03:48
Thanks for this extension Ikael, it's very handy.

I've quickly put together the latest specification for the Pathfinder Golarian Absalom Reckonong (AR) calendar - as detailed in the Inner Sea World Guide (which includes changed month lengths).

Leonal
June 8th, 2011, 06:49
Anyone else tried the calendar extension with FG 2.8?

I get a
Script Error: [string "datewindow:day"]:1: attempt to compare nil with number when I run it with /date, but otherwise it works fine.

Ikael
June 8th, 2011, 20:33
I did approve this finding. Seems like month's value is not initialized at the first time when window is opened. It won't affect other functionality laterwards. However it raises the question has this issue existed before; if not then why stringcontrol's value is not initialized...

Moon Wizard
June 9th, 2011, 01:13
Answer regarding the extension issue with v2.8 here.

https://www.fantasygrounds.com/forums/showthread.php?p=109539#post109539

Cheers,
JPG

Moon Wizard
June 18th, 2011, 00:30
Here is an update to the extension to fix the script error in v2.8, and shouldn't impact use with v2.7 at all.

I simply moved the date initialization code up to the window level, so the order of initialization could be controlled better.

Ikael, could you double-check and please update on the wiki?

Thanks,
JPG

Ikael
June 21st, 2011, 18:50
Checked. This updated extension works and no initialization error occurs in FGII v2.8+. Thanks Moon_Wizard again for your effort! I will upload this updated extension to FGWiki someday soon.

Insanity
July 25th, 2011, 06:09
Thanks for the extension, tested in on a campaign, but there are two typos in the scripts.


calendar-system.lua has Tuesday spelled as Tusday.

campaigndate.lua had an error line 26, CalendarConfig.learyear rather then CalendarConfig.leapyear.

I corrected these myself, and Tuesday was spelled correctly, and it began adjust for Feb 29 correctly.

However, the method in determining a Leap Year is incorrect, as it is not simply any year divisible by 4. At least for the Gregorian calendar. If the century is evenly divisible by 100, there is no leap year, unless it is divisible by 400. So 1900 did not have a leap year, but 2000 did.

I am not skilled in the lua, but a simple code to do the calculations is on wikipedia.


https://en.wikipedia.org/wiki/Leap_year#Algorithm

Thanks again.

Trenloe
August 20th, 2011, 03:03
Here is an update to the extension to fix the script error in v2.8, and shouldn't impact use with v2.7 at all.

I simply moved the date initialization code up to the window level, so the order of initialization could be controlled better.

When I try this extension with FG 2.8 3.5E ruleset I get a "Script Error: [string "scripts/campaigndate.lua"]:3: attempt to call field 'registerSlashHandler' (a nil value)" error on startup and I can't access the extension. I've tested in a brand new 3.5E campaign with no other extensions loaded and still the same error.

This works fine for 4E.

Anyone have any ideas why this might not be working?

Ikael
August 20th, 2011, 10:53
Good finding! The problem was that slash command was registered using old methods that includes ruleset dependent code. Now the slash command registering is done by FGII built-in methods to support any ruleset. You can download the new version from FGWiki (https://oberoten.dyndns.org/fgwiki/index.php/File:CampaignCalendar.zip).

Trenloe
August 20th, 2011, 14:51
Good finding! The problem was that slash command was registered using old methods that includes ruleset dependent code. Now the slash command registering is done by FGII built-in methods to support any ruleset. You can download the new version from FGWiki (https://oberoten.dyndns.org/fgwiki/index.php/File:CampaignCalendar.zip).

Thanks very much Ikael - that works a treat. :)

demonsbane
August 20th, 2011, 21:21
(. . .) You can download the new version from FGWiki (https://oberoten.dyndns.org/fgwiki/index.php/File:CampaignCalendar.zip).

Thank you for the updated version!

dr_venture
August 21st, 2011, 02:28
Great utility - wish it could be integrated into a GM's calendar for both planning & documenting campaigns. For anyone who'd like it (feel free to repost to wherever you want) I've included here the Greyhawk calendar... very easy to adapt to the utility, as long as you treat the festival weeks like little 7 day months.

A coupla things:

1) If I set the hour to "23" and the minutes to "59" then roll the mousewheel to increment to a new day, I get a nasty endless loop that basically hangs FG... have to ctl-alt-delete to get out.

2) If you change your calendar type on a campaign that has already used a different calendar (say, I don't know, Gregorian to Greyhawkian just off the top of my head) the utility will burp up unhappy little script errors. The good news is that using the reset function cleans it right up.

Good work, my friend!

Ikael
August 21st, 2011, 07:07
However, the method in determining a Leap Year is incorrect, as it is not simply any year divisible by 4. At least for the Gregorian calendar. If the century is evenly divisible by 100, there is no leap year, unless it is divisible by 400. So 1900 did not have a leap year, but 2000 did.
Thanks again.

Thanks for pointing this out! I quess it has been too many years since my elementary school :o . I will make a fix for this and also fix other issues you mentioned.

dr_venture, I will also check issues you reported as I haven't faced them myself but certainly those are too nasty to let exist.

thrylax
August 21st, 2011, 17:35
I'm sure I'm missing something, but the normal .ext file seems to work fine. But after I edit the .ext file and make my own changes it does not show up in the extension list for some reason.
I'm not sure I'm even doing this right, but in order to edit it, I renamed it campaigncalendar.ext.zip then extracted the file and made the changes to "calendar-system.lua" using notepad. After making the changes for my campaign, I re-zipped the file at normal compression and placed it in the extensions folder. But my edited version does not up. What have I missed?
Thanks in advance.

Trenloe
August 21st, 2011, 17:41
I'm sure I'm missing something, but the normal .ext file seems to work fine. But after I edit the .ext file and make my own changes it does not show up in the extension list for some reason.
I'm not sure I'm even doing this right, but in order to edit it, I renamed it campaigncalendar.ext.zip then extracted the file and made the changes to "calendar-system.lua" using notepad. After making the changes for my campaign, I re-zipped the file at normal compression and placed it in the extensions folder. But my edited version does not up. What have I missed?
Thanks in advance.

A common cause of this is that when the files are zipped up again the base directory is included in the zip file. Make sure that you zipped up the files etc from within the campaigncalendar folder - not zipping up the campaigncalendar folder itself.

dr_venture
August 21st, 2011, 17:46
thrylax: Also be sure you update the appropriate data in "extension.xml" - I don't think it's quite the same for how your extension is set up, as I think you're replacing the main calendar extension, but for mine the first time I ran FG to check it out I couldn't see it. Turns out I had left all of the data in the "extension.xml" for the Gregorian example, and the duplicate data (I assume extension name specifically) made it essentially invisible in FG.

thrylax
August 22nd, 2011, 02:57
A common cause of this is that when the files are zipped up again the base directory is included in the zip file. Make sure that you zipped up the files etc from within the campaigncalendar folder - not zipping up the campaigncalendar folder itself.
Yup, that was the problem.....I knew it was something simple. Thanks

Ikael
August 22nd, 2011, 22:55
When checking out the issues people have reported here, I have found out that the current campaign calendat extension is very depricated as is and should be refactored almost completely. I have been doing this refactoring/revisioning in Unicore ruleset where the campaign calendar is integrated in and I must say I am very happy with the current state of development and new features that you people have suggested in.


What the new revised version of campaign calendar is going to be? Calendarsystem will be compatible with already created ones, but in addition leapyear has capability to support functions for calcuation leapyear in more precise way (like how gregorian calendar's leap year is calculated)
Interface/handling will be the very same, but many old usage bugs are removed.
New calendar event feature is implemented. This feature allows you to create list of events, give them names, add shortcut link (reference link of any story/note/npc/encounter etc) to them and set when the event is going to happen. After event is created the campaign calendar will point you in at the moment when the event should happen. See the attached image.
When you drag from calendar event's label the dragged text will include the event's time and label itself. For example

22.12.2011
Bomb expoles at mansion!
Extension also enables Rulesets registering time handlers which will be called by campaign calendar when time goes onwards and the handler function receives information about how much time has gone onwards. This feature could be used in rulesets to implement auto recovery features such in Unicore ruleset. Not sure if this is going to be used, but at least I am going to implement auto recovery to my Savage Worlds ruleset, especially to handle power point recovery.
Question: should I implement feature where GM could save and load date/times to slots? I have once a time travelling game where players had their base in modern time, but travelled to different times now and then. This feature would be useful in such scenarios.

demonsbane
August 22nd, 2011, 23:23
Sounds great. The screenshot with the events placed at the timeline is cool.

Regarding the implementation of the feature for saving and loading date/times to slots, personally I don't use any sort of time travel in my campaigns but other people likely find it useful.

Phystus
August 22nd, 2011, 23:46
Looks very nice. I wouldn't find the time-travel feature useful at present, but I suppose that could change.

One feature that would be useful would be phases of the moon(s). Calculating moonrise and moonset might be a bit much, since that would vary depending on location, but being able to say that tonight is the full moon could be very helpful.

~P

dr_venture
August 23rd, 2011, 00:19
Moon phases... or in the case of Greyhawk (and Tatooine): 2 moons!

No time travel here either, but I could see it being useful to be able to save & load times if you have multiple groups of adventurers in the same campaign, doing different things at different times. It'd be nice to be able to just save the time for each group someplace & load the appropriate datetime at the beginning of a session & save it at the end. Several campaigns I have been in or run have had multiple groups like this, as likely will my new one.

dr_venture
August 23rd, 2011, 00:20
No wait... Tatooine has two suns... rising and setting times & phases for multiple suns and moons! (kidding, of course)

Leonal
August 23rd, 2011, 00:31
Thanks for the update!

Not only for time travel, but a save/load feature could be handy for flashbacks too. (Not that my campaigns often have that, but it does happen....well it did once in a campaign I played...:))

Ikael
August 23rd, 2011, 23:47
Initial release of Campaign calendar v1.5 is here. You can download it from FGWiki (https://oberoten.dyndns.org/fgwiki/index.php/File:CampaignCalendar.zip). I haven't tested this extension release much, instead I have been testing it a lot when I developed it as integrated in Unicore ruleset. In a nutshell this version is almist identical to Unicore release so I can more easily release new versions when/if I develope it further in Unicore. I won't be having two separate project anymore to easy my task burden.

If you happen to encounter bugs or issues, please be free to report them here or directly to me as pm.

Features in this release are:


Compatible with any calendarsystem extension that are already created
To show usage help manual, use slashcommand:
/datehelp
To open campaign calendar, use slashcommand:
/date
To reset campaign calendar to default calendarsystem values, use slashcommand:
/datereset
Capability to set leapyear algorithm as lua script to make the calculation even more flexible. In addition gregorian calendarsystem's leapyear algorithm is fixed.
Capability to save/load/delete datetimes to memory, using slashcommands:

/datesave [description]
/dateload [slot]
/datedelete [slot]
When you save datetime you may enter any description about the saved datetime and extension will assign it to system selected slot. Thereafter you can load or delete it by providing the slot number in parameter
You can display all saved datetimes using slashcommand:

/datestore This will list all saved datetimes and their descriptions and slot numbers
Ability to create events, given them names, link any reference to them and set the time when it will happen. The timefield is normal stringfield with flexible way how to input the date/time. The basic formula on inputting time is
day.month.year anytextwithoutdigitshere hours:minutes


Examples of time inputs are:


13:29 (only clicktime presented)
clock 15:19 (before the clocktime you may have any non-digit description)
31.10 (day and month)
1.1.2011 (day, month and year)
4.5.2011 clock 12 (day, month, year and hour)
4.5.2011 clock 12:15 (day, month, year, hour and minutes)
12.12.2011 whatevertexthere 6:15

(note that you can replace dots (.) with - or , if you like, for example you can type time as 12-12-2011)


When you have set the eventtime, you can hold CTRL down and see how much time is remaining until the event occurs.
When you move time onwards the eventlist will note you when given event should occur.


Known issues:

When you have initialized campaign calendar to use one calendarsystem and you change the calendarsystem in next launch, there might be error messages. This is expected as if two calendarsystems are not compatible with each other. You may fix the issues by resetting campaign calendar, using:
/datereset


Hope you find this initial version useful!

Leonal
August 24th, 2011, 03:22
Sweet, thanks!

Insanity
August 24th, 2011, 18:33
I attempted to use the /datestore command and got this error.


Script Error: [string "scripts/properties_fixed.lua"]:177: attempt to index global 'String' (a nil value)

Though is did say in the chatwindow


Saves campaign calendar entries:

Might it be possible for this to show how many days has passed since an event?
Much like how a future event shows 184 days, and pass one may show -184 days?

Ikael
August 28th, 2011, 13:04
I attempted to use the /datestore command and got this error.


Script Error: [string "scripts/properties_fixed.lua"]:177: attempt to index global 'String' (a nil value)

Though is did say in the chatwindow


Saves campaign calendar entries:

Might it be possible for this to show how many days has passed since an event?
Much like how a future event shows 184 days, and pass one may show -184 days?

Ooh, some Unicore ruleset reference was still left to the extension. The String is Unicore's generic string manipulation script. I will fix this issue today. And I could add new feature where When you hold down SHIFT it could show many days has passed since (so it's reverse to pressing CTRL)

EDIT: the fixed version is now in FGWiki. But I didn't implement the "time since" feature, it will be in next bigger release.

CelineSSauve
August 19th, 2012, 04:00
When I update the names of the months in the yearly view, it seems to not actually do anything. When you double click on a date to add an entry, that entry still has the old month.

Is there a way to change that? Also, how can you add a holiday between months like some of the calendars include?

(Basically, I am trying to get First Month to Twelfth Month with a 7 or 14 day break between them called "Turnover" or something of that nature.)

Sorry to revive an old thread, but I'm not sure where else to put this.

Roncorps
August 19th, 2012, 07:49
Also, how can you add a holiday between months like some of the calendars include?

They are hard coded into the module, so you'll need to open it and modify it to add custom holidays. In fact, holidays between month are month, it's just that a "holiday string" is placed into the whole month.

So, you want a gregorian calendar with 7 or 14 days holiday call "Turnover" between each one ? At the end, you'll have like 23/24 "month" (12 of 30 days + 11/12 of 7/14 days) in the calendar module of FG ?

Ikael
August 19th, 2012, 13:22
They are hard coded into the module, so you'll need to open it and modify it to add custom holidays. In fact, holidays between month are month, it's just that a "holiday string" is placed into the whole month.

This extension is different from 4E calendar util. In 4E you define calendar setting in module, but in this you do it in extension.


When I update the names of the months in the yearly view, it seems to not actually do anything. When you double click on a date to add an entry, that entry still has the old month.

Is there a way to change that? Also, how can you add a holiday between months like some of the calendars include?

(Basically, I am trying to get First Month to Twelfth Month with a 7 or 14 day break between them called "Turnover" or something of that nature.)

Sorry to revive an old thread, but I'm not sure where else to put this.

try to reset your calendar by typing slashcommand /datereset into chat

CelineSSauve
August 19th, 2012, 16:06
try to reset your calendar by typing slashcommand /datereset into chat
When I try that, it just brings up the usual list of /commands for when you use one that's not there...

I am actually trying to get 28 days/month + the 14 days of Turnover. I just want 12 months, because the person who created it in this setting didn't like the number 13 :D