Sorry, we don't support your browser.  Install a modern browser
This post is closed.

tryObjectEnter broken for stackable objects#477

tryObjectEnter does not behave as expected for stackable objects (tested with Custom Chips).

Example:

-- Container is named "foo", Object is named "bar"
function tryObjectEnter(container, object)
    print(container.getName()) --Expected: "foo", Actual: "foo"
    print(object.getName()) --Expected: "bar", Actual: "foo"
end

This is clearly a bug since it contradicts onObjectEnterContainer():

-- Container is named "foo", Object is named "bar"
function onObjectEnterContainer(container, object)
    print(container.getName()) --Expected: "foo", Actual: "foo"
    print(object.getName()) --Expected: "bar", Actual: "bar"
end

Of note, tryObjectEnter() seems to work as expected if grouping is attempted by pressing “G”, but has the broken behavior if stacking by picking up and dropping.

3 years ago

This may also be related: https://tabletopsimulator.nolt.io/71

3 years ago
Changed the status to
Research
3 years ago
B

Could we get some new example code?

The example is using tryObjectEnter, with two parameters. However, that event only takes one parameter. So the provided example code raises an error, object is expected to be (and is) nil.

3 years ago

Ah, the example code is using the wrong event, here is the corrected code:

-- Global script

-- Container and enteringObject are custom chip stacks

function tryObjectEnterContainer(container, enteringObject)
    print("container:" .. container.getName()) --Expected: "foo", Actual: "foo"
    print("enteringObject:" .. enteringObject.getName()) --Expected: "bar", Actual: "foo"
    return true
end

Also attached is an example save.

3 years ago
B
Changed the status to
Planned
3 years ago
B
Changed the status to
In Progress
3 years ago
Changed the status to
Completed
3 years ago