Yoko

All sides of Injection
It is currently 2026-02-17 04:39:35

All times are UTC+02:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Few aritmetic questions
PostPosted: 2005-03-01 18:04:48 
Offline

Joined: 2005-02-23 16:48:24
Posts: 4
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.


Top
   
 Post subject:
PostPosted: 2005-03-01 20:53:10 
Offline
Expert!

Joined: 2004-05-30 00:31:54
Posts: 74
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


Top
   
 Post subject:
PostPosted: 2005-03-01 21:04:54 
Offline

Joined: 2005-02-23 16:48:24
Posts: 4
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..


Top
   
 Post subject:
PostPosted: 2005-03-01 22:56:30 
Offline
Expert!

Joined: 2004-05-30 00:31:54
Posts: 74
I thought you were talking about coding but you're talking about scripting, arent you?


Top
   
 Post subject:
PostPosted: 2005-03-01 23:47:29 
Offline

Joined: 2005-02-23 16:48:24
Posts: 4
Yes :)


Top
   
PostPosted: 2005-03-02 12:51:27 
Offline
Site Admin
User avatar

Joined: 2004-04-03 16:49:38
Posts: 1964
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited