Accessing "Box Object" Private variables from Python?

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Is it possible to access a "Box" object's private variables from Python?

    (Just to be clear, by "Box" object, I mean the object found in the "Insert new object" dialogue you get from right clicking in the layout editor.)

    I've tried using the following python expression,

    Box.Value( 'privateValueName' )[/code:38ktw271]
    
    but it does not seem to work. I get nothing back.
    
    Now, for other object types, such as "Sprites" or "Panels", it does work.
    
    Am I doing something wrong, or can python simply not access "Box" object variables?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • [quote:1iw8l0zl]Is it possible to access a "Box" object's private variables from Python?

    No, not directly. A recompile of Box.csx would probably fix it so it uses the updated code that Sprite uses.

    A current solution is to use a hybrid event/python approach by setting a python variable to one of the box private variables with the "Run Script" System action.

    + System: Start of layout

    -> System: Run Script ("foo=" & Box.Value('foo'))

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)