[GUI Interface] UnitIndexing

SerraAvenger

Cuz I can
Reaction score
234
A simplistic interface for unit indexing systems. Will be expanded once there are more systems with more features.

Please don't use any indexing systems directly, always use an appropriate interface!


API
UnitGetIndex( u ) -> int, change this to return the value of a function from a unit indexer. Should return a unique index to use with arrays and similar stuff.
UnitGetByIndex( i ) -> unit, change this to return the unit associated with an index. u == UnitGetByIndex( UnitGetIndex( u ) ) should always be true.
CustomValueGet() -> int, change this to return the value of a function from a unit indexer. Should return a unique index to use with the GetUnitCustomValue function.


Please also see...
SerraUnitIndexing, a unit indexer


How to use this?
Always use this with an appropriate unit indexer. A good example is SerraUnitIndexing, which was designed to be used with this.
When you have this library imported, change it's library id to "saii". Then import any other library that requires this library.

- Using the SerraUnitIndexing library
First, import the SerraUnitIndexing library.
Then, change the SerraUnitIndexing library id to "saui" (serra avenger unit indexing).
Then, import this library, and you're done.

- Using another library
First, import the library you want to use.
Then, search that library's API for the functions that do what the functions in this interface do.
Import this library.
Go to the functions from this library, go to the "actions" definition and look for a "return (val)" statement. Change the value in that return statement to the function you want to use, and pass all parameters accordingly.
You might want to go into raw mode (by pressing ctrl+d) in order to change the functions, since many galaxy-oriented programmers are always in raw mode.

From then on, simply use "Get Unique Unit Index" and "Allocate Unique Custom Value" in the GUI (or the functions from above if you're in raw mode).

FAQ
Q< I put this into my map, but nothing happened?
A> This is just an interface. It doesn't do anything itself. In order for it to do something, you need a piece of software that does it. Then you must tell the interface to use the software.

Q< Why use this then?
A> Imagine you're using PerfectUnitIndexing (without any interface). You import a library that uses AutoIndexer (without any interface). Those libraries conflict, you can't use them.
Now, Imagine you're using PerfectUnitIndexing (without any interface). You see that AutoIndexer is a lot better. Have fun searching your code for every appereance of "PerfectUnitIndexing" and changing it to the correct "AutoIndexer" function!
SOLUTION: Don't use these libraries directly. Instead, only use an interface. Due to using the functions of the interface only, external code (that's using the same interface) will always work in your map no matter which system you use in the background. If you want to change the system, just tell the interface to use the new system - and your code will still work!

Q< I tried using this with SUI. I Imported SUI, then I imported this, but the map doesn't compile/save/work?!?!
A> Did you change the library id of SUI to "saui" (serra avenger unit indexer)?

Q< What is a library id?
A> It is a unique identifier used for making code harder to import, harder to use in galaxy, and just making your code look stupid. It's one of Blizzard's inventions.

Q< I meant, how do I change it?
A> Right click on your library, go to "Library" in the context menu, and click on "Change Libary Id" or something. A window should open where you'd click a check box, select the upper line (where you don't generate a random hex number) and enter 4 characters. For SUI, it should be saui. For the SerraAvenger TeamLib, satm. If it is needed, it should say it in the thread.

Changelog
6/18/2010 - Added support for UnitGetByIndex functions!
 

Attachments

  • UnitIndexing.SC2Lib
    4.6 KB · Views: 355
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top