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.

Universal script
#1
Hi, I'm not very knowledgeable about Lua programming. I have several of the same scripts that are different in group addresses. The latter shifts by 1, for example 1/3/10, 1/3/11 etc. Is it possible to write one universal script that would adjust the other addresses in it according to the incoming address and execute?

thanks

example:
roofopenclose = grp.getvalue('2/3/10') --address coming from basalte
roofopen = grp.getvalue ('2/3/200') --address for the actuator
roofclose = grp.getvalue ('2/3/201') -- address for the actuator

if roofopenclose == false then
  grp.write('2/3/200',1) --command OPEN for ROOF 1 actuator
  os.sleep(1) --long push
  grp.write('2/3/200',0) --command for actuator
elseif roofopenclose == true then
  grp.write('2/3/201',1) --command CLOSE for ROOF 1 actuator
  os.sleep(1) --long push
  grp.write('2/3/201',0) --command for actuator
end
Reply


Messages In This Thread
Universal script - by Borek - 03.10.2022, 15:21
RE: Universal script - by admin - 04.10.2022, 06:30
RE: Universal script - by Borek - 04.10.2022, 16:16
RE: Universal script - by admin - 05.10.2022, 06:35

Forum Jump: