Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there such a thing as a global variable/container that can be used across all 5 RCX program slots?

0
10 Posted

Is there such a thing as a global variable/container that can be used across all 5 RCX program slots?

0
10

Variables/containers are a function of the firmware and are both global and persistent. Persistent indicating that they keep their values from one run to the next. In Robolab the containers support both global and persistent features. In RIS, variables are reset to zero before your program starts rendering the firmware global and persistence useless. You can modify this default behavior by modifying the default macro in RCX2DEF.h located in the script\include directory of the RIS program directory. The default is to define: var MyVariable = 0 Which both defines the variable and initializes it. If you change it to: var MyVariable It will only define the variable and not initialize it. Now you may use this variable as a global variable. Just make sure you initialize it someplace, typically in program 1.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123