 
                
                4 posts
                
             
            
                Posted 12 April 2013 - 02:33 PM
                Ok so I get an error with this code
((x)^2)0.5 = disX
Im doing a moving system for turtle and this code is to remove the minus to calcul the distance betwen the 2 coords
but I get a syntax error when I run it
 
         
        
        
            
            
                
                     
                
                645 posts
                
                    
                        Location
                        'Merica
                    
                
             
            
                Posted 12 April 2013 - 02:41 PM
                Well are you manually typing in a coord for X? Because its hard to get a variable into a number, make sure you are having the variable being converted into a number so it can do that equation.
                
             
         
        
        
            
            
                
                     
                
                2217 posts
                
                    
                        Location
                        3232235883
                    
                
             
            
                Posted 12 April 2013 - 02:42 PM
                because your supposed to do this:
disX=((x)^2)0.5
 
         
        
        
            
            
                
                     
                
                1688 posts
                
                    
                        Location
                        'MURICA
                    
                
             
            
                Posted 12 April 2013 - 02:43 PM
                Could just do this:
disX = x^2 / 2
 
         
        
        
            
            
                
                     
                
                4 posts
                
             
            
                Posted 19 April 2013 - 01:21 PM
                I mean to remove any minus coord to get the distance betwen the 2 x's coord. 
disX = ((x^2)^0.5)
                
             
         
        
        
            
            
                
                     
                
                1688 posts
                
                    
                        Location
                        'MURICA
                    
                
             
            
                Posted 19 April 2013 - 02:20 PM
                To convert a number to a positive number, just use math.abs(num).