|
Post by howard on Mar 26, 2020 15:23:32 GMT
I see that many of the examples in the Streambyter manual contain an If Load statement at the beginning and then end with an End statement such as the Controller Value Remap Table near the end of the Streambyter manual. I use that a lot of that type of remapping but have found that adding the If Load statement to the top and ending it with the End statement doesn’t seem to do anything in my situation. I do have an If statement at the top of my code so that it applies of course only to specific CCs being sent and the whole thing ends with an End statement but I removed the additional If Load...End. Can you perhaps explain when we should be using the If Load statement and ending with End?
Thanks
|
|
|
Post by howard on Mar 27, 2020 19:38:52 GMT
Hmmm, I just found this thread, Nic, where you explained that an "IF Load" is used to send commands when a scene is loaded. Assuming I am correct that would explain why I don't need that command inside my script since I only want it run when a specific CC is sent rather than being run when the scene is loaded.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Mar 29, 2020 12:10:17 GMT
Hi howard, The if load/end clause is designed to execute rules only when the script is loaded (or you press 'Install Rules'). It is generally used to setup variables and other things that should only be done once and not with each incoming message. If rules are not inside an if load clause then they will be evaluated on each and every event which is likely to affect performance. In the case you mention (a lookup table), the lookup table is populated each time you receive that CC (you say the lookup table setup is inside the IF M0 == B0 clause), but this is still wasteful since you are repeating all those assign rules when you don't need to since they remain unchanged. In your case, it may not be significant but I would still encourage you to enclose any setup type stuff inside if load Regards, Nic.
|
|
|
Post by howard on Mar 29, 2020 17:13:22 GMT
Thanks for that reply, Nic. It sounds like I should always be using the If Load statement in my script since, as you pointed out, it only needs to be done once.
Howard
|
|