Rllulium
New Member
- Reaction score
- 10
In an attempt to teach myself how to utilize trackables, I tried to fill a small area with trackables earlier. I thought I would then make a simple click to move test to see if it worked as I wanted. The problem that I have run into however, is that the game freezes when I try to to create more than roughly 60-100 trackables in one go. For reference, here is the code I am using; I was hoping that someone can point out something that I am doing wrong here:
JASS:
library TrackTest uses Trackable2
globals
private constant string modelPath = "Doodads\\Terrain\\InvisiblePlatformSmall\\InvisiblePlatformSmall.mdl"
private constant real size = 73.59
private Trackable2 temp
endglobals
struct data
//Set in Create function
rect zone
real minX
real maxX
real minY
real maxY
//Used in methods
boolean done = false
integer rowCount = 0
real x
real y
method AddRow takes nothing returns nothing
local integer i = 0
set .y = .minY + size/2 + .rowCount*size
loop
set .x = .minX + size/2 + i*size
set temp = Trackable2.create(modelPath, .x, .y, 0, 0)
call temp.registerAnyClick(Click)
call temp.registerAnyTrack(Track)
set i = i + 1
exitwhen i*size >= .maxX - .minX
endloop
set .rowCount = .rowCount + 1
set .done = .rowCount*size >= .maxY - .minY
endmethod
method FillRect takes nothing returns nothing
loop
call .AddRow()
call BJDebugMsg("Row Complete")
exitwhen .done
endloop
endmethod
endstruct
public function Create takes rect area returns nothing
local data new = data.create()
set new.zone = area
set new.minX = GetRectMinX(area)
set new.maxX = GetRectMaxX(area)
set new.minY = GetRectMinY(area)
set new.maxY = GetRectMaxY(area)
call new.FillRect()
call new.destroy()
endfunction
endlibrary