Figuring out current context of the template/script

I read the docs but could not find this:

  • is there any way to distinguish between memory or file that is not just filename check?
  • is there a way to get current array insides inside a struct that is part of an arrat?

Hello Digika. There is a function that you can use called ‘IsProcess()’ to figure out if the current target is a process. You should also be able to check the file name. Can you explain a little more about what you are trying to do with your second question? I’m not sure I understand the issue. Cheers!

Graeme Sweet

SweetScape Software

Imagine:

typedef struct {
    ubyte idx;
    if (InnerIndex() % 2 == 0)
        ubyte data[8];
} ArrayStrct;

ArrayStrct Strcuts[10];

In this case InnerIndex() is an imaginary function that returns current index of ArrayStrct declared by Strcuts[10];. So when 2 entry inside Strcuts is being populated, InnerIndex() will return contextual value 2

There are a few ways to do this. One way is to use a local variable outside the struct like this:

local int arrayIndex = 0;

typedef struct {
    ubyte idx;
    if (arrayIndex % 2 == 0)
        ubyte data[8];
    arrayIndex++;
} ArrayStrct;

ArrayStrct Strcuts[10] <optimize=false>;

Graeme
SweetScape Software

Is there any reason the internal counter 010 uses can’t be repurposed for this, to make it less ugly?

The internal counter is not available, but you can use structs with arguments to make it a little cleaner:

typedef struct (int index) {
    ubyte idx;
    if (index % 2 == 0)
        ubyte data[8];
} ArrayStrct;

local int i;
for( i = 0; i < 10; i++ )
    ArrayStrct Strcuts(i);

Graeme
SweetScape Software