Snippet Gametime

Nestharus

o-o
Reaction score
84
I really don't see a need nor a use for such methods. And I don't see any accuracy loss either.

There is accuracy loss, believe me... the instant you merge it, accuracy in decimals goes down the drain.

Don't you know the IEEE floating point thingie? >.>
 

Solmyr

Ultra Cool Member
Reaction score
30
There is accuracy loss, believe me... the instant you merge it, accuracy in decimals goes down the drain.

Don't you know the IEEE floating point thingie? >.>

I am perfectly aware of IEEE 754 and know exactly how floats are stored, represented and everything.

The aim here is to eliminate the inaccuracy caused by the timers, as shown by Vexorian.

Giving the user access to the "seconds" and the "decimals" separately makes no sense to me whatsoever.

But if you give me a reason to do it, then I am more than willing to cooperate.
 

Nestharus

o-o
Reaction score
84
So that you don't lose accuracy to the floats...

if you're trying to avoid inaccuracy from timers, then avoid from floats as well please >.>. There is 1 case I can think of where highly accurate timestamps are needed. Determining whether a unit decayed or was removed =P.
 

Solmyr

Ultra Cool Member
Reaction score
30
So that you don't lose accuracy to the floats...

if you're trying to avoid inaccuracy from timers, then avoid from floats as well please >.>. There is 1 case I can think of where highly accurate timestamps are needed. Determining whether a unit decayed or was removed =P.

And how exactly are you doing to use separate "seconds" and the "decimals" ?

To get the gametime, you would have to do [ljass]real gametime = seconds + decimals[/ljass] anyway, which is absolutely the same as [ljass]real gametime = Time.getExact()[/ljass]. And guess what, both ways are equally (in)accurate.

I mean, adding those methods is the easiest thing, but I'm interested in the usage of them, because I can't think of anything.

Nevertheless, thank you for your feedback.
 

Nestharus

o-o
Reaction score
84
No....

JASS:

if (getSeconds() == seconds and getDecimal() == decimal) then
endif


Where am I combining them? That's exactly what I'd do for more accurate timestamps.
 

Solmyr

Ultra Cool Member
Reaction score
30
Alright, I'll add them, but I would need to think of a proper name. [ljass]Time.getDecimal()[/ljass] just doesn't cut it for me.

I'll also add misc functions for checking whether it's day or night; [ljass]Time.isDay()[/ljass] and [ljass]Time.isNight()[/ljass]. There isn't any relation between them and the others, but I guess they could be useful.
 

tooltiperror

Super Moderator
Reaction score
231
Leave night/day detection to ... well ... day and night detection systems. This would be annoying with an ObjectMerger call (which is required for perfect detection)
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
actually day/night detection makes sense for a system that tells time, lol.

that's like saying a measurement system makes sense for a damage detection system because they both deal with units
 

Nestharus

o-o
Reaction score
84
Consider this...

Someone might need timestamps but not need day/night detection. Another person might need day/night but no timestamps. That's why you shouldn't couple them together, because your lib would just have extraneous useless code in many situations.

It's much smarter to keep them separated, that way if someone needs day/night detection, they can just use a day/night lib. If someone needs timestamps, they use a timestamp lib. If someone needs both, they use both.

One lib to rule them all is one lib that fails.

And another note... if you find yourself making a system inside of a system, rip that inner system out and make it a separate resource =P.

Why? never ever couple or the couple monsters will come after you
 

EspadaDelRey

New Member
Reaction score
3
Consider this...

Someone might need timestamps but not need day/night detection. Another person might need day/night but no timestamps. That's why you shouldn't couple them together, because your lib would just have extraneous useless code in many situations.

It's much smarter to keep them separated, that way if someone needs day/night detection, they can just use a day/night lib. If someone needs timestamps, they use a timestamp lib. If someone needs both, they use both.

One lib to rule them all is one lib that fails.

And another note... if you find yourself making a system inside of a system, rip that inner system out and make it a separate resource =P.

Why? never ever couple or the couple monsters will come after you

I think it would be good for original post to include a link to related lib.
 

Nestharus

o-o
Reaction score
84
I think it would be good for original post to include a link to related lib.

They would be 2 totally separate resources (unless one acted as an extension, which wouldn't be smart in this case).

That'd be like asking me to link to every single Lua resource in LUA_FILE_HEADER =P.

We had a huge debate on TH a while back as to whether similar small resources should be grouped into packs The community ended up deciding that it's a bad idea to put them into packs.

I bring this up because it's very similar to the idea of linking to similar resources.

It's best to just link to precisely what your own resource uses =).

And timestamps have absolutely nothing to do with day/night detection anyways, lol.

Plus we already have a day/night detection lib from azlier.
 

EspadaDelRey

New Member
Reaction score
3
They would be 2 totally separate resources (unless one acted as an extension, which wouldn't be smart in this case).

That'd be like asking me to link to every single Lua resource in LUA_FILE_HEADER =P.

We had a huge debate on TH a while back as to whether similar small resources should be grouped into packs The community ended up deciding that it's a bad idea to put them into packs.

I bring this up because it's very similar to the idea of linking to similar resources.

It's best to just link to precisely what your own resource uses =).

And timestamps have absolutely nothing to do with day/night detection anyways, lol.

Plus we already have a day/night detection lib from azlier.

Not sure if you ever tried learning a very difficult language or not, but a redundant dictionary is better than a non-redundant dictionary. So a link to lib from azlier means there is no need to search.

Is exaggerating encouraged at this site?
 

Nestharus

o-o
Reaction score
84
So a link to lib from azlier means there is no need to search.

Resources only have something to do with each other if they either both do the same thing or one uses the other lib =p.

day/night detection has nothing to do with timestamps =P


Also, what you are asking for is for the author of every system to search up every other system every single day to find system's similar to their own so that they can link to them. Do you get why it isn't done now?

Programming isn't at all the same thing as a dictionary for a language.
 

EspadaDelRey

New Member
Reaction score
3
Resources only have something to do with each other if they either both do the same thing or one uses the other lib =p.

day/night detection has nothing to do with timestamps =P


Also, what you are asking for is for the author of every system to search up every other system every single day to find system's similar to their own so that they can link to them. Do you get why it isn't done now?

Programming isn't at all the same thing as a dictionary for a language.

A learner might look for something that deals with "time of day". He might look at one system(one says time, one says day), find something completely different from what he wanted, and feel sad he did not find what he was looking for. Solution? You ask him to keep looking. This learner has to look at many dead ends to find the things he needs without links.
 

Nestharus

o-o
Reaction score
84
A learner might look for something that deals with "time of day". He might look at one system(one says time, one says day), find something completely different from what he wanted, and feel sad he did not find what he was looking for. Solution? You ask him to keep looking. This learner has to look at many dead ends to find the things he needs without links.

Yup. Part of programming ^)^. If you've ever programmed in a real language, a good portion of what you do is search for resources to avoid reinventing the wheel =P.

it's not the author's responsibility to link to other resources other than the ones they are using for their own.
 

Solmyr

Ultra Cool Member
Reaction score
30
Alright, I added [ljass]Time.getSeconds()[/ljass] and [ljass]Time.getDecimal()[/ljass].

Now, I only need someone that can help me explain [ljass]Time.getDecimal()[/ljass] in the documentation of the script (and possibly suggest a new name for it). I'm not a native English speaker and I doubt that newer users could make much sense of the way I explain things.

And I guess I'd pass on [ljass]Time.isDay()[/ljass] and [ljass]Time.isNight()[/ljass], even though I'm fond of merging semi-related stuff, not separating it.
 

Bribe

vJass errors are legion
Reaction score
67
You could simply do "requires optional DayNightEvent" if you want the user to only have to require one library, then post in your description: recommended resource: DayNightEvent.
 

Nestharus

o-o
Reaction score
84
You could simply do "requires optional DayNightEvent" if you want the user to only have to require one library, then post in your description: recommended resource: DayNightEvent.

Yea, but DayNightEvent stuff has absolutely nothing to do with timestamps... it'd be like a unit indexer using a string parser lib cuz it's recommended by the author (bit of an extreme example).
 

tooltiperror

Super Moderator
Reaction score
231
Adding day/night detection is simply just wrong.

Night and Day are not predictable things in Warcraft III. A user can change their game constants, or change the game time suddenly to get past the usual detection method. The work around to this was discovered by Jesus4Lyf and implemented by Azlier.

Rather than make this nice and small snippet have an ObjectMerger call, or a series of Lua scripts to make safe generation, you should just add something like "[NOPARSE]This library is for dealing with the actual time of the day. For daytime and nighttime detection, events, and booleans, use DayNightEvent.[/NOPARSE]" to the original post.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top