Category | Farming Simulator 15 |
Created | 18.10.2019 13:26 |
James Walker (Unknown) | 18.10.2019 13:26 |
---|---|
In console there is `gsSetDayTime` command. How can you achieve the same thing with Lua? I can't find it within g_currentMission. There is g_currentMission.environment.currentHour / g_currentMission.environment.currentMinute but setting these values doesn't seem to do anything. |
Bilbo Beutlin (BBeutlin) | 18.10.2019 14:15 |
---|---|
In FS19 one can use "g_currentMission.environment.consoleCommandSetDayTime()" or "g_currentMission.environment.setEnvironmentTime()". But I'm not sure if it works in FS15 already. Try out. |
James Walker (Unknown) | 18.10.2019 15:40 |
---|---|
Thanks! "g_currentMission.environment.consoleCommandSetDayTime()" works perfectly as expected. "g_currentMission.environment.setEnvironmentTime()" is available but I don't know what the parameters should be. If I run: "g_currentMission.environment.consoleCommandSetDayTime(18.0)" the time gets set to 18:00 as expected. If I run: "g_currentMission.environment.setEnvironmentTime(18.0)" nothing happens. If I run: "g_currentMission.environment.setEnvironmentTime(18, 0)" then the time gets set to 00:00. Haven't figured out yet what the second command expects but the first works great, thank you! |
Bilbo Beutlin (BBeutlin) | 18.10.2019 15:50 |
---|---|
I'd assume, as first parameter is an environment table expected. Perhaps it works with 'setEnvironmentTime(nil, time)' or 'setEnvironmentTime(g_currentMission.environment, time)'? |
James Walker (Unknown) | 18.10.2019 17:22 |
---|---|
Either of your suggestions result in: Error: Running LUA method 'update'. D:/code/lsim2015/build/finalbin/dataS/scripts/environment/Environment.lua(445) : attempt to perform arithmetic on field 'currentDay' (a table value) Error: Running LUA method 'draw'. D:/code/lsim2015/build/finalbin/dataS/scripts/environment/Environment.lua(659) : attempt to perform arithmetic on local 'dayOffset' (a table value) I don't know much about modding but it's interesting! I will use the "consoleCommandSetDayTime()" instead which works as expected. |
Bilbo Beutlin (BBeutlin) | 18.10.2019 20:16 |
---|---|
Unluckily it's not documented anywhere, so one can only guess. According to the error messages maybe the function expects setEnvironmentTime(currentDay, dayOffset, time)? Anyway, much room for own experiments. *g* |
Note: Log in to post. Create a new account here.