System Bars

Deaod

Member
Reaction score
6
1.) Perhaps, yes.

Then what can the best be described as?
Im sorry, you lost me there. What do you want me to describe?

It has construction.
Which is an irrelevant feature of a bar. Make a separate library for that, which deals specifically with the problem of associating a bar to a construction process.
 

Sevion

The DIY Ninja
Reaction score
413
2) I want everyone to use what is best (ideally there should only be one library).

Why would I make a separate library?

Do you mean the library should only deal with the creation of a bar, the movement of a bar, and the value of a bar and other libraries/modules implement features such as health, mana, construction, and custom tracking?
 

Deaod

Member
Reaction score
6
Why would I make a separate library?
As i said a few sentences later, when all else (talking the coder of the current "best" into adding a feature) fails and the current "best" library does not have an important feature, you should probably write your own.

Do you mean the library should only deal with the creation of a bar, the movement of a bar, and the value of a bar and other libraries/modules implement features such as health, mana, construction, and custom tracking?
Exactly. You dont need to mix code for those things. They can be implemented outside the library at a very low cost of performance.

Btw, why did you include support for locking the bar to an item or a destructible? Both cant move on their own.
 

Sevion

The DIY Ninja
Reaction score
413
Atm, I'm very busy, but I'll reply to that last line for now, will edit for more later.

I added items and destructables because what if units pick up the item/destructable? It then starts moving.
 

Nestharus

o-o
Reaction score
84
JASS:
                set this.Mixed.red = R2I(RAbsBJ(this.Color1.red*(1-ratio)-this.Color2.red*ratio)+.5)
                set this.Mixed.green = R2I(RAbsBJ(this.Color1.green*(1-ratio)-this.Color2.green*ratio)+.5)
                set this.Mixed.blue = R2I(RAbsBJ(this.Color1.blue*(1-ratio)-this.Color2.blue*ratio)+.5)


this can be this.mixed.asMix(this.Color1, this.Color2, ratio)

And ???
JASS:
    //! textmacro Bar__CONFIGURABLE_GLOBALS
        private constant string BAR_CHAR = "'"
        private constant integer NUM_CHARS = 30
        private constant integer NUM_CHARS_CONSTRUCTION = 80
        private constant real BAR_SIZE = 11.00
        private constant real X_OFFSET = -35.00
        private constant real Y_OFFSET = -40.00
        private constant real Y_OFFSET_MANA = -14.00
        private constant real X_OFFSET_CONSTRUCTION = -65.00
        private constant real Y_OFFSET_CONSTRUCTION = -40.00
        private constant real X_OFFSET_CUSTOM1 = -35.00
        private constant real Y_OFFSET_CUSTOM1 = -40.00
        private constant real X_OFFSET_CUSTOM2 = -35.00
        private constant real Y_OFFSET_CUSTOM2 = -40.00
        private constant real X_OFFSET_CUSTOM3 = -35.00
        private constant real Y_OFFSET_CUSTOM3 = -40.00
        private constant integer BACKGROUND_RED = 10
        private constant integer BACKGROUND_GREEN = 10
        private constant integer BACKGROUND_BLUE = 10
    //! endtextmacro


Create bar config structs or something and just pass those in... one global configuration to be forcefully applied to all bars seems stupid.. you also don't have comments around your configuration variables to explain what they do. For example, I get offset, but what is custom1 through custom3???

There is this too..

JASS:
    //! textmacro Bar__GetCustomData1
        set i = GetUnitUserData(this.unit)
    //! endtextmacro
    //! textmacro Bar__Custom1EndCondition
        set b = this.max - 1 < T32_PERIOD
    //! endtextmacro
    //! textmacro Bar__GetCustomData2
        set i = GetUnitUserData(this.unit)
    //! endtextmacro
    //! textmacro Bar__Custom2EndCondition
        set b = this.max - 1 < T32_PERIOD
    //! endtextmacro
    //! textmacro Bar__GetCustomData3
        set i = GetUnitUserData(this.unit)
    //! endtextmacro
    //! textmacro Bar__Custom3EndCondition
        set b = this.max - 1 < T32_PERIOD
    //! endtextmacro


And what is up with your custom stuffs? For customs, users can just use a location + an interface for the ratio.. seriously : P.

And really, because you can avoid interfaces and what not, you can just make them call a method with their values and pass their function into the timer...

JASS:
private static method periodic takes nothing returns nothing
    call bar.update(x, y, ratio)
endmethod

public static method create takes nothing returns thistype
    call Bar.create(this, function thistype.periodic) //will auto add to a timer and start if function thistype.periodic not already added
    //or you can use struct types like onInit { thisType = Bar.getType(); } and then 
    //create(this, function thistype.periodic, thisType)
endmethod



Furthermore, mixed should be static..
 

Deaod

Member
Reaction score
6
I added items and destructables because what if units pick up the item/destructable? It then starts moving.
Destructables cant be picked up, AFAIK.
Attaching to items could be externalized, as items cant move and can only be moved by a unit (and code). If the item you want to follow is in a units inventory, attach the bar to the unit.
Changing an items position could be captured using hooks (same applies to destructables).
 

Sevion

The DIY Ninja
Reaction score
413
Destructables can be picked up using the Grab Tree ability.

Items can be moved out of the loop, that is right... Hmm. I would need to add some sort of Update function. Hold on, I'll rewrite a few things quick.

Nes, the only reason I was using my own asMix was because I haven't updated the code yet to show the .asMix use. I had it earlier, but you remember your little.... problem...

Edit: I won't be able to update stuff for a while. I'm going on vacation until July 10.
 

Sevion

The DIY Ninja
Reaction score
413
Sorry for not updating anything. I really haven't worked on it, but this is what I have done:

JASS:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~ Bars ~~ By Sevion ~~ Version 2.0.0.0 ~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//  What is Bars?
//          -A sandbox for creating floating bars.
//
// Configurables:
//
//  API:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Be amazed at the amount of work I did in the long period of time.....

But yes, I am taking your advice and making this very modular. Bars itself will basically be a sandbox with many mini-libraries (modules) to add functionality with Bars only having the very very core components.

Hopefully it's a bigger success than this is atm.
 

Sevion

The DIY Ninja
Reaction score
413
Currently, Mana tracking is implemented into the core.

JASS:
call Bar.createOnUnit(GetTriggerUnit(), TRACK_TYPE_MANA, 0, Color.create(0,0,255), 0)


That will change with the 2.0 update.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top