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.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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