HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Zinc] Need help with structs.

10-18-2010, 06:40 AM#1
Novynn
I was reading up about Zinc and a lot of things appealed to me a whole lot more than coding in vJASS, so I thought I'd give it a try. I started off with what I thought would be a simple trigger, using operators and structs to store a players name in a more OOP-like manner.

Here's what I came up with:
Expand Zinc:


Now the intention of this is to return the players name using the handy new OOP system whenever he or she speaks. But it does not... instead it outputs the name of the last player setup (player 11 in this case). This suggests that the playerData array is just overwriting itself. I thought it might be because I hadn't used ".create()" for the playerData struct, but when I try to make the playersData struct like this:
Expand Zinc:

It throws and error declaring "Undeclared variable this" on the line set s___Init___playersData_Player[s__Init___playersData_Player[this]+x]=s__Init___playerData__allocate()


If anyone could point me in the right direction I'd be eternally grateful.
10-18-2010, 01:07 PM#2
Vexorian
Hmnn, your syntax error is because you are using a non-static member inside a static method. Yeah , I think it should detect those errors before converting the code... But it does not, so we'll have to live with it.

Just declare the "Player" array member as static.