• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Mod Release Keep track of time without a clock

DeathDaisy

Freebooter
Storm Modder
In my latest game Ive for some reason been unable to find a clock for the longest time, and I thought it'd be nifty to still have some kind of idea what time of day it was, so I did this quick little thing!

Code:
if (sti(mchr.HasClock)) sDateTimeDisplay += " " + GetStringTime(stf(mchr.CurrentTime));
        // DeathDaisy: approximate time of day when not having a clock
        else{
            string TimeOfDay;
            if(GetTime() >= 23 || GetTime() < 1) TimeOfDay = XI_ConvertString("Midnight");
            if(GetTime() >= 1 && GetTime() < 3) TimeOfDay = XI_ConvertString("Night");
            if(GetTime() >= 3 && GetTime() < 6) TimeOfDay = XI_ConvertString("Late Night");
            if(GetTime() >= 6 && GetTime() < 7) TimeOfDay = XI_ConvertString("Early Morning");
            if(GetTime() >= 7 && GetTime() < 9) TimeOfDay = XI_ConvertString("Morning");
            if(GetTime() >= 9 && GetTime() < 11) TimeOfDay = XI_ConvertString("Forenoon");
            if(GetTime() >= 11 && GetTime() < 13) TimeOfDay = XI_ConvertString("Noon");
            if(GetTime() >= 13 && GetTime() < 15) TimeOfDay = XI_ConvertString("Early Afternoon");
            if(GetTime() >= 15 && GetTime() < 18) TimeOfDay = XI_ConvertString("Afternoon");
            if(GetTime() >= 18 && GetTime() < 20) TimeOfDay = XI_ConvertString("Evening");
            if(GetTime() >= 20 && GetTime() < 22) TimeOfDay = XI_ConvertString("Late Evening");
            if(GetTime() >= 22 && GetTime() < 23) TimeOfDay = XI_ConvertString("Early Night");
            sDateTimeDisplay += ", " + FirstLetterUp(TimeOfDay);
        }

the times are defined in LogInterface in PROGRAM\BATTLE_INTERFACE with a lot of ifs and I added the texts to common.ini too if there's interest xD
ENGINE 2017-11-03 03-33-56_1.jpg ENGINE 2017-11-03 03-30-34_1.jpg

EDIT: I had missed an hour between 7 and 8, which caused an infinite error and really choked the game. updated the loginterface.c!
 

Attachments

  • common.ini
    73 KB · Views: 172
  • LogInterface.c
    34.4 KB · Views: 172
Last edited:
Cool! I like it, @DeathDaisy. :onya

In my latest game Ive for some reason been unable to find a clock for the longest time
Is your character level by any chance already really high?
The "item code" isn't particularly great and, to avoid having too many low-level items, it starts dropping them in favour of high-level ones later on.
This means if you don't buy the low-level stuff you need when it is still around, it could be that you lose your chance.
Stupid, I know! :facepalm

We had this problem for the pickaxes and shovels needed in Treasure Quests.
I ended up writing some specific code to ensure that if you don't have one and do need one, it'll always be available for purchase.
But that's really a silly hack.
 
Possibly a little too precise? If you have no clock at all, maybe just give the same general time of day as is already produced by the function 'GetDayTime()':
Code:
string GetDayTime()
{
   if(GetTime()<6.0) return DAY_TIME_NIGHT;
   if(GetTime()<10.0) return DAY_TIME_MORNING;
   if(GetTime()<18.0) return DAY_TIME_DAY;
   if(GetTime()<22.0) return DAY_TIME_EVENING;
   return DAY_TIME_NIGHT;
}
Or, if you're really having trouble getting even a simple clock, perhaps provide time to that level of accuracy if you have an enhanced compass. Here's why:
The real Enhanced Compass
 
Is your character level by any chance already really high?
not crazy high, like 7 or something as I started as a smuggler. I think the problem has been that I've been stuck on Martinique for several days because of a storm, and the stores didn't stock a clock when I started and hasnt refreshed yet

Possibly a little too precise? If you have no clock at all, maybe just give the same general time of day as is already produced by the function 'GetDayTime()':
Code:
string GetDayTime()
{
   if(GetTime()<6.0) return DAY_TIME_NIGHT;
   if(GetTime()<10.0) return DAY_TIME_MORNING;
   if(GetTime()<18.0) return DAY_TIME_DAY;
   if(GetTime()<22.0) return DAY_TIME_EVENING;
   return DAY_TIME_NIGHT;
}
Or, if you're really having trouble getting even a simple clock, perhaps provide time to that level of accuracy if you have an enhanced compass. Here's why:
The real Enhanced Compass
I did that first, but I felt it wasnt as useful as Id like it to be. I figured that I can tell in real life approximately what time it is within a few hours, so it wouldnt be crazy if your character knew too. I dont think it unbalances the game as you'll most often get a clock as soon as you can anyway, but idk. Im not opposed to removing a few of them if you feel its too much
 
not crazy high, like 7 or something as I started as a smuggler. I think the problem has been that I've been stuck on Martinique for several days because of a storm, and the stores didn't stock a clock when I started and hasnt refreshed yet
Ah, maybe another day or another island will help then. :onya
 
I wonder if there's another solution? Female NPC's usually carry jewellery. Not that I routinely rob them, but if one of them puts her hand in my pocket, I return the compliment. :D Male NPC's don't tend to carry anything much of interest. Perhaps arrange for them to be able to carry clocks? So, if you can't get one from the shop, perhaps you can get one from someone's pocket. :wp
 
Another thought. Some starting character types get a clock by default - one reason why, when I'm starting a FreePlay game to test out a ship, I almost always take a corsair, is because corsairs get a compass and clock right away. If there's one character type who really needs a clock, it's the smuggler. So if he doesn't get a clock as starting equipment, perhaps he should. :sparrow
 
I had missed to include an hour between 7 and 8, which caused an infinite error and really choked the game :eek: I've uploaded a new LogInterface.c to the main post!
 
It still has twelve intervals, and some of them are only 1 hour long. In reality, if you didn't have any sort of clock at all, I doubt you'd be able to guess the time that accurately. Any chance of reducing it to, say, six intervals?
 
It still has twelve intervals, and some of them are only 1 hour long. In reality, if you didn't have any sort of clock at all, I doubt you'd be able to guess the time that accurately. Any chance of reducing it to, say, six intervals?
Sure, how about these? :) I realise there are 8, 2 of which are still just 1 hour! but I think dawn and dusk aren't unreasonable, sunset and sunrise are obvious enough after all, and give a lot of mood xD and I feel the rest are general enough that most people would be able to tell. but I'm not impossible, I'll concede to removing dusk and dawn if its still too much :type1
Code:
else{
            string TimeOfDay;
            if(GetTime() >= 22 || GetTime() < 3) TimeOfDay = XI_ConvertString("Night");
            if(GetTime() >= 3 && GetTime() < 6) TimeOfDay = XI_ConvertString("Small Hours");
            if(GetTime() >= 6 && GetTime() < 7) TimeOfDay = XI_ConvertString("Dawn");
            if(GetTime() >= 7 && GetTime() < 10) TimeOfDay = XI_ConvertString("Morning");
            if(GetTime() >= 10 && GetTime() < 14) TimeOfDay = XI_ConvertString("Midday");
            if(GetTime() >= 14 && GetTime() < 18) TimeOfDay = XI_ConvertString("Afternoon");
            if(GetTime() >= 18 && GetTime() < 21) TimeOfDay = XI_ConvertString("Evening");
            if(GetTime() >= 21 && GetTime() < 22) TimeOfDay = XI_ConvertString("Dusk");
            sDateTimeDisplay += ", " + FirstLetterUp(TimeOfDay);
        }

I hope dusk actually is between 21 and 22 tho, forgot to check! :eek:
 

Attachments

  • LogInterface.c
    34.3 KB · Views: 284
  • common.ini
    72.8 KB · Views: 177
Night starts at 22:00, so yes, dusk would be 21:00 to 21:59. That does look a lot better. :onya
 
another hiccup! :facepalm I was apparently using an older common.ini, so it missed some new additions like "boy"/"girl" etc. fixed now!
 

Attachments

  • common.ini
    72.9 KB · Views: 169
Not to worry. I WinMerged it with my own version anyway. That has a couple of other new entries which I needed for my update of "Tales of a Sea Hawk".
 
dusk failed to show up, turns out I accidentally wrote Evening two times instead of Dusk in the ini :facepalm
 

Attachments

  • common.ini
    73 KB · Views: 163
Back
Top