System [System] IDM - ID Manipulator

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
I've just created the mother of all RawID converting systems :cool:

Check this out, it will come in very handy for Project Nethershard, so perhaps it might serve you any good as well...


P.S.: If you combine this with Cohadar's Extended Arrays system, you can have 65k abilities in your map and still be able to assign them data through their RawIDs :D
JASS:
    //==================================================================//
    //                                                                  //
    //                 MAGENTIX' ID MANIPULATOR v1.00                   //
    //                                                                  //
    //==================================================================//
    
    // **************************************************************** //
    //                                                                  //
    // INSTRUCTIONS:                                                    //
    // =============                                                    //
    //                                                                  //
    // This system converts Ability, Item, Research, Buff, etc.         //
    // RawIDs into subsequent integers (starting from zero) or even     //
    // a string containing the RawID's name!                            //
    //                                                                  //
    // The most logical use would be using ID2I to convert a RawID      //
    // into an integer inside array index limits, allowing you to       //
    // assign data to a RawID by simply using:                          //
    //                                                                  //
    // set SOMEABILITYDATA[ID2I('A1X3')] = "Taco!"                      //
    //                                                                  //
    //                                                                  //
    // HOW TO USE:                                                      //
    // ===========                                                      //
    // Copy this trigger into your map.                                 //
    // - Call ID2I(SomeID) to convert it into a simple integer          //
    // - Call ID2S(SomeID) to convert it into the ID string             //
    //                                                                  //
    // REQUIREMENTS:                                                    //
    // =============                                                    //
    // - vJASS                                                          //
    //                                                                  //
    // LIMITATIONS:                                                     //
    // ============                                                     //
    // - None!                                                          //
    //                                                                  //
    //                                                                  //
    // TIP: 'A6BJ' will return 8191 (max normal array index)            //
    //                                                                  //
    // **************************************************************** //
    //                                                                  //
    //      -- Credit is not required, but would be appreciated --      //
    //                                                                  //
    // **************************************************************** //
    
library IDM initializer Init

    globals
        private constant integer FactorX   = 256
        private constant integer FactorXX  = 65536
        private constant integer FactorXXX = 16777216
        
        private string array     SEMI_ASCII
    endglobals

    function ID2I takes integer ID returns integer 
        local integer array Int
        local integer array Sub
        local integer i = 1
        
        set Int[0] = (ID - (ID - (ID / FactorXXX) * FactorXXX)) / FactorXXX
        set Sub[0] = FactorXXX * Int[0] + FactorXX * 48 + FactorX * 48 + 48
        
        set Int[1] = ((ID - Sub[0]) - ((ID - Sub[0]) - ((ID - Sub[0]) / FactorXX) * FactorXX)) / FactorXX
        set Sub[1] = FactorXX * Int[1]
        
        set Int[2] = ((ID - Sub[0] - Sub[1]) - ((ID - Sub[0] - Sub[1]) - ((ID - Sub[0] - Sub[1]) / FactorX) * FactorX)) / FactorX
        set Sub[2] = FactorX * Int[2]
        
        set Int[3] = ID - (Int[0] * FactorXXX + (Int[1] + 48) * FactorXX + (Int[2] + 48) * FactorX  + 48)
        
        loop
        exitwhen i > 3
            if Int<i> &gt; 9 then
                set Int<i> = Int<i> - 7
            endif
            set i = i + 1
        endloop
        
        return Int[3] + Int[2] * 36 + Int[1] * 36 * 36
    endfunction
    
    function ID2S takes integer ID returns string
        local integer array Int
        local integer array Sub
        local integer i = 1
        
        set Int[0] = (ID - (ID - (ID / FactorXXX) * FactorXXX)) / FactorXXX
        set Sub[0] = FactorXXX * Int[0] + FactorXX * 48 + FactorX * 48 + 48
        
        set Int[1] = ((ID - Sub[0]) - ((ID - Sub[0]) - ((ID - Sub[0]) / FactorXX) * FactorXX)) / FactorXX
        set Sub[1] = FactorXX * Int[1]
        
        set Int[2] = ((ID - Sub[0] - Sub[1]) - ((ID - Sub[0] - Sub[1]) - ((ID - Sub[0] - Sub[1]) / FactorX) * FactorX)) / FactorX
        set Sub[2] = FactorX * Int[2]
        
        set Int[3] = ID - (Int[0] * FactorXXX + (Int[1] + 48) * FactorXX + (Int[2] + 48) * FactorX  + 48)

        loop
        exitwhen i &gt; 3
            if Int<i> &gt; 9 then
                set Int<i> = Int<i> + 48
            endif
            set i = i + 1
        endloop
        
        return (SEMI_ASCII[Int[0]] + SEMI_ASCII[Int[1]] + SEMI_ASCII[Int[2]] + SEMI_ASCII[Int[3]])
    endfunction
    
    private function Init takes nothing returns nothing
        set SEMI_ASCII[0]   = &quot;0&quot;
        set SEMI_ASCII[1]   = &quot;1&quot;
        set SEMI_ASCII[2]   = &quot;2&quot;
        set SEMI_ASCII[3]   = &quot;3&quot;
        set SEMI_ASCII[4]   = &quot;4&quot;
        set SEMI_ASCII[5]   = &quot;5&quot;
        set SEMI_ASCII[6]   = &quot;6&quot;
        set SEMI_ASCII[7]   = &quot;7&quot;
        set SEMI_ASCII[8]   = &quot;8&quot;
        set SEMI_ASCII[9]   = &quot;9&quot;
        set SEMI_ASCII[65]  = &quot;A&quot;
        set SEMI_ASCII[66]  = &quot;B&quot;
        set SEMI_ASCII[67]  = &quot;C&quot;
        set SEMI_ASCII[68]  = &quot;D&quot;
        set SEMI_ASCII[69]  = &quot;E&quot;
        set SEMI_ASCII[70]  = &quot;F&quot;
        set SEMI_ASCII[71]  = &quot;G&quot;
        set SEMI_ASCII[72]  = &quot;H&quot;
        set SEMI_ASCII[73]  = &quot;I&quot;
        set SEMI_ASCII[74]  = &quot;J&quot;
        set SEMI_ASCII[75]  = &quot;K&quot;
        set SEMI_ASCII[76]  = &quot;L&quot;
        set SEMI_ASCII[77]  = &quot;M&quot;
        set SEMI_ASCII[78]  = &quot;N&quot;
        set SEMI_ASCII[79]  = &quot;O&quot;
        set SEMI_ASCII[80]  = &quot;P&quot;
        set SEMI_ASCII[81]  = &quot;Q&quot;
        set SEMI_ASCII[82]  = &quot;R&quot;
        set SEMI_ASCII[83]  = &quot;S&quot;
        set SEMI_ASCII[84]  = &quot;T&quot;
        set SEMI_ASCII[85]  = &quot;U&quot;
        set SEMI_ASCII[86]  = &quot;V&quot;
        set SEMI_ASCII[87]  = &quot;W&quot;
        set SEMI_ASCII[88]  = &quot;X&quot;
        set SEMI_ASCII[89]  = &quot;Y&quot;
        set SEMI_ASCII[90]  = &quot;Z&quot;
        set SEMI_ASCII[101] = &quot;e&quot;
        set SEMI_ASCII[104] = &quot;h&quot;
        set SEMI_ASCII[110] = &quot;n&quot;
        set SEMI_ASCII[111] = &quot;o&quot;
        set SEMI_ASCII[117] = &quot;u&quot;
    endfunction

endlibrary</i></i></i></i></i></i>
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Read the "the most logical use" part :)


Say you have some abilities you need to assign data to, for example an extra "cost" (instead of just mana).
Then you could use this:

JASS:
// ... some code on init

set ENERGYCOST[ID2I(&#039;A000&#039;)] = 50.00
set ENERGYCOST[ID2I(&#039;A004&#039;)] = 20.00
set ENERGYCOST[ID2I(&#039;A012&#039;)] = 10.00
set ENERGYCOST[ID2I(&#039;A0Z0&#039;)] = 90.00



// ... PLAYER_UNIT_EVENT_SPELL_START (or whatever it&#039;s called) is triggered

if ENERGYCOST[ID2I(GetAbilityId())] &gt; 50.00 then
    call BJDebugMsg(&quot;Error: Spell costs too much&quot;)
    // stop unit from casting spell
endif
 

Vestras

Retired
Reaction score
248
This could come very handy.
Though I am not a JASSer, I understood the code you just wrote, and for my eyes, it seems very usefull.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
>>Can you explain please how you figured out the factors you used?
ASCII Conversion?

Not exactly that GaLs...

You see, Blizzard was so kind to use ASCII for their Raw IDs, but in fact only uses [0-9A-Z] for their pointers that follow after the handle type string.
This means that there is a gap of 7 between every 9 going to an A and a gap of 214 between every Z going back to a 0...


Basically, this system makes your RAW IDs into way better array indexes than ['Axxx' - 'A000'], since that method is extremely limited due to aforementioned gaps.

A bonus of this conversion is that it now allows us to backtrack which "string integer" (or ASCII integer) was entered and return that value as a string of sorts "A000", "B9E2", etc...
This means that if you substring this returned string for its first character, you can now define whether a unit that was created is Neutral, Orc, Undead, Night Elf or Human simply by using it's UnitTypeID...
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Ok, even you explain it to me, I don't understand it. I aren't a programmer, nor learnt anything about ASCII. Sorry for your explaination to me which I don't understand at all.
-_-

Well, I wonder, Grimmoire enables you to set the RawID to anything you want, is that working as well on this ?
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Works on any Raw ID, but will return array indexes from 0 to 8191 for 'x000' to 'x6BJ'
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Works on any Raw ID, but will return array indexes from 0 to 8191 for 'x000' to 'x6BJ'
Well, 'ZZZZ'? Sorry but I don't like to lag my computer for WE, just tell me the answer when you are free.

>>ctrl+d allows you to see the raw data in the object editor menu
...Don't give me crap....
I knew that already, but you know that I can set an object's raw id to 'LoLo'?
 

Cohadar

master of fugue
Reaction score
209
Well, I wonder, Grimmoire enables you to set the RawID to anything you want, is that working as well on this ?

No, not to anything you want.

The first letter of your custom object(ability, buff, unit, upgrade...) must be EXACTLY the same(including the case) as the first letter of the base object you derived your custom object from.

Basically you are allowed to change only 3 last characters 'AXXX'

Changing the first character in any way always creates problems.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
This system doesn't loop through all raw IDs, it will work basically just as fast on 'A000' as it will on 'AZZZ'
 

waaaks!

Zinctified
Reaction score
255
im confused....for what parts of mapmaking will this system very usefull? lets say spell making? is this useful in spell making?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
im confused....for what parts of mapmaking will this system very usefull? lets say spell making? is this useful in spell making?

It saves you from doing work for each rawcode.

Like, say you wanted to check if there was a certain buff, and check it for all the abilities in your map. Instead, you can just set each one a value and just loop through the checking. It is faster and easier.

Um.. If I understood correctly.

Well, just correct me if I'm wrong. :D
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
im confused....for what parts of mapmaking will this system very usefull? lets say spell making? is this useful in spell making?

It's mostly useful in spellmaking since it allows you to attach data to a spell's Raw ID, using this Raw ID as an array index.
Normally, this is possible through "RawID - 'A000'", but that has huge gaps and will thus not be 100% foolproof. (It WILL go over 8191 pretty fast)

This system allows you to convert any unit, item, spell, etc. ID into decent array indexes without gaps, thus allowing you to assign spell-specific (with a simple array or a struct array) data to 8192 spells!

65k spells if you use Cohadar's extended arrays...
 

SerraAvenger

Cuz I can
Reaction score
234
It is a simple integer attachment system if I take it right....
Attaching anything to integers : ) I thought of a similiar system but mine would work differently though.

as far as i can see, you do modulo operations ( with integer division ) to get the four letters, right?
There is still a bit of space for performance improvements.
JASS:
        set Int[1] = ((ID - Sub[0]) - ((ID - Sub[0]) - ((ID - Sub[0]) / FactorXX) * FactorXX)) / FactorXX


Set ID - Sub[0] to a variable, and it will be a bit faster. Lower stack usage, lower CPU time.
Afterwards, you just substract Sub[1] from the variable, and again you'll save some calculations.


Apart from that, it doesn't even seem to work. Function ID2S gave me 'A1' for a value that was bigger than 'A000' oO So your system seems to deliver wrong integers between 9 and 65 that are not displayed in ASCII as you never implemented them. Perhaps you might try to debug it by using "!" as a debug 'sign' to check if the integers just return a wrong value : /

well gtg I'll look a bit deeper into this system once i got time



cu, Davey

EDIT: After testing indicies from A000 to A200 it doesn't seem to have error returns in ]9;65[; Yet outside of that block there were many unknown values. I believe it might come from the gaps you were talking of, so I'll try again with preset values...
I used this with random Integers between A000 and A200 and your ID2S function, and I got very often the result: A1@@ or A1, but never a result with !. Seems test-related though
JASS:
    private function Init takes nothing returns nothing
        local integer loopA = 8
        set SEMI_ASCII[0]   = &quot;0&quot;
        set SEMI_ASCII[1]   = &quot;1&quot;
        set SEMI_ASCII[2]   = &quot;2&quot;
        set SEMI_ASCII[3]   = &quot;3&quot;
        set SEMI_ASCII[4]   = &quot;4&quot;
        set SEMI_ASCII[5]   = &quot;5&quot;
        set SEMI_ASCII[6]   = &quot;6&quot;
        set SEMI_ASCII[7]   = &quot;7&quot;                                                                                 
        set SEMI_ASCII[8]   = &quot;8&quot;
        set SEMI_ASCII[9]   = &quot;9&quot;
        loop
            exitwhen loopA &gt; 65
            set SEMI_ASCII[loopA] = &quot;!&quot;
            set loopA = loopA + 1
        endloop

        set SEMI_ASCII[65]  = &quot;A&quot;
        set SEMI_ASCII[66]  = &quot;B&quot;
        set SEMI_ASCII[67]  = &quot;C&quot;
        set SEMI_ASCII[68]  = &quot;D&quot;
        set SEMI_ASCII[69]  = &quot;E&quot;
        set SEMI_ASCII[70]  = &quot;F&quot;
        set SEMI_ASCII[71]  = &quot;G&quot;
        set SEMI_ASCII[72]  = &quot;H&quot;
        set SEMI_ASCII[73]  = &quot;I&quot;
        set SEMI_ASCII[74]  = &quot;J&quot;
        set SEMI_ASCII[75]  = &quot;K&quot;
        set SEMI_ASCII[76]  = &quot;L&quot;
        set SEMI_ASCII[77]  = &quot;M&quot;
        set SEMI_ASCII[78]  = &quot;N&quot;
        set SEMI_ASCII[79]  = &quot;O&quot;
        set SEMI_ASCII[80]  = &quot;P&quot;
        set SEMI_ASCII[81]  = &quot;Q&quot;
        set SEMI_ASCII[82]  = &quot;R&quot;
        set SEMI_ASCII[83]  = &quot;S&quot;
        set SEMI_ASCII[84]  = &quot;T&quot;
        set SEMI_ASCII[85]  = &quot;U&quot;
        set SEMI_ASCII[86]  = &quot;V&quot;
        set SEMI_ASCII[87]  = &quot;W&quot;
        set SEMI_ASCII[88]  = &quot;X&quot;
        set SEMI_ASCII[89]  = &quot;Y&quot;
        set SEMI_ASCII[90]  = &quot;Z&quot;
        set SEMI_ASCII[101] = &quot;e&quot;
        set SEMI_ASCII[104] = &quot;h&quot;
        set SEMI_ASCII[110] = &quot;n&quot;
        set SEMI_ASCII[111] = &quot;o&quot;
        set SEMI_ASCII[117] = &quot;u&quot;
        set loopA = 118
        loop
            exitwhen loopA &gt; 8191
            set SEMI_ASCII[loopA] = &quot;@&quot;
            set loopA = loopA + 1
        endloop
    endfunction

Edit: Even with the values from A000 to A009 I get strange results...
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Test with real RawIDs, randomizing between 'Axxx' and 'Ayyy' won't work, since you then randomize over all 256 ASCII characters instead of the 36 that Blizzard uses.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top