Page 52 of 396
Re: Ask a simple question, get a simple answer
Posted: Mon Mar 09, 2015 9:56 am
by zimberzimber
So it needs to be stereo?
Re: Ask a simple question, get a simple answer
Posted: Mon Mar 09, 2015 10:17 am
by minmay
Sounds NEVER need to be stereo. But 3D sounds CANNOT be stereo. 2D sounds can be stereo or mono.
Re: Ask a simple question, get a simple answer
Posted: Tue Mar 10, 2015 12:34 am
by THOM
is there a way to ask if a socket holds NOT a specific item?
I have 4 sockets. several doors have to open if the combination of gems in them is right.
so what works well is
Code: Select all
function socketContains(socket, item)
for _,i in socket:contents() do
if i.go.name == item then return true
end
end
end
function checkSockets()
if socketContains(gem_socket_A.socket, "green_gem") and
socketContains(gem_socket_B.socket, "green_gem")
then
waterwall_6.controller:deactivate()
else
waterwall_6.controller:activate()
end
end
But now I have to check if socketA has a gem, socketB has a gem, socketC has everything but not a gem, socketD has everything but not a gem.
Is there a way to deny the query?
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 12:29 am
by THOM
concerning to my previous post: it seems there is nothing like an "if not" command, right?
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 12:34 am
by Zo Kath Ra
THOM wrote:concerning to my previous post: it seems there is nothing like an "if not" command, right?
http://lmgtfy.com/?q=lua+if+not
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 12:50 am
by Isaac
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 1:37 am
by THOM
found out, this works
Code: Select all
if socketContains(gem_socket_A.socket, "green_gem") then
if not socketContains(gem_socket_B.socket, "green_gem") and
not socketContains(gem_socket_C.socket, "green_gem") and
not socketContains(gem_socket_D.socket, "green_gem")
then
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 9:49 pm
by Hei&Yin
Is it possible to make a ControllerComponent where you can add connectors, without scripting, inside the editor?
Have tried to use Component:addConnector(event, target, action) in a few ways without results.
Done a workaround using a LeverComponent for now.
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 10:13 pm
by minmay
Hei&Yin wrote:Is it possible to make a ControllerComponent where you can add connectors, without scripting, inside the editor?
Have tried to use Component:addConnector(event, target, action) in a few ways without results.
Done a workaround using a LeverComponent for now.
I have no idea what you are actually asking here. When you add a connector to a component, that component needs to have a corresponding event to trigger the connector. For example, LeverComponent has an onActivate event. When it calls its onActivate hook, it will also call any onActivate connectors that it has.
When a connector is triggered, it tries to find the target entity, and if successful, calls the action function in the component of that entity named "controller". For example, door objects have a ControllerComponent named "controller" with onOpen, onClose, and onToggle hooks, so the action can be "open", "close", or "toggle". script_entity objects have a ScriptControllerComponent named "controller" which can see all public functions defined in the object's ScriptComponent named "script", so if you define a function called "moo" in that ScriptComponent, a connector with that object as its target can use "moo" as an action.
Re: Ask a simple question, get a simple answer
Posted: Wed Mar 11, 2015 10:18 pm
by Isaac
minmay wrote:Hei&Yin wrote:Is it possible to make a ControllerComponent where you can add connectors, without scripting, inside the editor?
Have tried to use Component:addConnector(event, target, action) in a few ways without results.
Done a workaround using a LeverComponent for now.
I have no idea what you are actually asking here.
Sounds like Hei&Yin is looking for a node editor after a fashion... similar to Kismet/trueSpace/Blender logic & node material editors.
Visual scripting via the GUI.
@Hei&Yin: That doesn't exist in the editor; except as seen in the connector UI for triggers and teleporters. It could be a neat feature to add, but probably more work than it's worth. It's far easier to spend a day learning the basics of the task using script; unless you have a specific reason that demands a scriptless GUI?