gderreck
2020-08-04 12:50:02
Greetings,
I am guessing the answer is somewhere in the manual, but I'm sure you'll know the answer. If it is, sorry for the inconvenience.
I have a translator in an always on preset, that changes presets based on a program change from my controller. So I have it set up in outgoing, so that the preset is selected based on the preset number. There are a bunch of if statements which assign the appropriate number to a variable, which gets used in the outgoing preset selection. OK, that works. However, it seems that I can't hard code a number for the preset. It is assigned by Bome.
So I thought, well you can select presets by name, so maybe I can create a string variable to hold the name of the preset. That doesn't seem to work either.
Do I have a point? Oh yeah..... :) If I delete a preset, then that throws the numbering off and I have to go and recode the logic to assign the correct preset number to the variable.
You have a way around this? The only other option I can think of would be to create a translator for each preset and use the preset name. That means an additional 14 translators which have to be maintained.
Any ideas?
Thanks,
Graham
Steve-Bome Forum Moderator
2020-08-04 17:15:00
Hi,
Variables in MT Pro are only 32 bit signed intergers so you cannot assign a variable a name.
What I generally do is put all the presets I want to change numerically in a given order and keep them in that order. Then I assign an offset to where the start of the numbered presets are. Then I select the preset by number.
For instance. Say the first 2 presets (0 and 1) are not part of the numbered preset scheme. Then I assign a global variable an offset of 2 and then in rules, I select by preset number but always offset the selected preset by 2. So say I have presets 2-16 as my numbered preset. I would set variable ga to 2 and in rules:
// pp is the preset number I want to set
// Lets say 4 for this exampe
pp=4
// Apply offset
pp=pp+ga
// Now I can enable or disable preset pp
Again, as long as i put my numbered presets that I want to manage all together and assign an offset I don't have to mess with anything. Say I added another preset in front of the numbered presets that I want to manage. Then I set ga=4 and then can add the new preset and I'm done.
I usually create an "Init" preset and translators that set all global variables at project open. That way I have one place to see what global variables I have assigned and their purpose.
Steve Caldwell
Bome Customer Care
Also available for paid consulting services: bome@sniz.biz
gderreck
2020-08-04 23:08:00
comment
Thanks Steve,
Much less maintenance with the offset.
Thanks
Graham
Steve-Bome Forum Moderator
2020-08-04 23:12:34
comment
Yes, glad to have helped!