Does anyone know how (or if) an object's connection targets can be determined via script?
For example: If I wanted to connect three buttons (or 300) to various objects, and connect all of them to one specific script that could detect what [else] the calling button is connected to... Is this possible to do?
Script Question: Can an object's connections be polled?
Re: Script Question: Can an object's connections be polled?
You could create this functionality by yourself.
Create a function called for example addMyConnector(object, event, target, action) and a table e.g. allConnections, where you will store all connections and connected objects to them.
In addMyConnector call addConnector on object with other parameters passed to this function. And then store what you want to the allConnections table. Use this function in your scripts anytime you want to create a connection.
Then you should have all the data you need in allConnections table.
Something like this:
Not sure if we can use table.insert function in our grimrock scripts, but I hope you got the idea of what I am trying to do.
Create a function called for example addMyConnector(object, event, target, action) and a table e.g. allConnections, where you will store all connections and connected objects to them.
In addMyConnector call addConnector on object with other parameters passed to this function. And then store what you want to the allConnections table. Use this function in your scripts anytime you want to create a connection.
Then you should have all the data you need in allConnections table.
Something like this:
Code: Select all
allConnections = {}
function addMyConnector(object, event, target, action)
object:addConnector(event, target, action)
if allConnections[object.id] == nil
then
allConnections[object.id] = {target}
else
table.insert(allConnections[object.id], target)
end
end
Re: Script Question: Can an object's connections be polled?
That is pretty neat. I can see a use for it in my future projects.3socks wrote:...
Thanks