stefutz101 Posted February 12, 2016 Share Posted February 12, 2016 Hi again . I have a problem. if newbieShow == false then return end local x,y,z = getElementPosition(newbiePosition) local x,y = getScreenFromWorldPosition (x,y,z) local length = dxGetTextWidth(newbieText,1,"default-bold") --dxDrawRectangle ( x-length/2-screenWidth*0.01,y, screenWidth*0.02+length, screenHeight*0.1, tocolor (109,163,61,100) ) dxDrawingColorText(newbieHead,x-length/2-screenWidth*0.01,y, x+length/2+screenWidth*0.01, y+screenHeight*0.03, tocolor(22,255,22,120),0.5, 1.1, "default-bold", "center", "center") dxDrawingColorText(newbieText,x-length/2-screenWidth*0.01,y+screenHeight*0.03, x+length/2+screenWidth*0.01, y+screenHeight*0.07, tocolor(255,255,255,120),0.5, 1, "default-bold", "center", "center") dxDrawingColorText(newbieHead,x-length/2-screenWidth*0.01,y, x+length/2+screenWidth*0.01, y+screenHeight*0.03, tocolor(22,255,22,120),0.5, 1.1, "default-bold", "center", "center") Attempt to perform arithmetic on local x a boolean value. So i guess that x isn't a number ? How i can test if that x and y returned from getScreenFromWorldPosition (x,y,z) are numbers ? That's the problem . Btw this is a part from script. Thanks in advance! Link to comment
tosfera Posted February 12, 2016 Share Posted February 12, 2016 A positive value is always true, as well as a string. the only things that are used as false are: false and nil. If you would add a simple check; if ( x and y ) then You're already there. Link to comment
stefutz101 Posted February 12, 2016 Author Share Posted February 12, 2016 if type(x)=="boolean" then return end This can work ? Link to comment
tosfera Posted February 12, 2016 Share Posted February 12, 2016 that would do, yes. But you can also use the if ( not x ) then return end way to cancel it. No need to use type to see if it's a boolean. Link to comment
stefutz101 Posted February 12, 2016 Author Share Posted February 12, 2016 Yes thanks . I'm wasn't sure if that will work. Thanks a lot . 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