• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Text Macros Not Working

Status
Not open for further replies.
Level 6
Joined
Jan 13, 2013
Messages
130
I've started working on updating an old RPG and some of the systems don't seem to be quite functional. I've got the map compiling and I've been able to make some simple changes but when getting to larger tasks like adding new abilities I've run into a bit of a wall. There are a few systems like BuffStruct that seem to use text macros and possibly objectmerger to generate the object data for spells/buffs straight from the triggers but they aren't working. Nothing new generates even when I save, close, open, save again, run as administrator, run in windows xp compatibility, restart my computer etc. Even if I delete an existing ability it won't regenerate the ability from the code, nor does it work from the test map in the BuffStruct thread. I'm really scratching my head on whats wrong. Below is one of my attempted abilities and I'll put one of the ones already in the map below that.

vJASS:
//! runtextmacro BuffType("HungryPseudopods")
    //! runtextmacro SetBuffName("Hungry Pseudopods")
    //! runtextmacro SetBuffAlignment("NEGATIVE")
    //! runtextmacro SetBuffTooltip("Being dissolved by pseudopods.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\PassiveButtons\\PASBTNPoisonSting.blp")
//! runtextmacro BuffStruct()
    unit caster
    unit target
    integer abilId
    integer armor
    method onCreate takes nothing returns nothing
        set this.abilId = BuffAbilId
        set this.caster = BuffCaster
        set this.target = BuffTarget
    endmethod
    method onApply takes nothing returns nothing
        set armor = GetUnitAbilityLevel(this.caster,this.abilId)*1
        call Status[this.unit].modArmorBonus(-armor)
   
    endmethod
    method onRemove takes nothing returns nothing
        call Status[this.unit].modArmorBonus(armor)
    endmethod
//! runtextmacro EndBuff()

vJASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! runtextmacro BuffType("CalamitousGaze")
    //! runtextmacro SetBuffName("Calamitous Gaze")
    //! runtextmacro SetBuffAlignment("NEGATIVE")
    //! runtextmacro SetBuffTooltip("Bad luck gets you hurt.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNEyeofblood.blp")
//! runtextmacro BuffStruct()
    unit caster
    unit target
    integer attackSpeed
    method onCreate takes nothing returns nothing
        set this.caster = BuffCaster
        set this.target = BuffTarget
    endmethod
//! runtextmacro EndBuff()

However I've also noticed that the colours of the text appear to be different from those in my editor. I've attached an image of it below.
 

Attachments

  • editor.PNG
    editor.PNG
    22.7 KB · Views: 104
Level 37
Joined
Jul 22, 2015
Messages
3,485
I know close to none about //! runtextmacro, but I just wanted to point out that:
However I've also noticed that the colours of the text appear to be different from those in my editor.
No need to worry about that. Colored syntax is merely a preference to the user. If you using a version of TESH older than looking_for_help's, then you can easily change it from the Options menu.
 
Level 6
Joined
Jan 13, 2013
Messages
130
Can you upload the textmacro declarations?

The place where it says
JASS:
//! textmacro BuffType takes name
blablabla
//! endtextmacro
It looks like those are at the beginning and end of both the code snippets there. I'll look in the buffstruct trigger for what you're asking for I guess.

Edit:
The whole system is below, which is from this thread.
JASS:
//TESH.scrollpos=257
//TESH.alwaysfold=0
//
//      ___ _   _ ___ ___ ___ _____ ___ _   _  ___ _____
//     | _ ) | | | __| __/ __|_   _| _ \ | | |/ __|_   _|
//     | _ \ |_| | _|| _|\__ \ | | |   / |_| | (__  | |
//     |___/\___/|_| |_| |___/ |_| |_|_\\___/ \___| |_|
//                                         By Jesus4Lyf
//                                                                    v 1.0.4
//      What is BuffStruct?
//     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//          BuffStruct is a simple buff adding/removal/tracking system designed for
//          rapid map development. It automatically generates all object data and
//          backing code for adding and removing buffs to and from units.
//       
//      How to implement?
//     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//          1. Create a new trigger named BuffStructHeader. Go to 'Edit -> Convert
//          to Custom Text', and replace everything that's there with this script.
//
//          2. Create a new trigger immediately after BuffStructHeader, named
//          BuffStructFooter. go to 'Edit -> Convert to Custom Text', and replace
//          everything that's there with: //! endexternalblock
//
//          3. To make a BuffStruct, make a new trigger between BuffStructHeader
//          and BuffStructFooter, and use the template below.
//
//      BuffStruct Template:
//     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//          Example:
/*
//! runtextmacro BuffType("Return")
    //! runtextmacro SetBuffName("Return")
    //! runtextmacro SetBuffAlignment("NEUTRAL")
    //! runtextmacro SetBuffTooltip("This unit is being Returned; it will return to its previous location soon.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNDaggerOfEscape.blp")
//! runtextmacro BuffStruct()
    real x
    real y
    method onCreate takes nothing returns nothing
        set this.x = GetUnitX(this.unit)
        set this.y = GetUnitY(this.unit)
    endmethod
    method preDestroy takes nothing returns nothing
        call SetUnitX(this.unit, this.x)
        call SetUnitY(this.unit, this.y)
    endmethod
//! runtextmacro EndBuff()
*/
//          Documentation:
//
//              //! runtextmacro BuffType("Identifier")
//                  This must contain a 1 word identifier for the buff. This is
//                  used to create new instances with Identifier.create(unit)
//
//              //! runtextmacro SetBuffName("Name")
//                  This is the name that will display in the buff tray.
//
//              //! runtextmacro SetBuffAlignment("NEUTRAL")
//                  This is whether the buff is POSITIVE, NEGATIVE or NEUTRAL.
//
//              //! runtextmacro SetBuffTooltip("Tooltip Missing!")
//                  This is the tooltip that will display in the buff tray.
//
//              //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTN???.blp")
//                  This is the icon used for the buff in the buff tray.
//
//              //! runtextmacro BuffStruct()
//                  This denotes the end of textmacro configuration for a buff,
//                  and the start of the struct that will be instanciated for
//                  each instance of a buff.
//                  You may use the optional event response methods here, which
//                  are listed below.
//
//              //! runtextmacro EndBuff()
//                  This denotes the end of the BuffStruct.
//
//      Event Response Methods:
//     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//          In each BuffStruct, you may optionally implement the following methods:
//
/*              method onApply takes nothing returns nothing
*/              // Fires just after the buff is applied to a unit.
//
/*              method onRemove takes nothing returns nothing
*/              // Fires just before the buff is removed from a unit.
//
/*              method onCreate takes nothing returns nothing
*/              // Fires immediately after the buff is created and applied to
//              // the first unit. onApply will fire immediately after this.
//
/*              method preDestroy takes nothing returns nothing
*/              // Fires just before the buff instance is destroyed. onRemove
//              // will fire just before this.
//
/*              method onDamageReceived takes nothing returns nothing
*/              // Fires when the buffed unit takes damage. Use GetEventDamageSource()
//              // to refer to the damaging unit.
//              // All functions from "Damage" are available here.
//
/*              method onDamageDealt takes nothing returns nothing
*/              // Fires when the buffed unit deals damage. Use GetTriggerUnit()
//              // to refer to the unit taking the damage.
//              // All functions from "Damage" are available here.
//
//      Other:
//     ¯¯¯¯¯¯¯¯
//          All BuffStructs' instances have the ".unit" field, which is the unit
//          the buff is currently on.
//
//          All BuffStructs have the .setUnit(unit) method, which will remove
//          the buff instance from the current unit, and apply it to the given unit.
//          Use .setUnit(null) to unapply a buff without destroying it.
//
//          Use .isOn(unit) --> boolean to see if a buff is on a unit.
//
//          To do something for each buff on a unit, use:
/*          call BuffList[unit].forEachBuff(BUFF_ALIGNMENT_??, myMethod)
*/          // ?? should be substituted for POSITIVE, NEGATIVE or NEUTRAL.
//          // The function used for myMethod must take only a BuffStruct argument.
//
//          You may destroy a buff in x seconds using:
/*          call myBuffInstance.destroyTimed(real)
*/          // "real" is the time to destruction.
//
//      Thanks:
//     ¯¯¯¯¯¯¯¯¯
//          - 13lade619: for isolating a lag issue in the BETA version to do with
//            creating a buff instance for a null unit.
//
library BuffStruct requires AIDS, Damage, optional TimerUtils
///! externalblock extension=lua ObjectMerger $FILENAME$
    //! runtextmacro BuffStruct__StartConfig()

//===========================================================================
// CONFIG AREA
//

    //===========================================================================
    // System Object Editor IDs.
    //

    //! runtextmacro BuffStruct__BeginSysIds()
        // Uses:
        //  - 'Bxx&' for buff type.
        //  - 'Axx&' for base ability.
    
        //! runtextmacro BuffStruct__AllowSysId("@a")
        //! runtextmacro BuffStruct__AllowSysId("@b")
        //! runtextmacro BuffStruct__AllowSysId("@c")
        //! runtextmacro BuffStruct__AllowSysId("@d")
        //! runtextmacro BuffStruct__AllowSysId("@e")
        //! runtextmacro BuffStruct__AllowSysId("@f")
        //! runtextmacro BuffStruct__AllowSysId("@g")
        //! runtextmacro BuffStruct__AllowSysId("@h")
        //! runtextmacro BuffStruct__AllowSysId("@i")
        //! runtextmacro BuffStruct__AllowSysId("@j")
        //! runtextmacro BuffStruct__AllowSysId("@k")
        //! runtextmacro BuffStruct__AllowSysId("@l")
        //! runtextmacro BuffStruct__AllowSysId("@m")
        //! runtextmacro BuffStruct__AllowSysId("@n")
        //! runtextmacro BuffStruct__AllowSysId("@o")
        //! runtextmacro BuffStruct__AllowSysId("@p")
        //! runtextmacro BuffStruct__AllowSysId("@q")
        //! runtextmacro BuffStruct__AllowSysId("@r")
        //! runtextmacro BuffStruct__AllowSysId("@s")
        //! runtextmacro BuffStruct__AllowSysId("@t")
        //! runtextmacro BuffStruct__AllowSysId("@u")
        //! runtextmacro BuffStruct__AllowSysId("@v")
        //! runtextmacro BuffStruct__AllowSysId("@w")
        //! runtextmacro BuffStruct__AllowSysId("@x")
        //! runtextmacro BuffStruct__AllowSysId("@y")
        //! runtextmacro BuffStruct__AllowSysId("@z")
        //! runtextmacro BuffStruct__AllowSysId("@A")
        //! runtextmacro BuffStruct__AllowSysId("@B")
        //! runtextmacro BuffStruct__AllowSysId("@C")
        //! runtextmacro BuffStruct__AllowSysId("@D")
        //! runtextmacro BuffStruct__AllowSysId("@E")
        //! runtextmacro BuffStruct__AllowSysId("@F")
        //! runtextmacro BuffStruct__AllowSysId("@G")
        //! runtextmacro BuffStruct__AllowSysId("@H")
        //! runtextmacro BuffStruct__AllowSysId("@I")
        //! runtextmacro BuffStruct__AllowSysId("@J")
        //! runtextmacro BuffStruct__AllowSysId("@K")
        //! runtextmacro BuffStruct__AllowSysId("@L")
        //! runtextmacro BuffStruct__AllowSysId("@M")
        //! runtextmacro BuffStruct__AllowSysId("@N")
        //! runtextmacro BuffStruct__AllowSysId("@O")
        //! runtextmacro BuffStruct__AllowSysId("@P")
        //! runtextmacro BuffStruct__AllowSysId("@Q")
        //! runtextmacro BuffStruct__AllowSysId("@R")
        //! runtextmacro BuffStruct__AllowSysId("@S")
        //! runtextmacro BuffStruct__AllowSysId("@T")
        //! runtextmacro BuffStruct__AllowSysId("@U")
        //! runtextmacro BuffStruct__AllowSysId("@V")
        //! runtextmacro BuffStruct__AllowSysId("@W")
        //! runtextmacro BuffStruct__AllowSysId("@X")
        //! runtextmacro BuffStruct__AllowSysId("@Y")
        //! runtextmacro BuffStruct__AllowSysId("@Z")
        //! runtextmacro BuffStruct__AllowSysId("#a")
        //! runtextmacro BuffStruct__AllowSysId("#b")
        //! runtextmacro BuffStruct__AllowSysId("#c")
        //! runtextmacro BuffStruct__AllowSysId("#d")
        //! runtextmacro BuffStruct__AllowSysId("#e")
        //! runtextmacro BuffStruct__AllowSysId("#f")
        //! runtextmacro BuffStruct__AllowSysId("#g")
        //! runtextmacro BuffStruct__AllowSysId("#h")
        //! runtextmacro BuffStruct__AllowSysId("#i")
        //! runtextmacro BuffStruct__AllowSysId("#j")
        //! runtextmacro BuffStruct__AllowSysId("#k")
        //! runtextmacro BuffStruct__AllowSysId("#l")
        //! runtextmacro BuffStruct__AllowSysId("#m")
        //! runtextmacro BuffStruct__AllowSysId("#n")
        //! runtextmacro BuffStruct__AllowSysId("#o")
        //! runtextmacro BuffStruct__AllowSysId("#p")
        //! runtextmacro BuffStruct__AllowSysId("#q")
        //! runtextmacro BuffStruct__AllowSysId("#r")
        //! runtextmacro BuffStruct__AllowSysId("#s")
        //! runtextmacro BuffStruct__AllowSysId("#t")
        //! runtextmacro BuffStruct__AllowSysId("#u")
        //! runtextmacro BuffStruct__AllowSysId("#v")
        //! runtextmacro BuffStruct__AllowSysId("#w")
        //! runtextmacro BuffStruct__AllowSysId("#x")
        //! runtextmacro BuffStruct__AllowSysId("#y")
        //! runtextmacro BuffStruct__AllowSysId("#z")
        //! runtextmacro BuffStruct__AllowSysId("#A")
        //! runtextmacro BuffStruct__AllowSysId("#B")
        //! runtextmacro BuffStruct__AllowSysId("#C")
        //! runtextmacro BuffStruct__AllowSysId("#D")
        //! runtextmacro BuffStruct__AllowSysId("#E")
        //! runtextmacro BuffStruct__AllowSysId("#F")
        //! runtextmacro BuffStruct__AllowSysId("#G")
        //! runtextmacro BuffStruct__AllowSysId("#H")
        //! runtextmacro BuffStruct__AllowSysId("#I")
        //! runtextmacro BuffStruct__AllowSysId("#J")
        //! runtextmacro BuffStruct__AllowSysId("#K")
        //! runtextmacro BuffStruct__AllowSysId("#L")
        //! runtextmacro BuffStruct__AllowSysId("#M")
        //! runtextmacro BuffStruct__AllowSysId("#N")
        //! runtextmacro BuffStruct__AllowSysId("#O")
        //! runtextmacro BuffStruct__AllowSysId("#P")
        //! runtextmacro BuffStruct__AllowSysId("#Q")
        //! runtextmacro BuffStruct__AllowSysId("#R")
        //! runtextmacro BuffStruct__AllowSysId("#S")
        //! runtextmacro BuffStruct__AllowSysId("#T")
        //! runtextmacro BuffStruct__AllowSysId("#U")
        //! runtextmacro BuffStruct__AllowSysId("#V")
        //! runtextmacro BuffStruct__AllowSysId("#W")
        //! runtextmacro BuffStruct__AllowSysId("#X")
        //! runtextmacro BuffStruct__AllowSysId("#Y")
        //! runtextmacro BuffStruct__AllowSysId("#Z")
    
    //! runtextmacro BuffStruct__EndSysIds()

//===========================================================================
// END CONFIG AREA
//
    //! runtextmacro BuffStruct__EndConfig()


    //===========================================================================
    // SYSTEM AREA
    //

    globals
        constant integer BUFF_ALIGNMENT_POSITIVE=1
        constant integer BUFF_ALIGNMENT_NEGATIVE=2
        constant integer BUFF_ALIGNMENT_NEUTRAL=3
        private integer BuffCount = 0
        private integer BuffTypeId = 0
        boolean Destroyed = false
        integer GetBuffCount = 0
    endglobals

    private function interface Method takes integer this returns nothing

    //! textmacro BuffStruct__StartConfig
    //! endtextmacro
    //! textmacro BuffStruct__EndConfig
    //! endtextmacro


    //===========================================================================
    // Id Declaration
    //
    //  Exposes a module which implements the system ids, as per the system
    // configuration, automatically filling structs starting from struct ID #1.
    //

    //! textmacro BuffStruct__BeginSysIds
        private keyword abilType
        private keyword buffType
        private keyword idMax
    
        private module SysIds
            /*libprivate*/ integer abilType
            /*libprivate*/ integer buffType
            /*libprivate*/ static integer idMax=0
            private static method onInit takes nothing returns nothing
                //! i sysIds={}
                //! i maxSysIds=0
    //! endtextmacro
    //! textmacro BuffStruct__EndSysIds
            endmethod
        endmodule
        //! i sysIdsUsed=0
    //! endtextmacro

    //! textmacro BuffStruct__AllowSysId takes SYSID
        set thistype.idMax=thistype.idMax+1
        //! i maxSysIds=maxSysIds+1
    
        set thistype(thistype.idMax).abilType='A$SYSID$&'
        set thistype(thistype.idMax).buffType='B$SYSID$&'
        //! i sysIds[maxSysIds]={abilType="A$SYSID$&", buffType="B$SYSID$&"}
    //! endtextmacro

    //===========================================================================
    // BuffType Struct
    //

    private struct BuffType
        implement SysIds // supplies abilType, buffType, preloaded.
    endstruct

    //===========================================================================
    // BuffStruct
    //
    private keyword buffUnit
    private keyword next
    private keyword prev
    private keyword temp

    private interface DEFAULTS
        static BuffStruct temp
    
        unit buffUnit
        BuffStruct next
        BuffStruct prev
    
        // User implementable
        method onCreate takes nothing returns nothing defaults nothing
        method onApply takes nothing returns nothing defaults nothing
        method onRemove takes nothing returns nothing defaults nothing
        method preDestroy takes nothing returns nothing defaults nothing
        method onDamageReceived takes nothing returns nothing defaults nothing
        method onDamageDealt takes nothing returns nothing defaults nothing
    
        // Module
        method setUnit takes unit whichUnit returns nothing defaults nothing
    endinterface

    struct BuffStruct extends DEFAULTS
        boolean deathDestroy = true
        private static method timedDestroyCallback takes nothing returns nothing
            static if LIBRARY_TimerUtils then
                local timer t=GetExpiredTimer()
                call thistype(GetTimerData(t)).destroy()
                call ReleaseTimer(t)
            endif
        endmethod
        method destroyTimed takes real time returns nothing
            static if LIBRARY_TimerUtils then
                local timer t=NewTimer()
                call SetTimerData(t,this)
                call TimerStart(t,time,false,function thistype.timedDestroyCallback)
            else
                call BJDebugMsg("BuffStruct Error: Must import TimerUtils in order to use .timedDestroy method.")
            endif
        endmethod
        static method DestroyDeathBuffs takes BuffStruct whatBuff returns nothing
            if whatBuff.deathDestroy then
                call whatBuff.destroy()
            endif
        endmethod
        static method onDeath takes nothing returns boolean
            local unit u = GetTriggerUnit()
            call BuffList[u].forEachBuff(BUFF_ALIGNMENT_POSITIVE, DestroyDeathBuffs)
            call BuffList[u].forEachBuff(BUFF_ALIGNMENT_NEUTRAL, DestroyDeathBuffs)
            call BuffList[u].forEachBuff(BUFF_ALIGNMENT_NEGATIVE, DestroyDeathBuffs)
            set u = null
            return false
        endmethod
        static method onInit takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
            call TriggerAddCondition(t, Condition(function thistype.onDeath))
        endmethod

    endstruct

    module BuffStruct
        static integer ALIGNMENT=BUFF_ALIGNMENT_NEUTRAL
        //! textmacro BuffStruct__AttachToWhichUnit
            set BuffStruct.temp=BuffList[whichUnit][thistype.ALIGNMENT]
            set BuffStruct.temp.prev.next=this
            set this.prev=BuffStruct.temp.prev
            set BuffStruct.temp.prev=this
            set this.next=BuffStruct.temp
        //! endtextmacro
    
        private static BuffType typeStruct=0
        static method isOn takes unit whichUnit returns boolean
            return GetUnitAbilityLevel(whichUnit,thistype.typeStruct.abilType)>0
        endmethod
        private static method onInit takes nothing returns nothing
            set thistype.typeStruct=BuffType.create()
        endmethod
    
        method operator unit takes nothing returns unit
            return this.buffUnit
        endmethod
    
        method setUnit takes unit whichUnit returns nothing
            if this.buffUnit!=null then
                call this.onRemove()
                set this.next.prev=this.prev
                set this.prev.next=this.next
                call UnitMakeAbilityPermanent(this.buffUnit,false,thistype.typeStruct.abilType)
                call UnitRemoveAbility(this.buffUnit,thistype.typeStruct.abilType)
                call UnitRemoveAbility(this.buffUnit,thistype.typeStruct.buffType)
            endif
            set this.buffUnit=whichUnit
            if whichUnit!=null then
                call UnitAddAbility(whichUnit,thistype.typeStruct.abilType)
                call UnitMakeAbilityPermanent(whichUnit,true,thistype.typeStruct.abilType)
                //! runtextmacro BuffStruct__AttachToWhichUnit()
                call this.onApply()
            endif
        endmethod
    
        static method CountBuffType takes BuffStruct whatBuff returns nothing
            //call BJDebugMsg(I2S(BuffTypeId))
            if whatBuff.getType() == BuffTypeId then
                set BuffCount = BuffCount + 1
            endif
        endmethod
    
        private method onDestroy takes nothing returns nothing
            if this.buffUnit!=null then
                set BuffCount = 0
                set BuffTypeId = this.typeId
                call BuffList[this.buffUnit].forEachBuff(BUFF_ALIGNMENT_POSITIVE,CountBuffType)
                call BuffList[this.buffUnit].forEachBuff(BUFF_ALIGNMENT_NEUTRAL,CountBuffType)
                call BuffList[this.buffUnit].forEachBuff(BUFF_ALIGNMENT_NEGATIVE,CountBuffType)
                call this.onRemove()
                call this.preDestroy()
                set this.next.prev=this.prev
                set this.prev.next=this.next
                //call BJDebugMsg(I2S(BuffCount))
                if BuffCount <= 1 then
                    call UnitMakeAbilityPermanent(this.buffUnit,false,thistype.typeStruct.abilType)
                    call UnitRemoveAbility(this.buffUnit,thistype.typeStruct.abilType)
                    call UnitRemoveAbility(this.buffUnit,thistype.typeStruct.buffType)
                endif
            else
                call this.preDestroy()
            endif
        endmethod
    
        static method create takes unit whichUnit returns thistype
            local thistype this=thistype.allocate()
            set this.buffUnit=whichUnit
            if whichUnit==null then
                call this.onCreate()
            else
                call UnitAddAbility(whichUnit,thistype.typeStruct.abilType)
                call UnitMakeAbilityPermanent(whichUnit,true,thistype.typeStruct.abilType)
                //! runtextmacro BuffStruct__AttachToWhichUnit()
                call this.onCreate()
                call this.onApply()
            endif
            return this
        endmethod
    endmodule

    //! textmacro BuffType takes IDENTIFIER
        struct $IDENTIFIER$ extends BuffStruct
            implement BuffStruct
            //! i itemIdentifier="$IDENTIFIER$"
            integer typeId = $IDENTIFIER$.typeid
            private static method onInit takes nothing returns nothing
                //! i sysIdsUsed=sysIdsUsed+1
                // Defaults.
                //! i buffName="$IDENTIFIER$"
                //! i buffIcon=""
                //! i buffDescription=""
                //! i buffAlignment="NEUTRAL"
    //! endtextmacro

    //! textmacro SetBuffName takes VAL
        //! i buffName="$VAL$"
    //! endtextmacro
    //! textmacro SetBuffIcon takes VAL
        //! i buffIcon="$VAL$"
    //! endtextmacro
    //! textmacro SetBuffTooltip takes VAL
        //! i buffDescription="$VAL$"
    //! endtextmacro
    //! textmacro SetBuffAlignment takes VAL
        set thistype.ALIGNMENT=BUFF_ALIGNMENT_$VAL$
        //! i buffAlignment="$VAL$"
    //! endtextmacro

    //! textmacro BuffStruct
            endmethod
    //! endtextmacro
    //! textmacro EndBuff
        endstruct
        // Make object data.
        // Actual buff
        //! i setobjecttype("buffs")
        //! i createobject("Basl",sysIds[sysIdsUsed].buffType)
        //! i makechange(current,"ftat","")
        //! i makechange(current,"fnsf","(BuffStruct)")
        //! i makechange(current,"fart",buffIcon)
        //! i makechange(current,"fube",buffDescription)
        //! i if buffAlignment=="POSITIVE" then
            //! i makechange(current,"ftip","|cff00FF00"..buffName.."|r")
        //! i elseif buffAlignment=="NEUTRAL" then
            //! i makechange(current,"ftip","|cff00FFFF"..buffName.."|r")
        //! i else
            //! i makechange(current,"ftip",buffName)
        //! i end
    
        // Slow aura
        //! i setobjecttype("abilities")
        //! i createobject("Aasl",sysIds[sysIdsUsed].abilType)
        //! i makechange(current,"ansf","(BuffStruct)")
        //! i makechange(current,"Slo1",1,0)
        //! i makechange(current,"aare",1,0)
        //! i makechange(current,"abuf",1,sysIds[sysIdsUsed].buffType)
        //! i makechange(current,"arac","other")
        //! i makechange(current,"atar",1,"self")
        //! i makechange(current,"anam",buffName)
    //! endtextmacro

    //===========================================================================
    // On Damage
    //

    private module DamageEvent
        private static method onDamage takes nothing returns boolean
            // Attacked
            local thistype u=thistype[GetTriggerUnit()]
            local BuffStruct base=u[BUFF_ALIGNMENT_POSITIVE]
            local BuffStruct this=base.next
            loop
                exitwhen this==base
                call this.onDamageReceived()
                set this=this.next
            endloop
            set base=u[BUFF_ALIGNMENT_NEUTRAL]
            set this=base.next
            loop
                exitwhen this==base
                call this.onDamageReceived()
                set this=this.next
            endloop
            set base=u[BUFF_ALIGNMENT_NEGATIVE]
            set this=base.next
            loop
                exitwhen this==base
                call this.onDamageReceived()
                set this=this.next
            endloop
            // Attacker
            if GetEventDamageSource()!=null then
                set u=thistype[GetEventDamageSource()]
                set base=u[BUFF_ALIGNMENT_POSITIVE]
                set this=base.next
                loop
                    exitwhen this==base
                    call this.onDamageDealt()
                    set this=this.next
                endloop
                set base=u[BUFF_ALIGNMENT_NEUTRAL]
                set this=base.next
                loop
                    exitwhen this==base
                    call this.onDamageDealt()
                    set this=this.next
                endloop
                set base=u[BUFF_ALIGNMENT_NEGATIVE]
                set this=base.next
                loop
                    exitwhen this==base
                    call this.onDamageDealt()
                    set this=this.next
                endloop
            endif
            return false
        endmethod
        private static method onInit takes nothing returns nothing
            local trigger t=CreateTrigger()
            call Damage_RegisterEvent(t)
            call TriggerAddCondition(t,Filter(function thistype.onDamage))
            set t=null
        endmethod
    endmodule

    //===========================================================================
    // Buff Listing
    //

    private struct LinkNode extends BuffStruct
    endstruct

    struct BuffList extends array
        private static LinkNode array linkNode
        method operator [] takes integer alignment returns LinkNode
            return thistype.linkNode[this*3+alignment]
        endmethod
        private method operator []= takes integer alignment, LinkNode node returns nothing
            set thistype.linkNode[this*3+alignment]=node
        endmethod
    
        private method AIDS_onCreate takes nothing returns nothing
            set BuffStruct.temp=LinkNode.create()
            set BuffStruct.temp.next=BuffStruct.temp
            set BuffStruct.temp.prev=BuffStruct.temp
            set this[BUFF_ALIGNMENT_POSITIVE]=BuffStruct.temp
            set BuffStruct.temp=LinkNode.create()
            set BuffStruct.temp.next=BuffStruct.temp
            set BuffStruct.temp.prev=BuffStruct.temp
            set this[BUFF_ALIGNMENT_NEGATIVE]=BuffStruct.temp
            set BuffStruct.temp=LinkNode.create()
            set BuffStruct.temp.next=BuffStruct.temp
            set BuffStruct.temp.prev=BuffStruct.temp
            set this[BUFF_ALIGNMENT_NEUTRAL]=BuffStruct.temp
        endmethod
        private method AIDS_onDestroy takes nothing returns nothing
            call this[BUFF_ALIGNMENT_POSITIVE].destroy()
            call this[BUFF_ALIGNMENT_NEGATIVE].destroy()
            call this[BUFF_ALIGNMENT_NEUTRAL].destroy()
        endmethod
        //! runtextmacro AIDS()
    
        implement DamageEvent
    
        method forEachBuff takes integer alignment, Method func returns nothing
            local LinkNode base=this[alignment]
            set this=thistype(base.next)
            loop
                exitwhen this==base
                call func.evaluate(this)
                set this=thistype(LinkNode(this).next)
            endloop
        endmethod
    endstruct
endlibrary
I'm honestly not sure where in this the part you want is, I assume you'll be able to find it better than I.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
I think you should only use systems that you know how they work.
As far as I can see, it is missing the line where it starts the objectmerger and tells it to create abilities.

But this system is kinda messy so I dont really know where you would want to put it.
 
Level 6
Joined
Jan 13, 2013
Messages
130
So the answer was actually quite obvious, there was an objectmerger line in the header commented out and an external block in the footer commented out but now I'm getting the attached error. Header is as above and footer is below.
vJASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! endexternalblock

I have manually set the path for my warcraft install but I'm still having the error, though it still says No Game.dll found! when starting jass newgen.
 

Attachments

  • new error.PNG
    new error.PNG
    7.2 KB · Views: 71
Level 24
Joined
Aug 1, 2013
Messages
4,657
how can it be "mostly" working?

I mean, you always get that error right?

I think that the problem is that the WC3 folder is protected.
So you might have to run NewGen WE in Admin mode or remove the protection from the WC3 folder.

Other than that, I dont really have an idea.
Maybe reinstalling might help.
 
Level 6
Joined
Jan 13, 2013
Messages
130
I actually have another two warcraft installs elsewhere on this computer so I just rename my primary installation then manually choose the secondary one when it gives me an error. I already run it in administrator and unprotected my folder. As far as I know the bug is caused by a modification to my main warcraft that removes the moving doors to log into battlenet faster. Something about having an extra folder named UI in my warcraft folder or something.
 
Status
Not open for further replies.
Top