shaochen Posted May 3, 2014 Share Posted May 3, 2014 I add some new cookpot recipies in modmain, some were ok, However, some went wrong.When cooking,some material matches will report bug. It say" attempt to compare number with nill"How to solve it? Link to comment https://forums.kleientertainment.com/forums/topic/35867-problems-on-cookpot-recipies/ Share on other sites More sharing options...
MidrealmDM Posted May 3, 2014 Share Posted May 3, 2014 (edited) I add some new cookpot recipies in modmain, some were ok, However, some went wrong.When cooking,some material matches will report bug. It say" attempt to compare number with nill"How to solve it? I had this same problem in a mod I just published Look at the line of code referenced by the error,does it say something liketest = function(cooker, names, tags) return tags.meat >= 1 I believe the problem is the game is looking to see if your cooker has (in this example) meat value greater than 1, but you have 0 meat and the game is confused.you are asking Is there more than X of this ingredient?the game comes back and says 'I cant tell if it is greater because I cant find it.'(attempting to compare a number with nil) Anytime your recipe needs to check a value be greater than, you need to tell it to check for the value be present first.Also if you want a value to be less than, you need to do the same thing, otherwise anything with 0 (none of the ingredient) will still qualify try thistest = function(cooker, names, tags) return tags.meat and tags.meat >= 1 Imagine it a two step question - is there any of this ingredient and if so is it more (or less) than X ? Edited May 3, 2014 by MidrealmDM Link to comment https://forums.kleientertainment.com/forums/topic/35867-problems-on-cookpot-recipies/#findComment-469500 Share on other sites More sharing options...
shaochen Posted May 4, 2014 Author Share Posted May 4, 2014 I had this same problem in a mod I just published Look at the line of code referenced by the error,does it say something liketest = function(cooker, names, tags) return tags.meat >= 1 I believe the problem is the game is looking to see if your cooker has (in this example) meat value greater than 1, but you have 0 meat and the game is confused.you are asking Is there more than X of this ingredient?the game comes back and says 'I cant tell if it is greater because I cant find it.'(attempting to compare a number with nil) Anytime your recipe needs to check a value be greater than, you need to tell it to check for the value be present first.Also if you want a value to be less than, you need to do the same thing, otherwise anything with 0 (none of the ingredient) will still qualify try thistest = function(cooker, names, tags) return tags.meat and tags.meat >= 1 Imagine it a two step question - is there any of this ingredient and if so is it more (or less) than X ? Thanks a lot for your help. I noticed the "name" should be repeated when use “≥“,but I ignored that so does tags. Link to comment https://forums.kleientertainment.com/forums/topic/35867-problems-on-cookpot-recipies/#findComment-470017 Share on other sites More sharing options...
MidrealmDM Posted September 10, 2014 Share Posted September 10, 2014 (edited) HELP! (moved to a new subject thread)http://forums.kleientertainment.com/topic/40592-off-center-graphics/?p=533966 Edited September 11, 2014 by MidrealmDM Link to comment https://forums.kleientertainment.com/forums/topic/35867-problems-on-cookpot-recipies/#findComment-533296 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