HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[script] Board (Multiboard Decorator)

11-05-2009, 08:34 AM#1
Earth-Fury
Edit:

Submitted as a resource here.

End of Edit.

I was bored, so I coded Board. Board is a fancy decorator library for multiboards, to hopefully make them easier to work with. I use the word "Decorator" because I think it will create less of a "Burn him!" reaction than the word "wrapper".

Any of the [] operators accept out-of-bounds values. they will grow the multiboard to a size that will include the refered to index. (This doesn't work for < 0, of course...)

Because of some magic hackery, you never have to destroy BoardRow, BoardColumn, or BoardItem structs. You simply have to destroy the Board struct that created them. Rows, items, and columns are not affected by the 8190 limit, so spam multiboards to your hearts content. (Though, this limits what features I can add to the system... possibly. Hashtables may come to the rescue.)

The convenient list of methods/properties in the library is the only documentation this has for now.

Enough of me blathering on, barring this: Please, post questions/comments/concerns/criticism! :)

The library: (Requires ARGB)
Expand Board:

Edit:

Few talking points / questions:
- Do you think it would be useful to be able to easily insert/remove rows and columns from the beginning and middle of a multiboard, instead of just to/from the end? (Would slow down all operations slightly.)
- Should visibility per-player be handled by the system?
- Should those operators in BoardItem really be named .x and .y?
11-05-2009, 08:39 AM#2
Anachron
Nice one thanks a lot. I actually needed this for my new AoS.
(I was thinking about making the same thing, but yours is better.)

Now I only need to make the generation script! :)

Quote:
Enough of me blathering on, barring this: Please, post questions/comments/concerns/criticism! :)
Well, and what if we don't have any? I guess the code is perfect, but I will look over it, maybe
I find a question or such.

Oh one thing: What is keyword for? I have seen it a lot but I still don't get what its used for.
11-05-2009, 08:47 AM#3
Earth-Fury
Quote:
Originally Posted by Anachron
Oh one thing: What is keyword for? I have seen it a lot but I still don't get what its used for.

private keyword something Causes the specified keyword to be made library-private. That is to say, you can not use those things outside of the library.

It is also used to fix a shortcoming in JASS Helper: you can not use a private variable/function/etc before it is declared. You can fix this by declaring it as a private keyword above where you use it.
11-05-2009, 08:50 AM#4
Anachron
I see, thanks alot.

One thing though: How can you allow the user to call functions without the librarys name? (While these functions are inside the library).
11-05-2009, 09:00 AM#5
Earth-Fury
Quote:
Originally Posted by Anachron
One thing though: How can you allow the user to call functions without the librarys name? (While these functions are inside the library).

"public" for functions, globals, and I think struct name as well, makes them available outside the library, but only if they are prefixed with the libraries name followed by an underscore.

"private" makes them no available outside the library.

no "public" or "private" makes them available outside the library, without prefixing them.

Within a struct (that is, for methods and members of a struct) "public" means the same as a lack of "public" or "private". (There is no prefixing within structs, as that would make no sense.)

If that's what you where asking. It can be hard to tell <.<
11-05-2009, 09:05 AM#6
Anachron
Collapse JASS:
library test
    function stuff takes nothing returns nothing
    endfunction
endlibrary

Quote:
"public" for functions, globals, and I think struct name as well, makes them available outside the library, but only if they are prefixed with the libraries name followed by an underscore.
so its "test_stuff".

Quote:
"private" makes them no available outside the library.
Ok.

Quote:
no "public" or "private" makes them available outside the library, without prefixing them.
So its "stuff".

Quote:
Within a struct (that is, for methods and members of a struct) "public" means the same as a lack of "public" or "private". (There is no prefixing within structs, as that would make no sense.)
Yeah.

Quote:
If that's what you where asking. It can be hard to tell <.<
Exactly. Thanks for the afford. I was wondering. Now I can overwork most of my systems which should have easily access.
11-05-2009, 11:04 AM#7
Anitarf
Just a quick comment on the documentation:
Quote:
board.[x][y] -> BoardItem
Isn't that supposed to be board[x][y] -> BoardItem?
11-05-2009, 11:18 AM#8
Earth-Fury
Quote:
Originally Posted by Anitarf
Just a quick comment on the documentation:

Isn't that supposed to be board[x][y] -> BoardItem?

Yes. Yes it is.

Also, I forgot that multiboard items are retarded in that MultiboardGetItem() returns a new handle on every invocation, even if an item for that cell exists... also, the items aren't cleaned up with the board... soo, that will be fixed in my next revision.
11-05-2009, 01:45 PM#9
Rising_Dusk
Quote:
Originally Posted by Earth-Fury
Collapse JASS:
board.[x][y] -> BoardItem
Is there any similar syntax for boardicons?
Collapse JASS:
board[x][y].item = "53"
board[x][y].icon = "ReplaceableTextures//..."
Like that?

Also, write serious documentation and submit this shit. Call it "MultiboardHelper" and you're gold.
11-05-2009, 02:23 PM#10
Anitarf
Quote:
Originally Posted by Rising_Dusk
Is there any similar syntax for boardicons?
Collapse JASS:
board[x][y].item = "53"
board[x][y].icon = "ReplaceableTextures//..."
Like that?
There's no .item member for BoardItems, at least judging by the documentation, these are the only members available:
Collapse JASS:
set board[x][y].icon = "ReplaceableTextures//..."
set board[x][y].text = "foo"
set board[x][y].color = 0xFFFFFFFF
set board[x][y].width = 0.12
call board[x][y].setDisplay(true, true)

Hmm, maybe the setDisplay method could be replaced by textShow and iconShow boolean operators instead to match the rest of the syntax?
11-05-2009, 02:24 PM#11
Rising_Dusk
Oh, okay, so it uses .text, fair enough. I must've missed that.
11-05-2009, 08:24 PM#12
Earth-Fury
Quote:
Originally Posted by Anitarf
Hmm, maybe the setDisplay method could be replaced by textShow and iconShow boolean operators instead to match the rest of the syntax?

Problem is that doing that would require storing both those booleans somehow, as setting one requires setting the other, and there is no getter function. As-is, nothing can be stored, as all the structs are by-value.

Though, I have been thinking about ways to store data for items in a hashtable... So it's still a possibility.

Quote:
Originally Posted by Rising_Dusk
Also, write serious documentation and submit this shit. Call it "MultiboardHelper" and you're gold.
I plan to. Posted here as it's really not close to being approval ready yet, and I CBF to make a pretty thread for it until it is.
11-05-2009, 08:44 PM#13
MindWorX
Awesome system!
11-05-2009, 08:48 PM#14
Anitarf
Quote:
Originally Posted by Earth-Fury
Problem is that doing that would require storing both those booleans somehow, as setting one requires setting the other, and there is no getter function. As-is, nothing can be stored, as all the structs are by-value.
Ah, nevermind then, it's fine the way it is.
11-05-2009, 11:57 PM#15
Bobo_The_Kodo
Definately allow local stuff, it is useful quite often
Same with removing and adding rows to middle
x&y are fine names