Torch activation help please (solution found)
Torch activation help please (solution found)
So I have a bunch of torch holders connected to trap doors. Place a torch, trap door closes. I however, cannot figure out how to get the doors to close when a torch is removed.
Last edited by Neikun on Thu Sep 20, 2012 12:05 am, edited 1 time in total.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Torch activation help please
Activation event: any.
Action: toggle.
Action: toggle.
Re: Torch activation help please
Code: Select all
function setorch()
if setorch: hasTorch=true ()
then sepit: close()
end
if setorch hasTorch=false()
then sepit: open()
end
There's a problem with my equal sign. I'm not sure what I've done wrong.
I have to go for a while, but please help.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Torch activation help please
you need to use "==", also you're using the brackets in the wrong places.
like
also I don't think you actually need any code here as the torch holders have activate events themselves. so you could just use a connector from the torch holder to the pit with the things I mentioned in my above post.
like
Code: Select all
if setorch:hasTorch() == true then
...
Last edited by Montis on Wed Sep 19, 2012 4:56 pm, edited 1 time in total.
Re: Torch activation help please
Neikun wrote:my current code where se means SouthEastCode: Select all
function setorch() if setorch: hasTorch=true () then sepit: close() end if setorch hasTorch=false() then sepit: open() end
There's a problem with my equal sign. I'm not sure what I've done wrong.
I have to go for a while, but please help.
Code: Select all
function setorch()
if setorch:hasTorch() then
sepit:close()
else
sepit:open()
end
end
Last edited by Shroom on Wed Sep 19, 2012 11:23 pm, edited 1 time in total.
Re: Torch activation help please
this is a good example of something done the straightforward way vs the logical way vs the elegant way, nice!
Finished Dungeons - complete mods to play
Re: Torch activation help please
The problem I was having was that I you'd put a torch on the holder and that would activate, but taking on off didn't do anything.Montis wrote:you need to use "==", also you're using the brackets in the wrong places.
likealso I don't think you actually need any code here as the torch holders have activate events themselves. so you could just use a connector from the torch holder to the pit with the things I mentioned in my above post.Code: Select all
if setorch:hasTorch() == true then ...
I'm going to try some of the code suggested and let you guys know what worked.
Why do I need == instead of just =
Is there a reason aside from that's just the language?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: Torch activation help please
So trying to run the new code,
I get the error after trying to put a torch in the holder.
Any ideas?
Edit: Changed the id of the function to something other than what's triggering the script, no error.
Note: I am still having no luck in getting the pits to open again when the torch is removed.
Code: Select all
function setorch()
if setorch: hasTorch () == true then :error: attempt to index global 'setorch' (a function value)
sepit: close()
else
sepit: open()
end
end
Any ideas?
Edit: Changed the id of the function to something other than what's triggering the script, no error.
Note: I am still having no luck in getting the pits to open again when the torch is removed.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: Torch activation help please
you seem to have lots of spaces everywhere
Edit: - ok - thats wierd, it looks like the code identifier was messing with the code i posted earlier too - there should be no spaces after the : or before the ()
Code: Select all
function setorch()
if setorch:hasTorch() then
sepit:close()
else
sepit:open()
end
end
Re: Torch activation help please
I use spaces cause I'm afraid of clutter D:
Testing code now.
EDIT: Still does not close when torch is removed.
Does anyone know if this is even possible?
current code:
Current results: Place torch on holder, pit closes. Remove torch, pit remains closed. Put torch on holder, pit remains closed.
Expected results: Place torch on holder, pit closes. Remove torch, pit opens. Put torch on holder, pit closes.
Testing code now.
EDIT: Still does not close when torch is removed.
Does anyone know if this is even possible?
current code:
Code: Select all
function setorchholder()
if setorch:hasTorch() then
sepit:close()
else
sepit:open()
end
end
Expected results: Place torch on holder, pit closes. Remove torch, pit opens. Put torch on holder, pit closes.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!