Static Variables?

Can static variables be defined without placing them inside of a callback?

For example, if I just want oscbankcolor to be equal to the OSC string “/dmxis/bank/0” throughout my script, can I somehow define it on a script wide level?

You mean global variables?
Sure….just declare them outside of the callback

I can define the variable, but I was having trouble assigning it to a value. It occurred to me that I can make the assignments inside of a On Activate callback and then they’ll all be pre-assigned when I load the Rackspace, correct?

Bonus question: if I wanted to store the ip address and port number for OSC messages into separate variables, would I define these an integers?

Well, perhaps if you showed us what you did rather than leaving us to speculate, we could probably help you better :slight_smile:

5 Likes

Sorry…

If I write this:

var oscbankcolor : OSCMessage
On Activate
OSC_SetAddress(oscbankcolor, “dmxis/bank/0”)
end

…then it should be available to all callbacks in the rackspace script, correct?

Here’s a better way to do this

var 
   oscbankcolor : OSCMessage

Initialization
   OSC_SetAddress(oscbankcolor, “dmxis/bank/0”)
end
1 Like

Thank you. Do you have a comment for my other question? Can I define the IP address and port number for the osc messages into a variable? This will be repeated dozens of times and I want to make sure I have a way ti easily edit the port number and/or IP address.

Thanks again.

Which question?

Yes you can, of course.

1 Like

Yep - checkout the GP Script language manual
https://gigperformer.com/docs/GPScript40/

2 Likes

IP address is a string.

1 Like

Thanks I’ll try that. It wasn’t compiling the other way.

If you look at the actual system functions, the required types are clearly defined

https://gigperformer.com/docs/GPScript40/content/reference/list-of-functions.html

Also, there are numerous short cut functions for sending OSC messages

https://gigperformer.com/docs/GPScript40/content/reference/list-of-functions.html#osc

2 Likes