I have the detect and reply system working, using Computronics. I dont have the middle bit where it calculates the sum. Is there a way of doing this?
So far my code looks something like this:
-- The code to break down the message to just the sum is up here -- sum is the variable name given to the string if string.find(sum, "+") then symbolLoc = string.find(sum, "+") symbol = + elseif string.find(sum, "-" then symbrolLoc = string.find(sum, "-") symbol = - end if string.find(sum, "?") then questionLoc = string.find(sum, "?") else sum = sum.."?" questionLoc = string.find(sum, "?") no1 = tonumber(string.sub(sum, 1, symbolLoc - 2)) no2 = tonumber(string.sub(sum, symbolLoc + 2, questionLoc)) answer = math.floor(no1 symbol no2)
The error it's giving is "Trying to add nil and nil" or something along those lines.
I have confirmed it is receiving the message properly, so that's not the problem