Ask for help
Moderators: Murderator+, Murderator
-
pegarion
- Posts: 4
- Joined: 2005-02-23 16:48:24
Post
by pegarion »
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.
-
Necr0Potenc3
- Expert!
- Posts: 74
- Joined: 2004-05-30 00:31:54
Post
by Necr0Potenc3 »
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
-
pegarion
- Posts: 4
- Joined: 2005-02-23 16:48:24
Post
by pegarion »
All the functions you wrote don't work

it writes : "line x: Function not found"
...maybe my injection is too old...I don't know..
-
Necr0Potenc3
- Expert!
- Posts: 74
- Joined: 2004-05-30 00:31:54
Post
by Necr0Potenc3 »
I thought you were talking about coding but you're talking about scripting, arent you?
-
Yoko
- Site Admin
- Posts: 1964
- Joined: 2004-04-03 16:49:38
-
Contact:
Post
by Yoko »
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