ZBrushCentral

Variable name should not exceed 127 characters in length

hi there !
got some questions for you @Marcus_civis :rofl:
I wonder about what happen in that so basic routine because, it returns this next error :
variable name should not exceed 127 characters in length.

here is the script :

[VarDef, a, 1] 

[RoutineDef, testRoutine, [Note, a], a]

[IButton,???,"testing routine.",
    [VarSet, a, 2]
    [RoutineCall, testRoutine, a]
]

i get that error when i keep the variable a as global scope, if i remove it then the script is works fine.

Now change the type of the global variable from INT to STR, and it will compile, even if you have different values in global and local variable values assignment

[VarDef, a, "1"]

[RoutineDef, testRoutine,
        [Note, a]    
,a]

[IButton,???,"testing routine.",
    [VarSet, a, 2]
    [RoutineCall, testRoutine,a]
]

note i use a as variable name but it will be the same with anything else then a

Nicolas

Hi Nicolas,

I’ve no idea really. But I think it is best to avoid naming routine arguments the same as global variables. I’ve certainly had problems that have been difficult to track down caused that way. This works fine for me:

[VarDef, a, 1] 

[RoutineDef, testRoutine, [Note, arg], arg]

[IButton,Testy,"testing routine.",
    [VarSet, a, 2]
    [RoutineCall, testRoutine, a]
]

HTH,
Marcus

1 Like

ooh good sight Marcus ! I did not thought about that, and yes it makes senses somehow even if what happen behind the curtain stay behind the curtain hehe :slight_smile:

I got another issue on another attempt i got on looping zscript using zscript:previous, but i keep that to another topic so the title would reflect with the true purpose.

thank you again, about your great help, and we learnt something today,
is that is not good to have global variable name that are used as argument in routinedef and routinecall.

Best regards
Nicolas

1 Like