Hi,
You need to change the index value before changing the brush, so that the index value stored is the current brush, not the “next” brush. Also, the memory block isn’t being used in your code - the value is stored but never retrieved. The point of the memory block is to make sure the value of index is not lost should another plugin be used. (Ordinary variables are reset to their defaults when the plugin is reloaded.)
//variable declarations - declare the brush paths
[VarDef,index,0]
[VarDef,numBrushes,3]//the number of brushes in list (change if adding more)
[VarDef,maskBrush(numBrushes),""]//list variable
[VarSet,maskBrush(0),“Standard”]
[VarSet,maskBrush(1),“Claytubes”]
[VarSet,maskBrush(2),“MoveTopological”]
[If,[MemGetSize,MaskBrushCycle_Mem],
[VarSet,index,[MVarGet,MaskBrushCycle_Mem,0]]
,[MVarDef,MaskBrushCycle_Mem,1][MVarSet,MaskBrushCycle_Mem,0,0]
]//create memory if necessary
//
[ISubPalette,“Zplugin:BrushDial”]
[IButton,“Zplugin:BrushDial:Shift UP”,“Cycle Brushes”,
[IShowActions,0]
[IConfig,4.2]
[VarInc,index]//increment the cycle
[If,index >= numBrushes,
[VarSet,index,0]
]
[IPress,[StrMerge,“Brush:”,#maskBrush(index)]]//presses brush
[NoteBar,[StrMerge,"\Cff9923",#maskBrush(index),"\Cffffff selected"]]//displays brush selected in Notebar
[MVarSet,MaskBrushCycle_Mem,0,#index]//store value
,1]
[IButton,“Zplugin:BrushDial:Shift DOWN”,“Cycle down Brushes”,
[IShowActions,0]
[IConfig,4.2]
[VarDec,index]//increment the cycle
[If,index < 0,
[VarSet,index,2]
]
[IPress,[StrMerge,“Brush:”,#maskBrush(index)]]//presses brush
[NoteBar,[StrMerge,"\Cff9923",#maskBrush(index),"\Cffffff selected"]]//displays brush selected in Notebar
[MVarSet,MaskBrushCycle_Mem,0,#index]//store value
,1]
]
HTH,