:New [Request]

Started by Mötley, May 18, 2016, 04:45 AM

Previous topic - Next topic

Mötley

Could you please consider keeping the code GetFullTime()It's really nice to have. As well as remove the warning in console? If I wanted to use Time()Then I would have In this case NO..

KAKAN

oh no

Mötley

It's a nice script, But I am limited to an amount of space now so this is where this becomes useful, also super simple, as I had said before if I wanted to use Time()"should of been more specific" In general I would of used it but I am really limited in space so this function is extremely useful in general.
Example:: All that scripting in the Dooms code = to a close version of GetFullTime()
So this is still a request

DizzasTeR

That snippet isn't the best and perhaps use this one as its far more better and you won't get any warnings:

GetFullTime <- function() {
local table = date(), stamp;
local sec = table.sec, min = table.min, hour = table.hour, wday = table.wday, month = table.month, year = table.year;
return stamp = format( "%i:%i:%i %s - %.2d/%.2d/%d ", hour, min, sec, ( hour >= 12 && min >= 00 ? "PM" : "AM" ), table.month+1, table.day, table.year );
}
[SCRIPT]  13:8:36 PM - 05/18/2016

Mötley

That's a Nice code to,.
But does not return what I want for something so short.,
But would be considered if the warning message is not removed so this is still considered a request. I could add my version to this if my request is denied but I prefer to not waste my time with it.

Even in [LU] this exact function has been labeled the same way that it would be removed but nothing further since 2011 I believe, maybe before then.

*So this is still a request.

DizzasTeR

I don't get what you're trying to even achieve, explain what you want the function to return.

Mötley

100% exact as the photo. Space right now is a must, So I feel that the built in function is best as it goes not noticed with a big punch.
If I recall correctly in my notes it can be achieved in scripting, but returning pacific time etc, can be 100% incorrect, and will return the wrong value.

Thijn

You can use date(time(), 'u') to get the date in UTC. You can then do whatever you want with timezones.

GetFullTime will probably be removed since there's no point in having it. You cannot parse it, you cannot modify it, you can only use it as in.
date() is a perfect alternative for that, and is inbuild.

Mötley

#8
Quote from: Thijn on May 18, 2016, 03:47 PMYou can use date(time(), 'u') to get the date in UTC. You can then do whatever you want with timezones.

GetFullTime will probably be removed since there's no point in having it. You cannot parse it, you cannot modify it, you can only use it as in.
date() is a perfect alternative for that, and is inbuild.
I tried your method and It does not work correctly so I will take it as an example. I have no intensions of actually scripting it and or using the code only, as well as having a modifiable version ,,

So this is still a request...,,

Save/player part
HAdd( "HSH_Time", player.Name + " Time", GetFullTime());
login
::Language("English", "You were last active "+Time+"", player, Gray);
::Language("Spanish", "Eras en el ultimo activo "+Time+"", player, Gray);

The hashes.
Motley Time
Wednesday, May 18, 2016, 00:39:59 Pacific Standard Time
Bot Time
Wednesday, May 18, 2016, 00:42:35 Pacific Standard Time

Thijn

I'm not sure what you're trying since you aren't actually posting any code, but this works as expected.
If you're going to save time() instead of a string you can actually do something useful with it later on as well.. (For example: Pick spanish day names and months)

local dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
local monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

print(GetFullTime());

local currentDate = date();
print(format("%s, %s %02d, %d, %02d:%02d:%02d %s", dayNames[ currentDate.wday ], monthNames[ currentDate.month ], currentDate.day, currentDate.year, currentDate.hour, currentDate.min, currentDate.sec, "Do we need timezone?"));

local futureDate = date(time() + 3600);
print(format("%s, %s %02d, %d, %02d:%02d:%02d %s", dayNames[ futureDate.wday ], monthNames[ futureDate.month ], futureDate.day, futureDate.year, futureDate.hour, futureDate.min, futureDate.sec, "Do we need timezone?"));

aXXo

I figure, if you run time() in a client side script it would return time in user's timezone. Send the returned value to the server and subtract it from the time() on server side. That would yield the user's timezone.

I haven't tried client side scripting yet, so not very certain about this.

Mötley

#11
I like That code because how you said

QuoteIf you're going to save time() instead of a string you can actually do something useful with it later on as well.. (For example: Pick Spanish day names and months)

Did not think on that as I dont speak Spanish so seeing English is native to me and anything else goes  unnoticed


aXXo:
Yes that's possible, as well as running a timer or loop to constantly update the time with Announce();.

Example this could be a replacement for the game time clock In GUI to who knows, I did something similar in [LU]