0

I defined a system variable in my CAPL file that I use to set up different modes in my script.

I declared it in my CAPL file and not in my CANAlyzer window in order to allow the script to work with different configs.

sysDefineNamespace("NameSpace");

sysDefineVariableInt("NameSpace","VariableName",0);

The declaration has worked because I can change the value of this system variable with on key events.

The problem is with on sysvar events, the syntax that I saw on the internet is not working. I use this one:

on sysvar NameSpace::VariableName{
  sysSetVariableInt("NameSpace","VariableName",0); //init tout à off
}

I get a compilation error :

Compiling...
Options: CANalyzer, Realtime
Name (1, 11) Error 1249: Variable name 'NameSpace' not found
Compilation errors.

I'm pretty sure it is a syntax error but I didn't manage to fix it.

Thank you for your help !

I tried to change the syntax several time without success.

3
  • AFAIK the event handler on sysvar can only be used with system variables that are defined at compile-time. Commented Feb 21, 2023 at 13:24
  • Thank you for your answer. So I guess I can only use it with system variable that were defined in my CANalyzer .cfg file? Commented Feb 22, 2023 at 10:53
  • Exactly. That is my understanding. System variables created at runtime, i.e. via CAPL can only be used to hold data, but on sysvar events will not be triggered. Commented Feb 22, 2023 at 14:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.