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 Share on other sites More sharing options...
MidrealmDM 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? 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 ? Link to comment 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 Share on other sites More sharing options...
MidrealmDM Posted September 10, 2014 Share Posted September 10, 2014 HELP! (moved to a new subject thread)http://forums.kleientertainment.com/topic/40592-off-center-graphics/?p=533966 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.