#SMODS config tab API?

1 messages · Page 1 of 1 (latest)

golden idol
#

Anyone got documentation/example of how to use the config tab API?
(SMODS.current_mod.config_tab)
Thanks in advance! ^^

glossy bronze
#

It relies on the UI, and everyone builds their own UI, you can find information on how to start using the UI in the wiki, though, honestly, there should probably be an example mod that's just an easy config page, I'll look into making one sometime.

golden idol
#

Ah I see

#

Dang I'd really hoped I don't have to dip my toes deep for a simple check option 😓

#

How much of a hassle is it?

glossy bronze
#

It's no doubt a learning curve, but I'd say it's on the same level as contexts, looks intimidating, a little rough the first few times you experiment with it, then it really clicks.

golden idol
#

Alright! sounds fairly easy then, Thank you very much :D

#

Good luck with making an example mod, seems necessary

golden idol
glossy bronze
golden idol
#

Thanksies!!

golden idol
#

Alright, I have a config page set up with a couple of checkmarks hooked up to a config.lua, now how do I grab their values?
Specifically during injection, as I want to link 'em to atlas positions and such 🤔

glossy bronze
golden idol
#

Huh, I looked it up here and it seems plenty had the same issue before, including you 😅

glossy bronze
#

What does your config.lua look like?

golden idol
glossy bronze
#

I think try surrounding your variables in [''], so it'd be ['jokers_designs'].

golden idol
#

Huh

#

let's see...

#

Nope, still nil

golden idol
unkempt remnant
#

where are you accessing the config, and where is the config file at?

golden idol
#

Config file is next to main.lua

#

I'm trying to call it during injection, as in setting a Joker's atlas

unkempt remnant
#

you need to save a reference to the config somewhere in your main file (not within any other object), SMODS.current_mod gets overwritten after the initial loading phase

#

is your config file's name exactly config.lua?

golden idol
unkempt remnant
#

can you show code?

golden idol
#

Sure

unkempt remnant
#

config.getValue?

golden idol
#

it doesn't matter anyway, config itself is nil

unkempt remnant
#

crash please

golden idol
#

but yeah what's the proper way of calling out of config, just ["jokers_designs"] 🤔

glossy bronze
#

You can just do config.jokers_designs, or config['jokers_designs'].

golden idol
glossy bronze
#

I assume you're hiding it here for a reason, but, do you wanna DM me the code so I can mess around and figure it out?

golden idol
#

like the whole mod?

glossy bronze
#

Sure.

golden idol
#

Alright haha

#

function get_design gets called in line 942 to set a joker's atlas to either one of these

unkempt remnant
#

this isn't config itself being nil, it's design[config.jokers_designs] being nil

#

that's designs.Redesign

#

wait what

#

try printing config

golden idol
#

What's the command for logging 💀

unkempt remnant
#

sendDebugMessage(tprint(config)) should do

golden idol
#

Where does it spit it out

#

I don't see it in the crash window

glossy bronze
#

In the black console, and you may need to remove the crashing line.

golden idol
#

Shucks, I think I may know the issue 💀

#

jokers_designs is set to a value I removed