#1 25-06-2009 16:55

Deji
From: UK
Registered: 09-11-2008
Posts: 189
Website

xxx.xx Coords?

Okay, there are some modders out there who know some sort of algorithm to make coordinates work properly as in, exact like this...

2451.26

Not this...

2451.0

But I'm not one of those modders (mathematical stuff confuses me).

And I basically want to know how to do it smile

Gimme, gimme... I mean... Pretty please with a cherry on top tongue I'm feeling random today.

UGH... Sorry for the two posts. This forum keeps giving me blank pages after posting and I had to refresh. Had no idea that it'd already posted.

Last edited by Deji (25-06-2009 16:57)

Offline

#2 28-06-2009 10:09

Seemann
Registered: 07-08-2006
Posts: 2,153

Re: xxx.xx Coords?

What do you mean by "make coordinates work"? Coords are just numbers, they don't 'work' at all. Please, explain it a bit.

Offline

#3 01-07-2009 09:34

Deji
From: UK
Registered: 09-11-2008
Posts: 189
Website

Re: xxx.xx Coords?

I mean, displaying coordinates on screen... For debugging purposes.

But accurately... Instead of the coordinate 1094.0 you get 1094.99 which is the exact coordinate and would effect the position alot more...

I believe you did it in your DBMU mod... And used some math to get the coordinates accurately. And I can't figure out how you did it... I get lost in the code smile

Offline

#4 06-07-2009 17:59

ZAZ
Registered: 05-12-2007
Posts: 55

Re: xxx.xx Coords?

Deji wrote:

I mean, displaying coordinates on screen... For debugging purposes.

But accurately... Instead of the coordinate 1094.0 you get 1094.99 which is the exact coordinate and would effect the position alot more...

I believe you did it in your DBMU mod... And used some math to get the coordinates accurately. And I can't figure out how you did it... I get lost in the code smile

it must be integers to show values with text opcodes
convert the coords to integers then you have the values infront of the comma
convert them back but with other variables into floats
now you can subtract the filtered coords from the complete coords to get the values behind comma
exemple:
1234.567 -= 1234.00
result = 0.567

multiplicate the result with 100.0 to get valid integers with the float_to_integer opcode
but these values should not be negativ, so check if they are negativ and if yes multiplicate them with -1

the script below don't show the dot, you have to imagine it.

{$CLEO .cs}
:coords_00
03A4: name_thread 'COO'
0006: 33@ =  0  // integer values
0006: 3@ =  0  // integer values
0006: 4@ =  0  // integer values
0006: 5@ =  0  // integer values
0006: 11@ =  0  // integer values
0006: 12@ =  0  // integer values
0006: 13@ =  0  // integer values
0006: 9@ =  0  // integer values

:coords_01
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @coords_01
03F0: enable_text_draw 1
045A: text_draw_1number  50.0  425.0 'NUMBER' 3@    // value
045A: text_draw_1number  200.0  425.0 'NUMBER' 4@    // value
045A: text_draw_1number  350.0  425.0 'NUMBER' 5@    // value
045A: text_draw_1number  100.0  425.0 'NUMBER' 11@    // value
045A: text_draw_1number  250.0  425.0 'NUMBER' 12@    // value
045A: text_draw_1number  400.0  425.0 'NUMBER' 13@    // value
045A: text_draw_1number  450.0  425.0 'NUMBER' 9@    // value
if
0019:   33@ >  1000  // integer values
004D: jump_if_false @coords_01
0006: 33@ =  0  // integer values
00A0: store actor $PLAYER_ACTOR position to 0@ 1@ 2@ 
0092: 3@ = float_to_integer 0@  
0092: 4@ = float_to_integer 1@  
0092: 5@ = float_to_integer 2@  

0093: 6@ = integer_to_float 3@  
0093: 7@ = integer_to_float 4@  
0093: 8@ = integer_to_float 5@  

0063: 0@ -= 6@  // floating-point values 
0063: 1@ -= 7@  // floating-point values 
0063: 2@ -= 8@  // floating-point values 
0013: 0@ *=  100.0  // floating-point values 
0013: 1@ *=  100.0  // floating-point values 
0013: 2@ *=  100.0  // floating-point values 

0092: 11@ = float_to_integer 0@  
0092: 12@ = float_to_integer 1@  
0092: 13@ = float_to_integer 2@

:coords_02
00D6: if  0
001B:    0 > 11@  // integer values 
004D: jump_if_false @coords_03
0012: 11@ *= -1  // integer values 

:coords_03
00D6: if  0
001B:    0 > 12@  // integer values 
004D: jump_if_false @coords_04
0012: 12@ *= -1  // integer values

:coords_04
00D6: if  0
001B:    0 > 13@  // integer values 
004D: jump_if_false @coords_05
0012: 13@ *= -1  // integer values

:coords_05
0172: 9@ = actor $PLAYER_ACTOR z_angle 
0092: 9@ = float_to_integer 9@
0002: jump @coords_01

Offline

Board footer

Powered by FluxBB