Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1621

Help: Rainmeter Skins • Re: Tamagochi game help

$
0
0
yes yes yes! because in the current code if u test it urself when u click feed it forces the full heart to display half_heart.png when i want it to skip it
Is this what you want?
[SkinFolder]\@Resources (heart0.png = dead heart, heart1.png = half heart, heart2.png = full heart):
heart0.png
heart1.png
heart2.png
[SkinFolder]\Skin.ini (must use numbered heart<number>.png images):

Code:

[Variables]Order0=2Order1=1Order2=0OrderIndex=-1[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1---Measures---[HeartLevel]Paused=1Measure=LoopStartValue=0EndValue=2Increment=1LoopCount=3IfCondition=(([#OrderIndex]=2)&&([&HeartLevel]=0))IfTrueAction=[!SetOptionGroup Hearts ImageName "#@#Heart0.png"]OnUpdateAction=[!SetVariable OrderIndex (([HeartLevel]=0)?((3+#OrderIndex#+1)%3):(#OrderIndex#))][!SetOption Heart[#Order[#OrderIndex]] ImageName "#@#Heart[HeartLevel].png"]DynamicVariables=1---Meters---[Background]Meter=ImageSolidColor=0,0,0,128W=500H=150UpdateDivider=-1[Heart0]Group=HeartsMeter=ImageX=10rY=10rImageName=#@#Heart0.png[Heart1]Group=HeartsMeter=ImageX=10RY=0rImageName=#@#Heart0.png[Heart2]Group=HeartsMeter=ImageX=10RY=0rImageName=#@#Heart0.png[FeedButton]Meter=ImageX=10Y=10RW=480H=20SolidColor=0,255,0,255LeftMouseUpAction=[!UnpauseMeasure HeartLevel]DynamicVariables=1
This is just an example of one way of doing it, if it's what you need, it's up to you to implement it in your skin environment.

Details:
- I used 0 based numbering, as it's easier from a mathematical point of view, when you use % aka modulo aka a division remainder
- you can set the order in which hearts are filled by modifying the OrderN variables, e.g. Order<sequence> = <heartindex> (heart2 to heart0 above)
- the OrderIndex variable is the item in the sequence that's currently filling, e.g. if OrderIndex=2 above then the heart at Order2 aka heart0 is filling
Process:
- we start with heart0.png aka a dead heart in every [HeartN] meter
- on clicking the feed button, we unpause the paused [HeartLevel] measure
- in [HeartLevel], we go from 0 (dead heart Value) to 2 (full heart Value) by 1 increments, a number of times equal to the number of hearts aka 3
- on each [HeartLevel] update, we either keep OrderIndex the same or we increase it to start filling the next heart in the OrderN sequence
- if we filled all hearts, we reset all [HeartN] meters to heart0.png aka a dead heart, just in case we want to fill them forever if LoopCount=0
Notes:
- normally, the IfCondition for all hearts filled should have been (([#OrderIndex]=0)&&([&HeartLevel]=0)), but since we never manually update the [HeartLevel] measure in order to not fill more than one step at a time, the value of the OrderIndex variable is always one update behind, thus (([#OrderIndex]=2)&&([&HeartLevel]=0)) meaning when we're on the last (order of 2) heart in the sequence and the level of the first in the sequence is 0
- the order of filling can be adjusted from the OrderN variables
- the direction of filling (dropping / increasing) can be adjusted from StartValue, EndValue and Increment, with corresponding numbers in the IfCondition and corresponding images as the ImageName values
References:It may take a bit to wrap your head around the usage of nested variables, like increasing OrderIndex to "jump" to the corresponding Order<OrderIndex> and set the option of the appropriate Heart meter to an image based on HeartLevel, but if anyone else knows a better or easier way, be my guests. Assuming I understood what you meant correctly, that is.

Statistics: Posted by Yincognito — 57 minutes ago



Viewing all articles
Browse latest Browse all 1621

Trending Articles