Jump to content




[Lua]


  • You cannot reply to this topic
5 replies to this topic

#1 trillilyy

  • Members
  • 4 posts

Posted 12 April 2013 - 01: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

#2 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 12 April 2013 - 01: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.

#3 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 12 April 2013 - 01:42 PM

because your supposed to do this:
disX=((x)^2)0.5


#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 12 April 2013 - 01:43 PM

Could just do this:
disX = x^2 / 2


#5 trillilyy

  • Members
  • 4 posts

Posted 19 April 2013 - 12:21 PM

I mean to remove any minus coord to get the distance betwen the 2 x's coord.

disX = ((x^2)^0.5)

#6 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 19 April 2013 - 01:20 PM

To convert a number to a positive number, just use math.abs(num).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users