[Tutorial] Variables, Arrays, Hash Tables - An Overview

Post your own tutorials, guides and demos.

Post » Sat Feb 19, 2011 4:57 pm

I just finished your tutorial. Finally, I can say I understand a hash array :D . I've never knew why should I use hash over normal array, but here it's nice and clear example.
I have one little thing, could you comment(explain) conditional action for mouse wheel up event? I've never used it and wiki expressions example makes me more confused.

EDIT:nevermind - found a good explanation here
last post on the first page
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Fri Apr 15, 2011 12:04 pm

As promised, here is another example using hash tables. This time I present one possible way of supporting multi-language-games. The languages are stored in hash tables sharing the same keys. Furthermore, the use of a hash table to randomly select items, while every item is only selected once, is shown here.

Most of the time people will use a system similar to this:
1) Generate a random number
2) Compare it with the previously generated random number
3) If they match, repeat from step 1
4) Finally after millions of repetitions, the numbers don't match and stuff can be done

The hash table approach doesn't need that, as every key that was used is deleted from the hash table, and the random number is always generated based on the number of keys left.

The .rar file contains a cap and three language files (aka saved hash tables) and the events of the cap are extensively commented.

[size=150:lmtcgq3i]Download: LanguageExample.rar[/size:lmtcgq3i]

I hope it is a useful example :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Apr 18, 2011 2:04 pm

Thank you, it's well commented. I'll read it when I get home.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Previous

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest