what is wrong with this script?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
azidahaka
Posts: 91
Joined: Fri Apr 13, 2012 9:48 pm

what is wrong with this script?

Post 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? :|
User avatar
Huff
Posts: 18
Joined: Fri Jun 22, 2012 9:47 pm

Re: what is wrong with this script?

Post by Huff »

Looks okay to me. What error are you getting?
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: what is wrong with this script?

Post 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.
"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
  • Message me to join in!
azidahaka
Posts: 91
Joined: Fri Apr 13, 2012 9:48 pm

Re: what is wrong with this script?

Post by azidahaka »

Huff wrote:Looks okay to me. What error are you getting?
no error the door just won't open
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: what is wrong with this script?

Post by Magus »

change the functionname "portaduomo1" to portaduomo1event or something like that. You can't use the same id name and functionname.
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Re: what is wrong with this script?

Post 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
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: what is wrong with this script?

Post by Komag »

don't forget to also connect with "deactivate" event, or "any"
Finished Dungeons - complete mods to play
azidahaka
Posts: 91
Joined: Fri Apr 13, 2012 9:48 pm

Re: what is wrong with this script?

Post 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
azidahaka
Posts: 91
Joined: Fri Apr 13, 2012 9:48 pm

Re: what is wrong with this script?

Post 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
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: what is wrong with this script?

Post by Neikun »

We are all here to help each other. Where you have stumbled, perhaps another might learn.
"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
  • Message me to join in!
Post Reply