• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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