Jump to content

Another scripting mistery


trajik

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...