Trevliga Spel forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Scripting: Using Variables and Math in CCs

2 posters

Go down

Scripting: Using Variables and Math in CCs Empty Scripting: Using Variables and Math in CCs

Post by jtints Tue Jan 23, 2024 12:38 am

I am working on a series of buttons. One type of button is a toggle that will turn on and off with specific values. To make changing the values easier for each button, I would like to use variables. I get an error about the channel needing to be between 1-16 with this script.

I know I am doing something incorrectly here. Would anyone be able to point me in the right direction?

Thanks, - J


Code:
[(init){@local_bu:3} {@local_ch:1} {@local_co:1}]
[(press){cc:#@local_ch#,#@local_co#,#@local_bu#}]
[(release){state:1}]
[(press){cc:#@local_ch#,#@local_co#,#@local_bu+64#}]
[(release){state:0}]
[(cc:#@local_ch#,#@local_co#,#@local_bu#){state:1}{nextpress:2}]
[(cc:#@local_ch#,#@local_co#,#@local_bu+64#){state:0}{nextpress:1}]

jtints

Posts : 37
Join date : 2024-01-22

Back to top Go down

Scripting: Using Variables and Math in CCs Empty Re: Scripting: Using Variables and Math in CCs

Post by Admin Tue Jan 23, 2024 9:48 am

Unfortunately, the script engine does not handle variable references in events like that.

You can have a variable event where the event triggers the command if a variable value fulfills the event, e.g., (@local_bu:10), but besides that, you can't have variable references and math in events.
Admin
Admin
Admin

Posts : 965
Join date : 2020-03-26

https://trevligaspel.forumotion.eu

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum