• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

modules

Status
Not open for further replies.
Level 19
Joined
Mar 18, 2012
Messages
1,716
Quick question:
Can a module only be implemented once per struct?
JASS:
library xxxx

      module IPMStart
        local integer i = 1
        local real x = 0
        local integer y = 0
        local integer y1 = 0
        local real x1 = 0
        local integer number = 0
    endmodule
    
struct yxyx extends array

        private static method plus takes nothing returns boolean
            implement IPMStart
                set x1 = x + 1.
                set y1 = y + 1
            return false
        endmethod
        
        private static method minus takes nothing returns boolean
            implement IPMStart
                set x1 = x - 1.
                set y1 = y - 1
            return false
        endmethod
endstruct
 
endlibrary

If I comment one of those methods out it will compile, otherwise JassHelper throws an error. undeclared variable x, x1, y, y1

Edit: I've never used textmacros, but is it possible to do what I try to achieve here with //! runtextmacro?
Something like:
JASS:
		//! textmacro my_Variables
        local integer i = 1
        local real x = 0
        local integer y = 0
        local integer y1 = 0
        local real x1 = 0
        local integer number = 0
		//! endtextmacro
 
Status
Not open for further replies.
Top