- Joined
- Feb 25, 2013
- Messages
- 16
I've run into some problems with regions and hashtables...
What I'm trying to achieve:
The map I'm creating has 4 regions per player. These are manually created via the World Editor and named "Player0n, player0s, player0e, player0w" and so on.
To prevent all the manual labour I want to access the udg_ for each region, and add it to a hashtable.
My understanding is that I need the handle (an integer afaik), so I build the different region names and use StringHash(regionName).
However, I'm getting syntax errors on every SaveRectHandle.
Is what I'm trying to achieve impossible?
What I'm trying to achieve:
The map I'm creating has 4 regions per player. These are manually created via the World Editor and named "Player0n, player0s, player0e, player0w" and so on.
To prevent all the manual labour I want to access the udg_ for each region, and add it to a hashtable.
My understanding is that I need the handle (an integer afaik), so I build the different region names and use StringHash(regionName).
However, I'm getting syntax errors on every SaveRectHandle.
Is what I'm trying to achieve impossible?
JASS:
function Trig_AddRegions_Actions takes nothing returns nothing
local hashtable rgnTable = InitHashtable()
local string rgnPrefix = "gg_rct_Player"
local string rgnName = rgnPrefix
local integer i = 1
loop
set rgnName = rgnPrefix + I2S(i)
call SaveRectHandle(rgnTable, i, 0, StringHash(rgnName + "n"))
call SaveRectHandle(rgnTable, i, 1, StringHash(rgnName + "s"))
call SaveRectHandle(rgnTable, i, 2, StringHash(rgnName + "e"))
call SaveRectHandle(rgnTable, i, 3, StringHash(rgnName + "w"))
exitwhen i > CountPlayersInForceBJ(GetPlayersByMapControl(MAP_CONTROL_USER))
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_AddRegions takes nothing returns nothing
local trigger gg_trg_AddRegions = CreateTrigger( )
call TriggerRegisterPlayerChatEvent(gg_trg_AddRegions, Player(0), "TEST", true)
call TriggerAddAction( gg_trg_AddRegions, function Trig_AddRegions_Actions )
endfunction