====== About the script ====== * Purpose : This script lets you subscribe and unsubscribe to an eventbus for each event. * Author : cdfa * Link: if needed, you may add a link here ====== How to use the script ====== Import this script, when you want to subscribe to a eventbus, copy/paste this in your script: LL.runScript("Eventbus", JSON.stringify({funct:"sub", obId:id_of_the_object_the_event_is_fired_on, name:"name of the event", action:EventHandler.action_you_want_to_execute, extra:any_extra_data_you_want_to_pass})) so for example LL.runScript("eventBus", JSON.stringify({funct:"sub", obId:196666, name:"i.tap", action:EventHandler.RUN_SCRIPT, extra:LL.getScriptByName("External Editor Script Importer").getId()})) Everything is save as a tag on the script, so if you delete the script it won't work anymore. If you want to unsubscribe to an eventbus just replace "sub" behind funct: with "unsub". ====== Script code ====== var script = LL.getCurrentScript(); var event = LL.getEvent(); var src = event.getSource(); var data = JSON.parse(event.getData()); var cont = event.getContainer(); var i, id function getOb(id){ if(id.toString().length==6){ ob=LL.getItemById(id); }else{ ob=LL.getContainerById(id); } return ob } if(src=="RUN_SCRIPT"){ if(data==null)throw "object is null"; var obId=data.obId; var name=data.name; var tagName = obId+name; var eventBus = JSON.parse(script.getTag(tagName)); if(eventBus==null)eventBus=[] var evHa = {action:data.action, data:data.extra}; var reAdding = false for(i=0;i