Page 1 of 1

Can someone read through a script for me?

Posted: Fri Aug 21, 2015 5:43 am
by barronvonburp
I am (relatively) new to coding, and I discovered that for a puzzle I am making, (you have to have at least 6 levers pulled) counters do not activate when the number is below zero. Therefore I was drafting up a code to essentially fix that and for the life of me I cannot figure out what is wrong with it.

Code: Select all

function test()
-- Registers function
if counter_(x) <=x -- Checks if counter is greater than or equal to x
then
force_field_x.entity:deactivated() -- activates forcefield.
-- dungeon_door_portcullis_x.door:open() if your using a door
elseif counter_x > x -- Checks if counter is less than x.
--elseif might be able to just be else?
then
force_field_x.entity:deactivated() 
-- dungeon_door_portcullis_x.door:close() if your using a door
end
end

Re: Can someone read through a script for me?

Posted: Fri Aug 21, 2015 1:19 pm
by Komag
Your greater than and less than are mixed up. If you want to see if A is greater than or equal to be it's
IF A >= B