• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ TFS 1.3 Any way to detect if it is night?

Eduardo170

Well-Known Member
Joined
Jan 7, 2014
Messages
422
Solutions
3
Reaction score
66
Location
Caracas, Venezuela
I don't know if inside TFS 1.3 it has a function to get the light of the game and determine if it is day or night. I want to use for a script.
 
Looking at the sources, I'm not seeing it. Internally the function is called Game::getWorldLightInfo. It should just be basic busywork to expose it via a Lua binding.

Relevant area is here.


Scratch that. Github search apparently had a stroke.

Lua:
int LuaScriptInterface::luaGetWorldLight(lua_State* L)
{
        //getWorldLight()
        LightInfo lightInfo = g_game.getWorldLightInfo();
        lua_pushnumber(L, lightInfo.level);
        lua_pushnumber(L, lightInfo.color);
        return 2;
}
 
Last edited:
Looking at the sources, I'm not seeing it. Internally the function is called Game::getWorldLightInfo. It should just be basic busywork to expose it via a Lua binding.

Relevant area is here.
Code:
//getWorldTime()
lua_register(luaState, "getWorldTime", LuaScriptInterface::luaGetWorldTime);

//getWorldLight()
lua_register(luaState, "getWorldLight", LuaScriptInterface::luaGetWorldLight);

//getWorldUpTime()
lua_register(luaState, "getWorldUpTime", LuaScriptInterface::luaGetWorldUpTime);

Here
 
Last edited:
Github search lied to me I guess. Shoulda used grep on the commandline. 🤷‍♂️
Post automatically merged:

1584759617628.png
🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️🤷‍♂️🤷‍♀️
 
Back
Top