1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Mod Release Keep track of time without a clock

Discussion in 'Build Beta and Brainstorming' started by DeathDaisy, Nov 3, 2017.

  1. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    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!
     

    Attached Files:

    Last edited: Nov 5, 2017
  2. Mad Jack Wolfe

    Mad Jack Wolfe Deck Scrubber, 2nd Class Staff Member Storm Modder

    Joined:
    Apr 8, 2017
    Messages:
    71
    Gender:
    Male
    Occupation:
    Writer and historian
    Location:
    Treasure Coast bound
    I love this! You've fixed one of my biggest frustrations with the early phases of a new game. Thank you! :doff
     
    DeathDaisy likes this.
  3. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Cool! I like it, @DeathDaisy. :onya

    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.
     
    DeathDaisy likes this.
  4. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    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
     
    Pieter Boelen likes this.
  5. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    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

    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
     
    Mad Jack Wolfe likes this.
  6. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Ah, maybe another day or another island will help then. :onya
     
  7. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    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
     
    Mad Jack Wolfe likes this.
  8. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,762
    Gender:
    Male
    Clocks? Meh. There is a corpse in Tortuga that has a clock. :nerbz
     
  9. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Ah, the one @Jack Rackham added? Completely forgot about that! :shock
     
  10. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    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
     
    DeathDaisy and Pieter Boelen like this.
  11. Mad Jack Wolfe

    Mad Jack Wolfe Deck Scrubber, 2nd Class Staff Member Storm Modder

    Joined:
    Apr 8, 2017
    Messages:
    71
    Gender:
    Male
    Occupation:
    Writer and historian
    Location:
    Treasure Coast bound
    Out of curiosity, I went looking for him since I'm at Tortuga anyway. No chronometer to be found. Looks like he forgot his donkey, too.
     
  12. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,762
    Gender:
    Male
    IIRC he was a well dressed corpse not far from the tavern.
     
  13. Mad Jack Wolfe

    Mad Jack Wolfe Deck Scrubber, 2nd Class Staff Member Storm Modder

    Joined:
    Apr 8, 2017
    Messages:
    71
    Gender:
    Male
    Occupation:
    Writer and historian
    Location:
    Treasure Coast bound
    That's the one. What a terrible horologist. No chronometer, and no donkey. I think he was a fraud.
     
    DeathDaisy likes this.
  14. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    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!
     
    Mad Jack Wolfe likes this.
  15. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    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?
     
  16. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    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:
     

    Attached Files:

  17. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    Night starts at 22:00, so yes, dusk would be 21:00 to 21:59. That does look a lot better. :onya
     
  18. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    another hiccup! :facepalm I was apparently using an older common.ini, so it missed some new additions like "boy"/"girl" etc. fixed now!
     

    Attached Files:

  19. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,393
    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".
     
    DeathDaisy likes this.
  20. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    270
    Gender:
    Female
    dusk failed to show up, turns out I accidentally wrote Evening two times instead of Dusk in the ini :facepalm
     

    Attached Files:

Share This Page