Do you use these 2 lines in the same trigger or in 2 different triggers?
Because (last created unit) will change over time and might be reset to "no unit" once the next trigger is started.
Lol I just realised I forgot to create the hashtable. Sorry about the silly mistake. Thanks
BTW how do you guys organize your hashtables?
I saw one of you comments another post about string keys or something like that.
I currently sort them by spells but I saw others use a hashtable for each type of variable.
It would be good to get your opinion before my map got too big
Essentially, if you know what you're doing, you probably only need one hashtable for the whole map.
But if you're a lil perfectionist, you can segregate your hashtables into different types of variables. This way you don't need to create one hashtable for every spell you do.
> It would be good to get your opinion before my map got too big
The map won't go too big with the amount of hashtables you have. It's just that there is a limit as to how many hashtables you can have in a map. Once you exceed the limit, they won't work as intended.
My advice:
Use one hashtable for each variable type.
Use the method "Hashtable - Get String ID" to convert a string to an integer ID to be used in a hashtable.
By the way, whether you use integers directly or use strings does not matter. The performance and memory consumption should be equal. Its just that strings are easier to comprehend then raw numbers.
I think I will use the one hashtable for my whole map. I used the get String ID it looks like this
Trigger:
Hashtable - Save beam_distance as (Key (String(beam_angle))) of (Key (Picked unit)) in beam_hash
I used get string ID and then converted real into a string. What happens if my real is the same number as another real? Does it return the same key string?
Im looking at tutorials and resources section but I can't get in. The link must be faulty or there is something wrong with my computer. So while we are still talking about hashtables, how do I remove leaks?
> Im looking at tutorials and resources section but I can't get in.
It's not your problem. It's something wrong with the link itself. Since the site upgrade, many things are not well organised. It should be corrected soonish... I hope. Use this link: http://www.thehelper.net/forums/tutorials-and-resources.67/
To clean hashtable data, just clear the child hashtable of your desired key handle.
I used the get Hashtable - string ID (angle) of key of (unit).
However when I use another ability that also uses the variable angle from the hashtable, its all messed up.
Are the get string ID of the same real variable overwriting each other?
Converting a string to a hashCode might not return the same value for strings with equal content. If you want to use a real you are a little bit out of your luck, but on the other hand, you are probably using it wrong in the first place. There should never ever (or rather: very very rarely) be a reason to use a real for a key.
Im trying to save the angle which is a real. I read somewhere that instead of using integers like
save angle as 1 of key[unit]. I thought I could change the 1 to something else easier to understand.
Sorry, I didn't really understand how to do it.
Look, a hashtable is a data structure you use to store your data in a way that you can easily access it.
You use 2 keys to identify 1 value.
In this case you want to store some kind of angle in the map. But if you also use the angle as a key it would mean that you need to know the angle before you can load it from the map again. This is kinda pointless. Because if you already know the angle you dont need to load the angle from the map again. Its redundant information.
I think what you want is to use the string "angle", not the string String(angle).
The first one is "angle", the second one is, e.g., "0.04" or "34.0", depending on the angle.
You can also think of it like this: The keys are the name of the book and the chapter in which your data is written down.
I'm on a page about incorrect corrections, and spent the better part of like two hours trying to get someone to understand that -5^2 = -25, not 25, and then that post had comments get reposted because that group is self sustaining, and that person was in turn trying to explain what I just explained to them. And I'm taking that as a victory
I will be AFK for a couple of days you guys hold down the fort while I am gone. I will be checking in on my phone but that will severly limit me. Be back saturday!
I just got to watch the video because even though I was there I was trying to work out tech problems with the chat since I was the social media guy so I was distracted but check it out guys the video is super fucking great!