trajik Posted July 5, 2010 Share Posted July 5, 2010 function checkAllInputsAreValid() local hasError = false local NameBox = guiGetText(NameBox) local weightInput = guiGetText(weightInput) local heightInput = guiGetText(heightInput) local ageInput = guiGetText(ageInput) local bioInput = guiGetText(bioInput) if ( string.len(NameBox) < 1) then hasError = true outputDebugString("name") elseif (string.len(weightInput) < 50 or tonumber(weightInput) > 150) then hasError = true outputDebugString("weight") elseif ( string.len(heightInput) == 0 or tonumber(heightInput) < 150 or tonumber(heightInput) > 200) then hasError = true outputDebugString("height") elseif ( string.len(ageInput) == 0 or tonumber(ageInput) < 4 or tonumber(ageInput) > 7) then hasError = true outputDebugString("age") elseif ( string.len(bioInput) < 30) then hasError = true outputDebugString("bio") end now shouldn't this code make it so my guiEdits must have a value within the functions parameters? in the Debugscript it says the error is in weight however when I disable it it says the error is with Height and so on. Link to comment
Lordy Posted July 5, 2010 Share Posted July 5, 2010 Well look what conditions you're giving.. - Name is kinda ok, you wouldn't want anything below 1 character. - weightInput has to be more than 50 characters and less than 150 kg.. Why? Maybe you you meant also tonumber not string.len in that conditional. - for heightInput, do a outputChatBox(heightInput) to see what values are returned. And check if they fit in the conditions. If they fit, then something is wrong with elseif conditions, if not then something is wrong with the gui edits. Link to comment
trajik Posted July 6, 2010 Author Share Posted July 6, 2010 I still don't understand....I substituted string.len with tonumber and it still doesn't work. Link to comment
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