Can someone read through a script for me?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
barronvonburp
Posts: 30
Joined: Mon Jul 13, 2015 7:41 am

Can someone read through a script for me?

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

Re: Can someone read through a script for me?

Post 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
Finished Dungeons - complete mods to play
Post Reply