It should be simple...a stack of Tile (Shape Meters) are sitting off-skin at -100,-100 and when the Left Mouse is clicked on the Canvas (a Screen sized Rectangle Shape), the first Tile is placed at that location.

A Counter is then increased so the next Tile will be moved if Mouse Clicked on another spot.

Clicking a Tile reduces the Counter, because it was increased when each Tile is placed, and that Tile number is moved back to the Stack.

Only it's not happening smoothly.

Any suggestions would be appreciated.

Here is the Code. There are only 6 Tiles so more LMB clicks may crash Rainmeter...

Code: Select all

```
[Rainmeter]
Update=100
AccurateText=1
DynamicWindowSize=1
; Use Current Monitor for Skin Calcs
OnRefreshAction=[!AutoSelectScreen "1" "#CURRENTCONFIG#"]
; ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ======
[Variables]
; Hex Degree Constants
SIN30COS60=0.5
COS30SIN60=0.8660254
; --==>> Hex Variables <<==--
; Grid Hex Point Radius : Center-to-Point distance.
Hex_Radius=40
; Hex Tile Gap : The space between Hex BORDERS.
Tile_Gap=5
; Hex Tile Outline Thickness : The Thickness of the Hex BORDER.
Tile_Border_Width=3
; Init Mouse coords.
MouseX=0
MouseY=0
; --==>> Counters <<==--
; Sequence is to track how many Tiles are used.
Sequence=0
; --==>> Hex Grid Point Calcs <<==--
; Right Hex Point = Hex_Radius and negative for Left Point
; Hex Grid Point X Offset for Upper Right, Lower Right, and negative for Upper Left, Lower Left
[Hex_Point_X]
Measure=Calc
Formula=(#SIN30COS60# * #Hex_Radius#)
; Hex Grid Point Y Offset for Lower Left, Lower Right, and negative for Upper Left, Upper Right
[Hex_Point_Y]
Measure=Calc
Formula=(#COS30SIN60# * #Hex_Radius#)
; Because Grid Coords are X,Y they are essentially a 1x1 Square Grid.
; Hex Grids expressed as XY Grids are NOT square...they are Rectangular.
; Grid Cell Radius : The X width of the Grid Cells.
; Grid Cell Height uses Hex_Point_Y.
[Grid_Cell_Radius]
Measure=Calc
Formula=(#COS30SIN60# * [Hex_Point_Y])
DynamicVariables=1
; Tile Radius : The Radius that accommodates the Gap between Tile Borders.
[Tile_Radius]
Measure=Calc
Formula=(#Hex_Radius#-((#Tile_Gap#/2)/#SIN30COS60#))
; Tile Point X : Offset from Hex Center for Upper Right, Lower Right, and negative for Upper Left, Lower Left
[Tile_Point_X]
Measure=Calc
Formula=(#SIN30COS60# * [Tile_Radius])
DynamicVariables=1
; Tile Point Y : Offset from Hex Center for Lower Left, Lower Right, and negative for Upper Left, Upper Right
[Tile_Point_Y]
Measure=Calc
Formula=(#COS30SIN60# * [Tile_Radius])
DynamicVariables=1
; --==>> Grid Cells Calcs for Background<<==--
[MaxCell_X]
Measure=Calc
Formula=(Floor(#WORKAREAWIDTH#/Floor(((#Hex_Radius#*2)+([Hex_Point_X] * 2))/2))-2)
DynamicVariables=1
[MaxCell_Y]
Measure=Calc
Formula=(Floor(#WORKAREAHEIGHT#/([Hex_Point_Y] * 2))-1)
DynamicVariables=1
; Calc Grid Cell X and Grid Cell Y based on Mouse click.
[Mouse_Cell_X]
Measure=Calc
Formula=(Floor(#MouseX#/([Grid_Cell_Radius] * 2)))
DynamicVariables=1
[Mouse_Cell_Y]
Measure=Calc
Formula=(Floor((#MouseY#-([Hex_Point_Y]*([Mouse_Cell_X]%2)))/([Hex_Point_Y] * 2)))
DynamicVariables=1
[Tile_Center_X]
Measure=Calc
Formula=(([Mouse_Cell_X] * [Grid_Cell_Radius] * 2) + #Hex_Radius#+2)
DynamicVariables=1
[Tile_Center_Y]
Measure=Calc
Formula=(([Mouse_Cell_Y] * [Hex_Point_Y] * 2) + [Hex_Point_Y] + ([Hex_Point_Y] * ([Mouse_Cell_X] % 2))+2)
DynamicVariables=1
; Set a Shape to be the Background.
[Background_Canvas]
Meter=Shape
Shape=Rectangle 2,2,(([MaxCell_X] * [Grid_Cell_Radius] * 2) + (#Hex_Radius# * 2)+1),(([MaxCell_Y] * [Hex_Point_Y] * 2) + ([Hex_Point_Y] * 2)+1) | StrokeWidth 2 | Stroke Color 224,224,224,255 | Fill Color 200,200,200,128
LeftMouseUpAction=[!SetVariable MouseX "$MouseX$"][!SetVariable MouseY "$MouseY$"][UpdateMeasure Mouse_Cell_X][UpdateMeasure Mouse_Cell_Y][!SetOption Hex_Tile_#Sequence# X [Tile_Center_X]][!SetOption Hex_Tile_#Sequence# Y [Tile_Center_Y]][!UpdateMeter *][!Redraw][!SetVariable Sequence (#Sequence#+1)]
DynamicVariables=1
[HEX_COMMON]
Shape=Path HexTile | StrokeWidth #Tile_Border_Width# | Stroke Color 224,224,224,255 | Fill Color 100,120,220,255 | StrokeLineJoin Round
HexTile=[Tile_Point_X],-[Tile_Point_Y] | LineTo [Tile_Radius],0 | LineTo [Tile_Point_X],[Tile_Point_Y] | LineTo -[Tile_Point_X],[Tile_Point_Y] | LineTo (-[Tile_Radius]),0 | LineTo -[Tile_Point_X],-[Tile_Point_Y] | ClosePath 1
LeftMouseUpAction=[!SetVariable Sequence (#Sequence#-1)][!SetOption Hex_Tile_#Sequence# X -100][!SetOption Hex_Tile_#Sequence# Y -100][!Redraw]
DynamicVariables=1
[HEX_LABEL]
FontColor=0,0,0,255
StringAlign=CenterCenter
StringStyle=Bold
StringEffect=Border
FontEffectColor=200,200,0,255
ClipString=1
ClipStringW=48
ClipStringH=48
[Hex_Tile_0]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Tile_1]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Tile_2]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Tile_3]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Tile_4]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Tile_5]
Meter=Shape
X=-100
Y=-100
MeterStyle=HEX_COMMON
[Hex_Label_0]
Meter=String
X=[Hex_Tile_0:X]
Y=[Hex_Tile_0:Y]
MeterStyle=HEX_LABEL
Text=0
DynamicVariables=1
[Hex_Label_1]
Meter=String
X=[Hex_Tile_1:X]
Y=[Hex_Tile_1:Y]
MeterStyle=HEX_LABEL
Text=1
DynamicVariables=1
[Hex_Label_2]
Meter=String
X=[Hex_Tile_2:X]
Y=[Hex_Tile_2:Y]
MeterStyle=HEX_LABEL
Text=2
DynamicVariables=1
[Hex_Label_3]
Meter=String
X=[Hex_Tile_3:X]
Y=[Hex_Tile_3:Y]
MeterStyle=HEX_LABEL
Text=3
DynamicVariables=1
[Hex_Label_4]
Meter=String
X=[Hex_Tile_4:X]
Y=[Hex_Tile_4:Y]
MeterStyle=HEX_LABEL
Text=4
DynamicVariables=1
[Hex_Label_5]
Meter=String
X=[Hex_Tile_5:X]
Y=[Hex_Tile_5:Y]
MeterStyle=HEX_LABEL
Text=5
DynamicVariables=1
```