• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Hashtables..

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
Hey.. i just noticed when i tried saving stuff with hastables, it doesnt show what is what, and i realised i could try look what happends if i convert it from gui to jass, and well.. it uses a BJ, so i didnt use it.
what does each number mean?:
JASS:
call SaveInteger(GetLastCreatedHashtableBJ(), 0, 1, 2 )

And another question.. is this line from table correct?:

Why hashtable? Basically, hashtable keeps all those advantages for gamecache but it is also quite fast. Theory has it that it is just 2x times an array usage...

Thanks in advance.
 
You want to consult the API function list for natives, found in your JassHelper or by extracting common.j from your war3patch.mpq archive located in the warcraft 3 folder.

To answer your question, SaveInteger operates like this:

Save(Type) - The type of data you want to save. It can be (unit) (widget) (real) almost all the important ones.

For the first two integers, think of it like a Bingo board. B-I-N-G-O.

The columns are the parent keys, the rows are the child keys. In GUI, the parent keys come after the child keys, in native JASS, the parent keys come first.

The third value is the type of data you're saving. In GUI this comes before the parent and child keys. GUI basically reverses the native process of "Save Into Hashtable Into Parent Key into Child Key the value X" into "Save value X into Child Key into Parent Key into Hashtable"
 
Level 11
Joined
Sep 12, 2008
Messages
657
Oh, thx, well, it works =] i just found another prob.. how do i loop backwards? XD
like, if i ussualy made a loop doing this:
1, 2, 3, 4
i want it to be:
4, 3, 2, 1
from top to bottom, or bottom to top.. how would i do it?
this is what i tried:

JASS:
local integer count = 0
//instanceCount is the count of all data in total.
            if TopToBottom then
                set count = instanceCount
            endif
            
            loop
            if not TopToBottom then
                set count = count + 1
                
                exitwhen count == instanceCount
            else
                set count = count - 1
                
                exitwhen count == 0
            endif
            
            endloop

Edit: exedently pressed post,
anyway, the problem is this:
it will allway go in same order (tried BJDebugMsg, showed same order, whether its true of false)

Thanks in advance.
 
Level 11
Joined
Sep 12, 2008
Messages
657
Well.. from first sight.

look:

JASS:
    set end = 0
    set step = -1
endif
loop
    exitwhen count > end

look at this you'll see alone whats wrong xD
and if you ask, yeah i tried it. false worked, true showed nothing.
 
Let me show you an example as I think I got started in the wrong place.

Loop from 0-10
JASS:
local integer i = 0
loop
    call BJDebugMsg(I2S(i))
    exitwhen i == 10
    set i = i + 1
endloop

JASS:
local integer i = 10
loop
    call BJDebugMsg(I2S(i))
    exitwhen i == 0
    set i = i - 1
endloop

You can see the difference between these two, so you can also set the difference.

JASS:
local integer start = 0
local integer i
local integer end = 10
local integer step = 1
if reverse then
    set start = 10
    set end = 0
    set step = -1
endif
set i = start
loop
    call BJDebugMsg(I2S(i))
    exitwhen i == end
    set i = i + step
endloop
 
Level 11
Joined
Sep 12, 2008
Messages
657
Okay.. i think this time im the problem, with the small edit i've done, please take a look at this, since i have to go..

http://www.hiveworkshop.com/forums/pastebin.php?id=4w4pqy

please ignore the info code, its not correct too much.. and not too finished either,
thanks in advance.

Edit: i realised i forgot to change name..
it is INTEGER stack, not improved =]
because im gonna do BUFF stack, and REAL stack.. so i forgot its not improved.. (was gonna do a textmacro, then changed my mind)
well didnt mean any harm.. and im aware that the original stack is actually alot better. [This is for statistics TBH]
 
Status
Not open for further replies.
Top