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.

Equal script to FBeditor input selection switch
#1
Hello

Is someone having a more simple event based script that is equal to FBeditor Input selection switch?

Code:
require('custom.fbeditor20.Select_switch')

functions_Select_switch_json_fbe_input_selection_switch_input_1 = grp.getvalue('2/4/0')
functions_Select_switch_json_fbe_input_selection_switch_input_2 = grp.getvalue('32/1/7')
functions_Select_switch_json_fbe_input_selection_switch_input_3 = grp.getvalue('32/1/6')
out = fbe_input_selection_switch(functions_Select_switch_json_fbe_input_selection_switch_input_1, functions_Select_switch_json_fbe_input_selection_switch_input_2, functions_Select_switch_json_fbe_input_selection_switch_input_3, 'fb__Setpunktvalg_A101__fbe_input_selection_switch__id')
if out ~= nil then
    grp.write('2/0/51', out)
end
Reply
#2
Something like this should do.

TAG all input objects and select and create event script from this TAG
Code:
select = grp.getvalue('1/1/1')
input1 = grp.getvalue('1/1/2')
input2 = grp.getvalue('1/1/3')
input3 = grp.getvalue('1/1/4')
outgrp = '1/1/5'



if select == 1 then
grp.checkwrite(outgrp, input1)
elseif select == 2 then
  grp.checkwrite(outgrp, input2)
elseif select == 3 then
  grp.checkwrite(outgrp, input3) 
end
------------------------------
Ctrl+F5
Reply
#3
Thank you, it works very well.

Is it possible to add an delay in the script, so it waits few seconds before it runs when the select switch change state?
Reply
#4
Adding delay in event script which is triggered by few objects is not recommended as it will run each time when change happen and each time delay will start. You may end up in situation when not correct input is selected in time.

Delay is simply added like this
-- wait for 1.5 seconds
os.sleep(1.5)
------------------------------
Ctrl+F5
Reply


Forum Jump: