| 10-08-2009, 09:14 AM | #1 |
Hey! How can I have this? JASS:
//! textmacro TT_getVal takes name, type
method operator $name$ takes nothing returns $type$
return .$name$
endmethod
//! endtextmacro
//! textmacro TT_setValNoUpd takes name, type
method operator $name$= takes $type$ val returns nothing
set .$name$ = val
endmethod
//! endtextmacro
//! textmacro TT_setVal takes name, type
method operator $name$= takes $type$ val returns nothing
set .$name$ = val
call .upd$name$()
endmethod
//! endtextmacro
//! textmacro TT_noUpdate takes name, type
//! runtextmacro TT_getVal(name, type)
//! runtextmacro TT_setValNoUpd(name, type)
//! endtextmacro
//! textmacro TT_withUpdate takes name, type
//! runtextmacro TT_getVal(name, type)
//! runtextmacro TT_setVal(name, type)
//! endtextmacro
//! runtextmacro TT_withUpdate("Age","real")
//! runtextmacro TT_withUpdate("Color","ARGB")
//! runtextmacro TT_withUpdate("Fadepoint","real")
//! runtextmacro TT_withUpdate("Fading","boolean")
//! runtextmacro TT_withUpdate("Lifespan","real")
//! runtextmacro TT_withUpdate("Permanent","boolean")
//! runtextmacro TT_withUpdate("Suspended","boolean")
//! runtextmacro TT_withUpdate("Visiblity","boolean")
//! runtextmacro TT_noUpdate("Fades","boolean")
//! runtextmacro TT_noUpdate("FadeColor","ARGB")
//! runtextmacro TT_noUpdate("FadeCond","iFade")
//! runtextmacro TT_noUpdate("FadeState","real")
//! runtextmacro TT_noUpdate("FadeStrengh","real")
//! runtextmacro TT_noUpdate("FadeType","string")
//! runtextmacro TT_noUpdate("Handle","texttag")
//! runtextmacro TT_noUpdate("ShowCond","iShow")
//! runtextmacro TT_noUpdate("ShowForce","force")
|
| 10-08-2009, 01:42 PM | #2 |
you mean nested text macros? wait till I add them. Though I think you could do something funny combining textmacros and modules, explain what exactly is what you want to do? |
| 10-08-2009, 02:05 PM | #3 |
Ok, because thats not supported, I have something like this: JASS:
//==-=-=-=-=-=-=-
//: Textmacros
//==-=-=-=-=-=-=-
//! textmacro varOp takes name, type, method
method operator $name$ takes nothing returns $type$
return .$name$
endmethod
method operator $name$= takes $type$ val returns nothing
set .$name$ = val
$method$
endmethod
//! endtextmacro
//==-=-=-=-=-=-=-
which is used here: JASS:
//==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//: Update Methods.
//==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
private method updAge takes nothing returns nothing
call SetTextTagAge(.Handle, .Age)
endmethod
private method updColor takes nothing returns nothing
call SetTextTagColor(.Handle, .Color.red, .Color.green, .Color.blue, .Color.alpha)
endmethod
private method updFadepoint takes nothing returns nothing
call SetTextTagFadepoint(.Handle, .Fadepoint)
endmethod
private method updLifespan takes nothing returns nothing
call SetTextTagLifespan(.Handle, .Lifespan)
endmethod
private method updPermanent takes nothing returns nothing
call SetTextTagPermanent(.Handle, .Permanent)
endmethod
private method updPos takes nothing returns nothing
call SetTextTagPos(.Handle, .PosX, .PosY, .PosZ)
endmethod
private method updSuspended takes nothing returns nothing
call SetTextTagSuspended(.Handle, .Suspended)
endmethod
private method updText takes nothing returns nothing
call SetTextTagText(.Handle, .Text, .Size)
endmethod
private method updVelocity takes nothing returns nothing
call SetTextTagVelocity(.Handle, .VelX, .VelY)
endmethod
private method updVisibility takes nothing returns nothing
call SetTextTagVisibility(.Handle, .Visibility)
endmethod
//==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//: Member setting / getting
//==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//: Variables that should update the texttag
//==----------------------------------------
//! runtextmacro varOp("Age", "real", "call .updAge()")
//! runtextmacro varOp("Color", "ARGB", "call .updColor()")
//! runtextmacro varOp("Fadepoint", "real", "call .updFadepoint()")
//! runtextmacro varOp("Lifespan", "real", "call .updLifespan()")
//! runtextmacro varOp("Permanent", "boolean", "call .updPermanent()")
//! runtextmacro varOp("Suspended", "boolean", "call .updSuspended()")
//! runtextmacro varOp("Visiblity", "boolean", "call .updVisiblity()")
//==--------------------------------------------
//: Variables that shouldn't update the texttag
//==--------------------------------------------
//! runtextmacro varOp("Fades", "boolean", "")
//! runtextmacro varOp("FadeColor", "ARGB", "")
//! runtextmacro varOp("FadeCond", "iFade", "")
//! runtextmacro varOp("FadeState", "real", "")
//! runtextmacro varOp("FadeStrengh", "real", "")
//! runtextmacro varOp("FadeType", "string", "")
//! runtextmacro varOp("Fading", "boolean", "")
//! runtextmacro varOp("Handle", "texttag", "")
//! runtextmacro varOp("ShowCond", "iShow", "")
//! runtextmacro varOp("ShowForce", "force", "")
What do you think of it? Basicly I want to make method operators which update members and some of them should also run methods on update, but not all. Edit: To get you a better view of what I am meaning, I added the updating methods. |
