Page 1 of 1

what is wrong with this script?

Posted: Sat Oct 06, 2012 6:06 pm
by azidahaka

Code: Select all

function portaduomo1()
    if torch_holder_1:hasTorch() == true and
    torch_holder_2:hasTorch() == true then
        portaduomo1:open()
    else
        portaduomo1:close()
    end
end
isn't this very basic? :|

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 6:10 pm
by Huff
Looks okay to me. What error are you getting?

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 6:10 pm
by Neikun
You can achieve this without scripting, if this helps.
Place a counter with intial value of 2
Connect both torch holders to it twice.
Each torch holder should have the two following connections:
event: activate/target:counter/action: decrement
event: deactivate/target:counter/action: increment

Then the counter should be hooked up to what you want with activation any, target the door, action toggle.

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 6:16 pm
by azidahaka
Huff wrote:Looks okay to me. What error are you getting?
no error the door just won't open

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 6:39 pm
by Magus
change the functionname "portaduomo1" to portaduomo1event or something like that. You can't use the same id name and functionname.

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 7:04 pm
by crisman
I think you need to connect the torchholder to the script!7

EDIT: oh I think magus is right. Didn't noticed the function has the same name as the door id

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 7:08 pm
by Komag
don't forget to also connect with "deactivate" event, or "any"

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 8:22 pm
by azidahaka
Magus wrote:change the functionname "portaduomo1" to portaduomo1event or something like that. You can't use the same id name and functionname.
wow i'll try right away.. sound like the silliest of things :P

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 8:29 pm
by azidahaka
ooooook...

works now but i did had to connect in "anY" version thanks guys, i'm weak at scripting but this sounded so silly not working :D

Re: what is wrong with this script?

Posted: Sat Oct 06, 2012 11:20 pm
by Neikun
We are all here to help each other. Where you have stumbled, perhaps another might learn.