Fangliding Posted December 7, 2024 Share Posted December 7, 2024 I want to write a simple mod to allow Clockmaker's Tools to dismantle other items The limit is in componentactions.lua, it only allows Wanda to dismantle watchs So I write this But the game reported "attempt to index global 'ACTIONS'(a nil value)" I did't see any code in componentactions.lua to import ACTIONS from other place, maybe this variable has not been initialized yet when loading the mod? Link to comment https://forums.kleientertainment.com/forums/topic/161966-how-to-access-actions/ Share on other sites More sharing options...
Mr.CrazyPotato Posted December 9, 2024 Share Posted December 9, 2024 Use local ACTIONS = GLOBAL.ACTIONS at the top of your file. Remember my child: if something is being used in code and not being declared in code but don't work because of "a nil value" you should probably declare it with GLOBAL. or import the script with this function which is often times impossible or useless because it's in source code. 1 Link to comment https://forums.kleientertainment.com/forums/topic/161966-how-to-access-actions/#findComment-1771903 Share on other sites More sharing options...
Fangliding Posted December 12, 2024 Author Share Posted December 12, 2024 On 12/9/2024 at 2:53 PM, Mr.CrazyPotato said: Use local ACTIONS = GLOBAL.ACTIONS at the top of your file. Remember my child: if something is being used in code and not being declared in code but don't work because of "a nil value" you should probably declare it with GLOBAL. or import the script with this function which is often times impossible or useless because it's in source code. Thank you very much ~~Then I got an error throwed by seasonclock(how?)~~ I plan to write a new dismantle action. But I have a question, I have another mod to override a TUNING variable, but I do not need to write `local TUNING = GLOBAL.TUNING`, I just need to write `TUNING.DEERCLOPSEYEBALL_SENTRYWARD_TEMPERATURE_OVERRIDE = 10`, and it just work Link to comment https://forums.kleientertainment.com/forums/topic/161966-how-to-access-actions/#findComment-1774356 Share on other sites More sharing options...
Mr.CrazyPotato Posted December 12, 2024 Share Posted December 12, 2024 2 hours ago, Fangliding said: and it just work Yes, sometimes mod environment already have some things. It's good to not write code you don't need to but if you're not sure you can always do it, it won't cause an error if you're know what you're doing. And error with seasonclock most likely caused because you're using some Wanda's items components which maybe somewhere work with seasonclock Link to comment https://forums.kleientertainment.com/forums/topic/161966-how-to-access-actions/#findComment-1774419 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now