It is currently September 20th, 2021, 6:18 pm

Game: 2048

Skins that don't neatly fit into other categories
User avatar
balala
Rainmeter Sage
Posts: 13208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Game: 2048

Post by balala »

Image

I've created this game using the new HotKey plugin (http://rainmeter.net/forum/viewtopic.php?f=18&t=18849). It is totaly keyboard controled, and keeps the best score.
Comments are welcomed.
You do not have the required permissions to view the files attached to this post.
Last edited by balala on October 19th, 2016, 8:34 pm, edited 3 times in total.
User avatar
iNjUST
Posts: 117
Joined: June 20th, 2012, 12:44 am

Re: Game: 2048

Post by iNjUST »

Awesome!
rm_2048.png
However, as you can see, the corner tile disappeared once I hit 1024, and stayed that way even once it became 2048. My Log threw several errors similar to:

Formula: Syntax error: ((1>1)?0:[MeasureField41])
You do not have the required permissions to view the files attached to this post.
User avatar
killall-q
Posts: 282
Joined: August 14th, 2009, 8:04 am

Re: Game: 2048

Post by killall-q »

Optimization notes:

Currently the game cannot be played faster than 5 moves a second. I was able to set Update=-1, unrestrict move speed, and keep everything working the same with the following modifications:

Code: Select all

[Rainmeter]
Update=-1

[MeasureShowWinMessage]
IfTrueAction2,3=...[!SetOption MeterNo LeftMouseUpAction "[!HideMeterGroup Message][!Redraw]"]...
IfTrueAction4=...[!SetOption MeterNo LeftMouseUpAction "[!SetVariable Win 0][!Update]"]...

[MeasureMove...]
KeyDownAction=...[!Update]

[MeterResetBestScoreButton]
LeftMouseUpAction=[!SetVariable Win 3][!Update]

[MeterYes2]
LeftMouseUpAction=...[!Update]
The key is that HotKey plugin runs in real time, so you can use it to entirely drive skin updates.

You can also shorten some code by using IfMatch instead of IfCondition.
User avatar
balala
Rainmeter Sage
Posts: 13208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Game: 2048

Post by balala »

iNjUST wrote:However, as you can see, the corner tile disappeared once I hit 1024, and stayed that way even once it became 2048. My Log threw several errors similar to:

Formula: Syntax error: ((1>1)?0:[MeasureField41])
Yes, while I developed the skin, I had a few lines of code, that became useless, but I forgot to delete them. Now I did and hope that it solves the bug. I've reuploaded the skin, so please download it once again, reinstall it, then let me know the result. Sorry...
killall-q wrote:Optimization notes:

Currently the game cannot be played faster than 5 moves a second. I was able to set Update=-1, unrestrict move speed, and keep everything working the same with the following modifications:

The key is that HotKey plugin runs in real time, so you can use it to entirely drive skin updates.

You can also shorten some code by using IfMatch instead of IfCondition.
I had no idea that the Update=-1 is a valid code, but it seems that it is. I've updated the skin and reuploaded. Thank you for the suggestions.
User avatar
jsmorley
Developer
Posts: 22286
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Game: 2048

Post by jsmorley »

Yeah, Update=-1 in [Rainmeter] probably has limited uses overall, but can be a nice trick if your skin is entirely mouse driven, (like a launcher) or as in this case, driven by a plugin like HotKey that when run creates a Windows keyboard "hook", or "listener", and doesn't require Rainmeter updates to detect keystrokes.

Code: Select all

[Rainmeter]
Update=-1
DynamicWindowSize=1
AccurateText=1

[MeasureOne]
Measure=Calc
Formula=MeasureOne + 1

[MeterOne]
Meter=String
MeasureName=MeasureOne
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
LeftMouseUpAction=[!UpdateMeasure MeasureOne][!UpdateMeter MeterOne][!Redraw]
This skin will update [MeasureOne] and display [MeterOne] one time when loaded or refreshed, then just sit there forever, basically using zero CPU resources. (not that this example would use much anyway...)

When you click on the meter, the mouse actions, which are "event driven" in Windows and not dependent on the Update loop in Rainmeter, will cause the skin to take whatever actions you want, then go back to sleep...
User avatar
balala
Rainmeter Sage
Posts: 13208
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Game: 2048

Post by balala »

iNjUST wrote:However, as you can see, the corner tile disappeared once I hit 1024, and stayed that way even once it became 2048.
I'm sorry for these mistakes, but now the skin is indeed fixed. If you've downloaded the previous version (the one about whom I said that is fixed), redownload and reinstall it. I hope finaly it works well now. The bug was on MeasurePiece11, MeasurePiece12 and so on, where some of them had errors, and that's why the 1024 and 2048 dispeared from the lower left field. Similary the background of the second field from the first line has disappeared when the number reached 2048. This had nothing to do with the log errors, those was fixed yesterday.
Sorry for the inconveniences...