Arrays and MUI

W!†A_cRaft

Ultra Cool Member
Reaction score
28
How do they actually function, i mean i know what an array is i know what they represent i know all that kind of stuff but i do not know how should i use them to make things happen the way i want them.

I am currently using Hashtables binding things to timers through JASS and that allows me to use them in other functions as locals making things MUI, but there are certain problems that i cannot overcome, i posted one of them in JASS section few minutes ago.

Also since people claim it is better to use arrays i am wondering why and how? How to replace hashtable functions with arrasy etc.
 

crazyfanatic

New Member
Reaction score
20
the array is an extention of a variable, and makes life easier than making much variables. To use it for MUI you can simply set the variable with array (always integer number) to the player number of any player. As long as each player has 1 way to trigger the variable settings, you wont need to add more actions.
 

Moridin

Snow Leopard
Reaction score
144
^ What crazyfanatic described is MPI unless I misread something.

How to have MUI using arrays:

If you have the necessary variables as arrays of a certain size (something like 50 should be enough, as more than 50 units casting an ability at the same time is almost impossible under normal circumstances)

...and along with those arrays an integer variable that acts as a counter, you can use these to enable MUI.

Basically, when you imprint the necessary values needed for a spell into the variable arrays, the location of the array (array [LOCATION]) is defined by the counter integer variable, which keeps cycling from 1 to 50 and then back to 1 and so on.

This allows you to store 50(or whatever limit) sets of ability values that are needed for a cast....which would in turn allow for 50 casted abilities without one value overwriting the past values.

I hope my explanation was somewhat clear. In my opinion hashtables are easier to use than arrays to enable MUI and are also more powerful in certain ways. However, I'm pretty sure arrays are faster for the engine than hashtables.

If you want an example of array MUI, I'm pretty sure any of the spells made by Glenphir in his spell request thread use them, as his hashtable functions are bugged for some reason.
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
okay about that 50 variable arrays, but lets say i need caster/target/damage/dummy/position and few more thigns stored, i need to create a variable for each of those things? than get the date by indexing in the For Integer A loop 1 -50?

Also how to make them in JASS?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
This is where vJASS makes things much easier...

For this, you only need to store one thing, and that's a struct.
But, in that struct you can store as many values as you want...

I'd suggest you read up on some v/JASS tutorials ;)
 

Moridin

Snow Leopard
Reaction score
144
i need to create a variable for each of those things?

Pretty much. This is why I find hashtables a bit more efficient in GUI. Also JASS is an obvious solution here...but there I can't help you (I don't know a hint of JASS).
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
i am familiar with structs, but why would i store strcuts into arrays than if i can store everything in a struct i dotn need arrays, i only need to store 1 struct per instance. However i do not know how to store structs :D
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
you cannot use structs in GUI nor in vJass

structs are only usable in vJass
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
ye but i dont know how to use them in jass :D dont know how to code them
they are a new type of "variable" but what are their options/methods....that i do not know
 

Rushhour

New Member
Reaction score
46
Structs are no magically new handle or whatever you might think.
They do the "indexing" for you. When Jass Helpers compiles the struct it turns all the variables inside the struct to arrays. The index for these arrays is set when the struct is created/allocated and is always unique (you will never have more than 8100 instances running the same time ^^ )

You also can use static members (variables,methods) which behave like "normal" (struct)global variables/normal functions.
As far as I know you can also have normal non-static arrays inside a struct, which are compiled like GUI- pseuda 2D-arrays.

But I haven't used structs myself, I think it's not worth the effort if I only need 2 instances of a function running the same time, so I'm not sure what else you might be able to do but spells. Read the Jass Helper manual or one of those thousand tutorials.
(e.g.: http://clanbom.com/forum/viewtopic.php?f=52&t=421&sid=32035eaaa0e482c74b8f5c873bc17c2b)
 

W!†A_cRaft

Ultra Cool Member
Reaction score
28
I am not familiar with these static/non-static members, I am somewhat new to JASS, i know what a struct is, by definition but the only use i see for it is making few variables into a single variable, i know the struct has it's own function (they are called methods correct?) and that it can have other functions in it, but i do not know anything else, including how to make one.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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