Yeah, very strange.
Edit: Also, working as expected. Very cool!
Printable View
I've come back to help figure things out and wanted to share here and let you all know before submitting to the forge (will stay free). Let me know if you run into any issues. Hopefully I was able to get this in before too many changes by others were made. It might still be a bit messy in the TimeManager script right now, but its late and last time I tried cleaning it out I somehow deleted something I needed so I will wait, but here are the functions I've made that are key to utilizing features like reminders and events.
I've added script to allow other extensions to make use of the time as I have with reminders and events:
local aCurrentDate = TimeManager.getCurrentRawDate() -- gets a table of the current time
local aBuildDate = TimeManager.buildRawDate(nMinute, nHour, nDay, nMonth, nYear) -- gets a table of the time given
local nMinutes = TimeManager.getRawDateDifferences(aCurrentDate, aLastDate) -- gets the difference in minutes
TimeManager.setLastDate(Node, aCurrentDate) -- for repeating events like reminders
local aLastDate = TimeManager.getLastDate(Node, aCurrentDate) -- for repeating events like reminders
TimeManager.addTimeChangeFunction(f) -- add a function to be triggered on TimeChange events
and if you have an extension that could benefit from these functions, you can add
if TimeManager then
TimeManager.addTimeChangeFunction(MyNewFunction);
end
then if you change time with your extension, you just call TimeManager.TimeChanged() right AFTER, never before the adjust function.
hopefully you all find this works out.
oh, and I capped the table rolls by reminders to 60, so you don't kill your computer when you jump a year.
if you were unfortunate enough to get it a moment ago, redownload. sorry, left a mistake in the rounds advancement code
Updated and is live on the forge!
Thanks looking good.
So, with the mod now being on Forge under it's OP, does it currently include all the updates bmos has done over the past while? I just want to make sure I won't be accidentally sliding backward in terms of bug fixes and the like before switching over to the forge extension.
Amazing, thank you!
Well, you beat me to this... I was going to use this idea to learn the LUA stuff... dang it!
Thanks though... I will definitely use this a LOT!
The only things I was going to include that don't appear to be here are...
1. A more abstract output of time for the players based on a range of hours... like "Just after high sun", "Mid-morn"... etc.
2. The color of the theme changing to reflect the time for more immersion.
Obviously, both would/should have options in the settings to turn them on and off.
You could do this as another extension by overriding the CalendarManager.outputTime() function, as that is what is called to display the time in most instances (except reminders and events)
This too can still be done as another extension. Many ways it could be done and will not effect the clock adjuster.
The CalendarManager in Core RPG should have much of what you need. The TimeManager.TimeChange() function of mine would be all you need to have it operate when time changed.
I left the code open in the forge too, so you can still go through and see what I have that you could utilize.
The color of the theme changing based on time used to be very easy.
https://www.fantasygrounds.com/forum...-Mood-Lighting
But then SmiteWorks didn't add that overall color change feature to Unity so now it's a huge undertaking.
Hey there. I no longer can change the current time using control + mousewheel. Did you change how this works, is it a bug or is something wrong on my end?
https://www.screencast.com/t/WmnEcj4GeY
I can't see the addition numbers. How do I get the numbers to show?
Maybe. I did move it around on the screen, the numbers still didn't show up. I'll see if a different theme will let them show.
Awesome and that is OK. I'm quite happy with people doing whatever they can and accept whatever is the outcome. I have done free sh!t before and hated it when people were a pita. So, I adjusted by theme for now and if at some point it does work, I'll switch back. If I knew how LUA worked, I would probably dig into the code, but I don't. Thanks for the time you put into this thing!
https://www.fantasygrounds.com/forum...icent-Darkness
worked last time i checked
Busy state added for players! players can now add a busy action, name it to whatever action it is, set a duration, and get a notification of completion in the chat! This can be minimized by unlocking the window. One entry per active character.
Summary
When attempting to change the hours by either double-clicking the hours field or by clicking one of the 6am/12pm/6pm/12am buttons, an error is generated until the minutes value has been changed at least once.
Steps to Reproduce
- Create a new 5E or PF1 campaign and activate the Clock Adjuster extension only.
- Optional: Open a calendar module and select a calendar (tested with no calendar, the Gregorian calendar that ships with FG and with a custom calendar).
- Change the time by either:
- Setting hours adjustment field to a non-zero value and then double-clicking the field.
- Clicking one of the Dawn / Midday / Dusk / Midnight buttons.
Result
The hour is changed as expected, but the following error is also posted to the console:
This error will continue to occur every time the hour value is amended like this.Quote:
[ERROR] Script execution error: [string "scripts/manager_time.lua"]:110: attempt to perform arithmetic on field 'nMinute' (a string value)
Workaround
Changing the minutes value - either on the FG Calendar screen or by setting the Minutes Adjustment field to a non-zero value and then double-clicking on it - prevents the error from occuring again.
Notes
Confirmed that it happens in both 5E and Pathfinder (1E) campaigns, haven't tested any of the other rulesets.
It does look like humby did that.
Unfortunately, setting a calendar doesn't set minutes and hours. At least not if I remember correctly. This is why at one point I had "or 0" listed for all fields like nMinutes that might be missing values.
This is a result of getValue() not having a default value when fields have not been used yet (unlike DB.getValue()) which has the optional 3rd arg which is used as a fallback when it would usually return nil.
EDIT: didn't read error fully. value is string but should be number. i assumed it was nil.
Yes, first picked it up during the session I was running last night, which uses a custom calendar. Re-tested it this morning on a fresh campaign and forgot to set the calendar first, so had to create another fresh campaign where I did it properly. And then did it a few more times to test the other permutations.
When you set your calendar up, FG automatically populates the hours and minutes fields in the front end with 12:00AM so to an end user it does appear to have been done completely and correctly...
After looking at code and re-reading the error, it's not a nil error just something being handled as a string when it should be a number.
The issue is either in getCurrentRawDate, getLastDate, or buildRawDate.
Unfortunately since CurrentDate.nMinute and LastDate.nMinute both use nMinute in their names, you can't tell which is exhibiting the issue.
I'd start by just doing this to getCurrentRawDate:
although there could be a deeper issue here.Code:function getCurrentRawDate(sFactor)
local Date = {};
Date.nMinute = tonumber(DB.getValue("calendar.current.minute", "", 0));
Date.nHour = tonumber(DB.getValue("calendar.current.hour", "", 0));
Date.nDay = tonumber(DB.getValue("calendar.current.day", "", 0));
Date.nMonth = tonumber(DB.getValue("calendar.current.month", "", 0));
Date.nYear = tonumber(DB.getValue("calendar.current.year", "", 0));
return Date;
end
It does, and it’s unfortunate the node is not set as well. I’ll be looking into what happened to BMOS’s fix, why it’s not taking anymore.
A lot of people seem to like to start their campaign at midnight so guess I better hop on it as soon as I get done work :p
As a tangent, I’m currently working on adding automation for the AlienRPG within the clock adjuster, as the ruleset was what inspired me to create the extension in the first place. Lots of cool effects to be added, just got to iron out the details a bit more. So the fix will come when that feature is complete.
Ok I’ll check that out. Although something I noticed before was in the desktop widget, the various values were being called incorrectly, and I can’t remember if I fixed that for all of them or not. They were doing something like DB.getValue(“calendar.current.minute”, 0); which I don’t think returns what we expect. It should be DB.getValue(“calendar.current.minute”, “”, 0); or DB.getValue(“calendar.current”, “minute”, 0);
So if that wasn’t fixed everywhere, that may be part of the problem too. I’ll take a look after work here. Thanks for the tip.
alright so ran some tests after changing some things, and got that issue out of the way. First, i changed a lot of the DB.setValue() and DB.getValue() functions in the desktop_pannels.xml, because a lot were not set properly from my understanding of how those functions work. calling DB.setValue("calendar.current.*", "number", getValue()) had the value in the place of the node type, and the node type in place of the node name, and is thus replaced with "DB.setValue("calendar.current.*", "", "number", getValue()) for instance. likewise, the DB.getValue("calendar.current.*", getValue()) gets a default value of nil, and is looking for a child node of the value of the control, so i've replaced that with DB.getValue("calendar.current.*", "", getValue()).
also, the kicker of the fix really was more along the lines of what BMOS had said. so i replaced the function to add a DB.createNode() function to create it if it doesn't exist and set a default number, or get the value if it already exists.
function getCurrentRawDate(sFactor)
local Date = {};
Date.nMinute = DB.getValue(DB.createNode("calendar.current.minute ", "number"), "", 0);
Date.nHour = DB.getValue(DB.createNode("calendar.current.hour", "number"), "", 0);
Date.nDay = DB.getValue(DB.createNode("calendar.current.day", "number"), "", 0);
Date.nMonth = DB.getValue(DB.createNode("calendar.current.month" , "number"), "", 0);
Date.nYear = DB.getValue(DB.createNode("calendar.current.year", "number"), "", 0);
return Date;
end
so these fixes should be brought out after i get the ARPG functionality ironed out here. Hopefully soon this week.
updated to fix the previously noted errors with new campaigns. AND
New! Automation added for the Alien RPG ruleset below:
effects can be added to a PC on the combat tracker to use time based automation:
HUMAN -- allows for scripts to identify this entity as a human, so they can roll the critical injuries table, add them to their character sheet and effects, roll stamina at Time Limit durations for critical injuries, heal critical injuries, gain stress on damage taken. some critical injuries results will add the point of stress automatically to the inflicted character.
SYNTH -- allows for scripts to identify this entity as a synthetic, so they can roll the critical injuries on synthetics table and add the injuries to their character sheet.
NEEDSFOOD -- will automatically roll consumable or stamina rolls when time advances, changes conditions, notifies of when to lose health.
NEEDSWATER -- will automatically roll consumable or deplete health when stamina rolls when time advances. changes conditions
NEEDSAIR -- will automatically roll consumable or stamina rolls when time advances. notifies when to lose health. changes conditions
FREEZING: TURN/FREEZING: SHIFT/FREEZING: DAY-- will automatically roll stamina rolls when time advances.
GETSTIRED -- will automatically roll stamina rolls for when time advances, will add SLEEPING effect when character cannot possibly stay awake. SLEEPING -- will ignore the
GETSTIRED function and reset its timer
CANHEAL -- allows healing over time
FEELSSAFE -- allows stress reduction over time
Clicking the freezing condition will automatically apply the FREEZING: DAY effect to the character.
an Option in the Options menu will allow you to determine if a turn is 5 or 10 minutes. Shifts are default 6 hours. hopefully with a little more work, i can get more of that automated in the future. for now, with need of the #1 fix, this should be sufficient. please come to me if you have any issues.
Looks to be working again. Thanks!
Any chance this cool utility to could have an option to use a 24 hour clock instead of 12 hour one?
There is another extension that you can use in combination to do that.
https://www.fantasygrounds.com/forum...r-Clock-Format
Just downloaded it from Forge. Looks like there is an issue with minutes vs turns.
Every time I index the clock 10mins, it subtracts 100 rounds from any token duration, not 10 rounds.
yeah but i think they're using the Alien RPG, which is either 10 seconds a round or 5 seconds a round. They're still a bit off, but they're right that it's not correct. I've made a change, and this should fix the advancement for months too, since there was a static number for rounds per month, rather than something more dynamic. I'll upload shortly, just making sure i get it right.
I had an option in the Alien RPG ruleset to switch turn length and that wasn't done correctly, which kept it at a 10 second per round thing.
Alien RPG times
Round = 5 - 10 seconds
Turn = 5 - 10 minutes
Shift = 6 hours
This should be reflected properly in the next update
so yeah, I'm assuming you guys are using the Alien RPG ruleset. Rounds in the combat tracker reflect the "Rounds" of the Alien RPG, which are typically used in combat or time-sensitive situations. Rounds are 10 or 5 seconds. When you're using the combat tracker, it will refer to "Rounds" rather than "Turns", which are 5 or 10 minutes. (Shifts are 6 hours, while we're mentioning).
Either way, I've fixed that option for the Alien RPG to allow the variation to apply and fixed the month adjustment. Update should be live if you update from the launcher. :)