This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Log only objects changes / remove storage files
#3
(03.10.2016, 07:11)admin Wrote: The only solution that I see is that you create another object for each one you want to log and then filter the input value in an event script.

Add this to Common functions:
Code:
function checkupdate(sendto, mindelta)
 -- event value
 local newvalue = event.getvalue()
 -- current object value
 local curvalue = grp.getvalue(sendto)
 -- absolute delta between event and current value
 local valdelta = math.abs(curvalue - newvalue)
 -- send if delta value is large enough
 if valdelta >= mindelta then
   grp.update(sendto, newvalue)
 end
end

Create an event script for each object where you want to log only value changes. 1/1/1 is your "virtual" object which is logged, 2 is minimum delta between current "virtual" object value which causes new value to be sent. Adjust as needed.
Code:
checkupdate('1/1/1', 2)

As for storage, do you mean script storage? In newer releases it's stored in a separate database and there's no easy way to delete some of the entries unless you know all of their names. You can only do a full clear operation.
Thank you for the answer, unfortunately for object logging it doesn't seem optimized solution, probably i will switch to general logging where i can filter what and when to log it.
By the way, is there any way i could check objects previous state before the database update and without using storage?


For the second question I mean storage used by storage.get and storage.set
Thank you in advance
George
Reply


Messages In This Thread
RE: Log only objects changes / remove storage files - by gtsamis - 03.10.2016, 09:08

Forum Jump: