| Yoko http://forum.yoko.com.ua/ |
|
| Few aritmetic questions http://forum.yoko.com.ua/viewtopic.php?f=3&t=3265 |
Page 1 of 1 |
| Author: | pegarion [ 2005-03-01 18:04:48 ] |
| Post subject: | Few aritmetic questions |
I am trying to improve my scripts, but I can't solve few problems 1) I would like to ask how to ROUND a number 2) I would like to get distance between two creatures...Is there some function like sqrt ? Thank you for your answer. |
|
| Author: | Necr0Potenc3 [ 2005-03-01 20:53:10 ] |
| Post subject: | |
1) use the ceil() or floor() functions. one rounds up and the other rounds down. (7.1 becomes 8 and 7.1 becomes 7) 2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)(y1 - y2)); x1 and y1 belong to one object. x2 and y2 belong to another |
|
| Author: | pegarion [ 2005-03-01 21:04:54 ] |
| Post subject: | |
All the functions you wrote don't work ...maybe my injection is too old...I don't know.. |
|
| Author: | Necr0Potenc3 [ 2005-03-01 22:56:30 ] |
| Post subject: | |
I thought you were talking about coding but you're talking about scripting, arent you? |
|
| Author: | pegarion [ 2005-03-01 23:47:29 ] |
| Post subject: | |
Yes |
|
| Author: | Yoko [ 2005-03-02 12:51:27 ] |
| Post subject: | Re: Few aritmetic questions |
pegarion wrote: 2) I would like to get distance between two creatures...Is there some function like sqrt ?
there is no need in sqrt function to find distance in UO do not forget, distance always integral (integer) value. if you will think a bit you will find formula yourself |
|
| Page 1 of 1 | All times are UTC+02:00 |
| Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |
|