Scripts / Set Seconds instead of Milliseconds in Script

Author
Message
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 15:02
Hello.

I wonder if its possible to use "Seconds" instead of Milliseconds in a Script?

Greetings and Thanks in Advance.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 6th Jun 2016 15:06
You could probably set a math argument to do it, but why go through the effort? you only have to add three zeros to the end.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 15:11 Edited at: 6th Jun 2016 15:12
The Problem is, that my Day & Night Cycle System uses every millisecond and this affect the whole game play.
If i attack, i can see every millisecond cause im attacking in slowmotion.

cycle_time = (cycle_time / 60) * 1000 <- This is actually. If i could set it in Seconds only, it would not really affect the game play.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 6th Jun 2016 15:27 Edited at: 6th Jun 2016 15:31
Could you set a global to do it for you?

I'm totally useless at LUA, so here's a total stab in the dark






If i'm right, and i'm probably extremely wrong, this should allow you to enter your seconds in the g_seconds = global, then the next global will calculate it, and then the prompt will display the seconds and milliseconds. If it works, you should be able to adapt it to your script so you can set your cycle to seconds and it works out the milliseconds for you.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 15:31
I am completely new too

Im using this script.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 6th Jun 2016 15:48 Edited at: 6th Jun 2016 15:50
Hmn that looks to me like you already just place it in secondsin the local cycle_time, then it calculates it into milliseconds for you and runs the script.

It sounds like it already does almost what you want. A little confused now.

Whatever it is you wan though, the script will always process in milliseconds, that's hard coded, the best you can do is make a local or global variable that converts seconds into milliseconds so you can enter seconds into the variable instead of milliseconds, which it looks like that script is already doing.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Jun 2016 16:01
Use os.time instead of GetTimer(e).
Take a look this mater smallg script, see how he is using os.time.



3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 16:22 Edited at: 6th Jun 2016 16:25
Like i said: Im a completely newb with lua i tryd ur solution but i get an error:

---------------------------
LUA ERROR!
---------------------------
scriptbank\day_night.lua:63: unexpected symbol near '='
---------------------------
OK
---------------------------
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 6th Jun 2016 19:08
Quote: "scriptbank\day_night.lua:63: unexpected symbol near '="
'

This usually happens when you make some comparison, if so, you has to use "==" instead of "=".

If x == 1 then
do something
else
do nothing or something else
end

3om
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 19:33 Edited at: 6th Jun 2016 19:34
if i set the item to Always Active it shows this error:
---------------------------
LUA ERROR
---------------------------
scriptbank\day_night.lua:127: attempt to perform arithmetic on upvalue 'time1' (a boolean value)
---------------------------
OK
---------------------------


But if i change it to Always Active = Off - No errors at all but it does not work anymore. Before the change it worked with the "Off" value.
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 19:39
Okay. Got it working with os time but has the same slowmotion effect cause the milliseconds.
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 6th Jun 2016 19:46
Every other script just works great. but this one let you feel every millisecond. You actually attack in slowmotion, gates open in slowmotion and so on.
If this script is off, all works very fine.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Jun 2016 21:03
that's lag, nothing to do with timers, probably one of the many bugs caused by the changing ambiance / fog / other effects that came with the extra commands which were very badly added some time ago, i no longer support that script because of those reasons
my advice would be to comment out the Set*blah* lines until you find the cause.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Kalle801
10
Years of Service
User Offline
Joined: 8th Jan 2014
Location: Germany
Posted: 7th Jun 2016 11:29 Edited at: 7th Jun 2016 11:43
Okay ill test it

Ty.

Edit: Okay it it cause the Ambience change. But if i comment it all out, the script is useless
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jun 2016 15:29
I think you can add a delay in the speed at which the command gets called which should fix most of the issues, they were clearly not designed to be constantly updated (which is fair enough).

So just a basic
If xdelay > 100 then
Setambiance etc
Else
Xdelay = xdelay +1
End
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-05-04 19:09:20
Your offset time is: 2024-05-04 19:09:20