| 08-06-2008, 07:33 PM | #1 |
Maybe its a well known problem but why does JASS:local location l1 = Location (0, 0) local location l2 = Location (0, 0) call BJDebugMsg (I2S (H2I (l1) - H2I (l2))) |
| 08-06-2008, 08:15 PM | #2 |
Have you tried l2 - l1? |
| 08-06-2008, 08:22 PM | #3 |
Tried now. Also tried some other stuff, it works awfully: Code:
2 + H2I (l1) = 2 2 - H2I (l1) = -<rubbish> H2I (l1) - H2I (l2) == H2I (l2) - H2I (l2) H2I (l1) + H2I (l1) == H2I (l1) + H2I (l2) == 0 H2I (l1) + 2 works correctly |
| 08-06-2008, 08:23 PM | #4 |
That's the whole 'don't use two return bugs on a line' thing. It causes JASS to go crazy and forget how to do maths. This meanwhile works fine: JASS:function Trig_Test_Actions takes nothing returns nothing local location l1 = Location (0, 0) local location l2 = Location (0, 0) local integer i1 = H2I(l1) local integer i2 = H2I(l2) call BJDebugMsg(I2S(i1 - i2)) endfunction |
| 08-06-2008, 10:05 PM | #5 |
Er I don't have WE at the moment, but I thought I tried it too and it had the same effect (well I didn't use 2 integer variables but instead local integer i = H2I (l1) and set i = i - H2I (l2) |
| 08-06-2008, 11:12 PM | #6 |
Without setting to variables, the result was messed up. Setting both to variables, the result wasn't. |
| 08-07-2008, 01:48 AM | #7 |
there is thread with information about it somewhere. |
| 08-07-2008, 12:42 PM | #8 |
The values returned from return-bug functions almost have the correct type. Sometimes you need to store the return value in a variable before it can be used. For example: http://wc3campaigns.net/showthread.php?t=99903 |
