It is currently May 4th, 2024, 8:13 am

Help recording measure's maximum value

Get help with creating, editing & fixing problems with skins
csm725
Posts: 46
Joined: August 16th, 2010, 4:29 pm

Help recording measure's maximum value

Post by csm725 »

The context is me wanting to be able to record the maximum CPU and GPU temperatures as reported by CoreTemp's MaxTemperature and MSI Afterburner's GPU Temperature.
The issue isn't getting the values, as that is working perfectly - what I want to but don't know how to do is infinitely check if a measure's current value is greater than its previous one.
If it is, I want to set a certain variable (say MaxCPUTemp)'s value to said value, and if not, do nothing.
Here is a flowchart if I'm confusing you:
Image
That's the way I would accomplish my goal, but I don't see how that's possible in RM.
Any ideas?
Thanks,
csm
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Help recording measure's maximum value

Post by Kaelri »

My Lua is a little rusty, so don't take this as a working example, but something like the following should work:

Code: Select all

function Update()

	--Get the current value of [MeasureCPUTemperature] and convert it to a number.
	msCurrentTemp = SKIN:GetMeasure('MeasureCPUTemperature')
	CurrentTemp = tonumber(msCurrentTemp:GetStringValue())
	
	--Get the current value of #PrevCPUTemp# and convert it to a number.
	PrevCPUTemp = tonumber(SKIN:GetVariable('PrevCPUTemp'))
	
	--Do the math and set variables accordingly.
	if CurrentTemp > PrevCPUTemp then
		SKIN:Bang('!SetVariable', 'MaxCPUTemp', CurrentTemp)
	end
	SKIN:Bang('!SetVariable', 'PrevCPUTemp', CurrentTemp)
	
end
Last edited by Kaelri on June 26th, 2012, 5:27 pm, edited 1 time in total.
Reason: Silly typos.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Help recording measure's maximum value

Post by Seahorse »

Not sure I understand what you are doing but the meter in my Cobalt suite does something along those lines.

Code: Select all

[MeasureCore1MaxTemp]
Measure=Calc
Formula=(MeasureCore1Temp > MeasureCore1MaxTemp) ? MeasureCore1Temp : MeasureCore1MaxTemp
MinValue=0
MaxValue=85
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt