Author Topic: Looking for the best practice for coping with the global variables problem  (Read 4089 times)

sabotrax

  • Guest
Hello,
in my profile, I want to check several conditions before executing a command.
For example before speeding up a ship in Star Citizen, I have to make sure that
I'm actually in a ship and also not in chat mode.
I want put all these checks in one command/function/method I'm going to call
prior to the real command. In the subcommand I would set "BOOL:pre_check = True"
and look for the state of it later.
As I understand it, all variables in VA a global. Which could, in my case, spawn some weird
bugs as I would be changing "pre_check" all the time.

Is there a better way to do this? Like making variables local or unique to the calling routine.

Thanks,
Marcus

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: Looking for the best practice for coping with the global variables problem
« Reply #1 on: February 09, 2017, 08:32:00 AM »
As I understand it, all variables in VA a global.

Not anymore... get the latest BETA and check manual at page 141
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Looking for the best practice for coping with the global variables problem
« Reply #2 on: February 09, 2017, 09:19:57 AM »
You could always name your variables different for each profile.  It's what I would do before the latest stuff.  Of course, I was doing simple stuff and not trying to build a CRM or anything like that.

sabotrax

  • Guest
Re: Looking for the best practice for coping with the global variables problem
« Reply #3 on: February 13, 2017, 06:56:48 AM »
Thanks for answering.
Is there an URL for the latest beta documentation?

Antaniserse

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 87
    • My VA plugins
Re: Looking for the best practice for coping with the global variables problem
« Reply #4 on: February 13, 2017, 07:28:51 AM »
Thanks for answering.
Is there an URL for the latest beta documentation?

A direct link, I think not... the PDF is include the installer, however
"I am not perfect and neither was my career. In the end tennis is like life, messy."
Marat Safin