Jump to content

Recommended Posts

trying to detect RoG in modmain.lua :

if GLOBAL.IsDLCEnabled and GLOBAL.IsDLCEnabled(1) then

-- something to do
    print ("RoG support enabled")
else
    print ("RoG support disabled")
end
 

but when i creating new game with RoG enabled or without its always return "true", i.e. prints "support enabled"

 

i am missed something or what the way to detect RoG?

Edited by iWitch
Link to comment
https://forums.kleientertainment.com/forums/topic/34380-isdlcenabled/
Share on other sites

GLOBAL.REGIN_OF_GIANTS is 1, its dont make any changes

 

so far i found problem - when you creating new world with disabled RoG, IsDLCEnabled shows true

but if you exit and load it again it will be false

 

and there other (but not good at all) way to detect enabled/disabled RoG :

if GLOBAL.SEASONS.AUTUMN then
Edited by iWitch

 

GLOBAL.REGIN_OF_GIANTS is 1, its dont make any changes

 

so far i found problem - when you creating new world with disabled RoG, IsDLCEnabled shows true

but if you exit and load it again it will be false

 

and there other (but not good at all) way to detect enabled/disabled RoG :

if GLOBAL.SEASONS.AUTUMN then

 

This is what we're using for U&A.

local is_rog_enabled = VarExists("IsDLCEnabled") and VarExists("REIGN_OF_GIANTS") and IsDLCEnabled(REIGN_OF_GIANTS)

isnt its similar to

GLOBAL.IsDLCEnabled and GLOBAL.IsDLCEnabled(1)

if IsDLCEnabled not exists then function doesnt calls, anyway if in some magic way it will be called (while not exists) - it crash game.

 

Anyway there no problem with IsDLCEnabled, problem is that TheSim:IsDLCEnabled() returns true right after world creation when RoG disabled...
 

Edited by iWitch

isnt its similar to

GLOBAL.IsDLCEnabled and GLOBAL.IsDLCEnabled(1)

if IsDLCEnabled not exists then function doesnt calls, anyway if in some magic way it will be called (while not exists) - it crash game.

As far as I know, it does work. I'd be surprised if it didn't. It makes sure that IsDLCEnabled exists, then it makes sure that RoG exists, then it checks to see if RoG is enabled.

As far as I know, it does work. I'd be surprised if it didn't. It makes sure that IsDLCEnabled exists, then it makes sure that RoG exists, then it checks to see if RoG is enabled.

i understand what this code means and btw if you want to be bit more paranoid you have to check data types also :-)

IsDLCEnabled must be a function, REIGN_OF_GIANTS - number.

 

anyway try to make new game with RoG disabled and use some assets from it

i guess game can crash after world creation... since your is_rog_enabled will be "true", thats what i am talking about...

Edited by iWitch

i understand what this code means and btw if you want to be bit more paranoid you have to check data types also :-)

IsDLCEnabled must be a function, REIGN_OF_GIANTS - number.

 

anyway try to make new game with RoG disabled and use some assets from it

i guess game can crash after world creation... since your is_rog_enabled will be "true", thats what i am talking about...

That's odd, I haven't had that happen. I use it for magic beans, among other things. If RoG is enabled, I use the buryable component (which only exists within RoG) and if it is disabled, I use the trader and tradable components. Could you share your log?

 

Edit: Hmm, I may have to check into this further tomorrow. Maybe I can recreate the crash. Although checking for autumn is a pretty clean way to do it, as well. Couldn't you also just do a check for a DLC only file?

Edited by debugman18

damn i just tested on Wilson and no problems, but with custom character its works like i wrote ...

 

modmain.lua

 

if GLOBAL.IsDLCEnabled and GLOBAL.IsDLCEnabled(1) then    print ("TEST : RoG support enabled")else    print ("TEST : RoG support disabled")endif GLOBAL.SEASONS.AUTUMN then    print ("TEST : Season support enabled")else    print ("TEST : Season support disabled")end

 

with Wilson its shows disabled

 

with custom character shows enabled :/

Edited by iWitch

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...