• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Get Real World Date System

Level 20
Joined
Jul 12, 2010
Messages
1,717
Hello everybody,

I'm interested in implementing daily rewards/quests in my RPG map, like Runescape/mobile games etc.

I want to know if there is a Jass Native to get the current real world date (from b.net server maybe?), obviously this won't work if you are offline.
This was asked before. But Lua is a no.

Alternative is to just have one-time quests every game but that can be abused by doing a lot of remakes.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
I don't think there is any way to do that in jass. Jass was created specifically for wc3, so I imagine the devs just put in the stuff they needed. On the other hand lua is a general purpose scripting language, which is why you can (probably) do that.

I don't know what map you are making, nor your target audience, but perhaps you should rethink using datetimes in multiplayer map that will be played over the course of multiple days, unless you are prepared to handle stuff like time zones, people changing their own local time, etc.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Well, lua has some libraries that allow you to send http requests, so you could send http request to some trusted site that will return you the datetime, but I imagine that such libraries will be blocked in warcraft as that could potentially be a security issue.

Is the map just for you and your friends (for example for lan party)? If so, maybe you don't even need to check date time, instead it could work if you had trusted host for the map who would have access to some specific commands through which they could 'end the day', resetting dailies to other players
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Well, it depends on who is t he host, right? I can't say I have much experience with continued multiplayer games, but if the host of the game can change, then it is an issue. Imagine one player being in UTC+5 timezone, while other being in UTC-2 timezone, etc.
The author could only check UTC time, which would be semi-universal but then daily reset for player A would be for example at 3 am while for player B it would be 9 am.

Personally, I am not that proficient with lua, but a quick search yielded os.date() which is used to to get current date time, which just seems to take user's local date time, so changing date time could completely circumvent what xorkatoss is trying to atchieve.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
@Uncle yes problem is I don't want to lean lua lol, even learning some basic jass was a hassle I don't want to repeat.

@Nichilus well no point in discussing this any further but for the sake of ending this conversation, IF it possible to get server b.net time I would just choose the Europe server time and the other regions would have to just deal with it lol.

thank you all for helping me! :thumbs_up:
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
@Uncle yes problem is I don't want to lean lua lol, even learning some basic jass was a hassle I don't want to repeat.

@Nichilus well no point in discussing this any further but for the sake of ending this conversation, IF it possible to get server b.net time I would just choose the Europe server time and the other regions would have to just deal with it lol.

thank you all for helping me! :thumbs_up:
I understand, but note that they use the same API so it's really not that different. I learned Lua first and by learning it I was able to understand Jass MUCH quicker - It's basically the same thing with a few rule changes (that users on Hive have documented). The nice thing about Lua is it often does what Jass does with less effort. For example:
vJASS:
function MyNewFunction takes unit u returns integer i
    local integer i = GetUnitTypeId(u)
    call KillUnit(u)
    return i
endfunction
Lua:
function MyNewFunction(u)
    local i = GetUnitTypeId(u)
    KillUnit(u)
    return i
end
Look at the Lua function, it's doing the same thing without needing a bunch of extra fluff like "takes unit", "returns integer", "call", "set", etc.
 
Last edited:
Top