Logic Machine Forum
Store value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Store value (/showthread.php?tid=5049)



Store value - AlexD - 24.10.2023

Hello, 

I have been testing some basic scripting with the use of helpers on the left. I tried to make a script to store a value from 0-100%, and get that value after 10 seconds. But on the storage.get value I dont recieve any updated value from the storage. I see that in the description there must be a specific value? Does that mean that I cant store a value between 0-100? 


Code:
-- set storage variable myobjectdata to a specified value (e.g. 0-100%)
storage.set('32/1/1', 0-100)
-- wait for 10 seconds
os.sleep(10)
-- mydata will be set nil when data was not found
Forrigetime = storage.get('32/1/11')



RE: Store value - admin - 24.10.2023

You don't need to use storage in a single script, you can simply use variables:
Code:
value = 10
os.sleep(10)
log(value) -- will log 10

Your script does not work because you have two different storage keys (32/1/1 and 32/1/11). If you want to work with objects/group addresses then you need to use grp.write()/grp.update() to write values and grp.getvalue() to retrieve them.


RE: Store value - AlexD - 24.10.2023

(24.10.2023, 07:49)admin Wrote: You don't need to use storage in a single script, you can simply use variables:
Code:
value = 10
os.sleep(10)
log(value) -- will log 10

Your script does not work because you have two different storage keys (32/1/1 and 32/1/11). If you want to work with objects/group addresses then you need to use grp.write()/grp.update() to write values and grp.getvalue() to retrieve them.

Thank you!