| 08-22-2009, 10:08 AM | #1 |
Hi, does anyone know how to convert ability codes in the object editor to integers? I mean mathematically. Like for example for Aerial shackles with the Ability Id 'Amls', if you convert it to string and display it with the BJDebugMsg function it will show 1097690227. Is there a formula to do so? Thanks in advance |
| 08-22-2009, 10:29 AM | #2 |
Did you try S2I(I2S('Amls'))? edit2: seems like thats not even necessary. 'Ahea' is a "real" integer all the time. JASS:if 'Ahea' == 1097360737 then //true call BJDebugMsg( I2S( 'Ahea'-1097360737 ) ) //displays 0 endif |
| 08-22-2009, 11:15 AM | #3 |
hmm.. I think you are not getting my question right. What I'm asking is; is there any way for us to calculate the integer value of an ability code manually (without using I2S but just by using a calculator)? Is it like the abilty codes are actually like some representation of a binary code or something? |
| 08-22-2009, 12:14 PM | #4 |
I don't think so, since you can give abilitys your own id code of choice. The real integer just increases by 1 with every ability. It's like a autoincrement id. And I guess the ability code is just something like a global refering to that real id |
| 08-22-2009, 12:25 PM | #5 |
hmmm.. interesting.. Thanks :) |
| 08-22-2009, 12:47 PM | #6 |
This is wrong actually. You can convert the rawcode into and integer and viceversa by hand. There are quite a few functions (that can be easily converted to a math formula) that do that. Look for shit like rawcode2string and viceversa |
| 08-22-2009, 01:42 PM | #7 | |
Quote:
rawcode is already integer, no matter how you type 'd' or 100 this all same. 'a000' 2988449668 0x10000 |
| 08-22-2009, 02:33 PM | #8 |
Rawcodes are integers in base 256 instead of integers in base 10 as we're used to. The symbols used are the ascii symbols. For example: 'a' = 97. 'ba' = 'b' * 256 + 'a' = 98 * 256 + 97 = 25185 |
| 08-22-2009, 03:07 PM | #9 | |
Quote:
I meant to say the written-by-hand rawcode. Not the rawcode type within the Jass machine (which is obviously just a different integer notation). Say you wanted to know vhat decimal integer value does 'hpea' equate. Eleandor explained it best. |
| 08-22-2009, 03:28 PM | #10 |
you dont need to know what 'a000' decimal value is. there is no reason to calculate it, nothing you can do with this value. deep debug tasks is outside novice level coding... |
| 08-22-2009, 03:41 PM | #11 | |
Quote:
Well, Personally I actually use a bunch of debug chat commands where the user can create a unit by passing a string that could be converted to a handletype id (so typing "hpea" will create the unit whose rawcode is 'hpea'). Plus, people gets always curious. |
| 08-22-2009, 04:45 PM | #12 | |
Quote:
interesting... so basically, we can just enter an integer number instead of stuffs like 'A002' into the function to create units and stuffs as long as we know the conversion method? |
| 08-22-2009, 05:05 PM | #13 |
yep, but it is less descriptive. |
| 08-22-2009, 05:11 PM | #14 |
Nice! So that means we can enter abilities with loops in functions as long as we control the abilityId of objects everytime we make it in the OE. Thanks guys :) |
| 08-22-2009, 06:52 PM | #15 |
you cant... 256thbit integer dont actually keep its order due special chars not allowed in integer but inside charmap |
