How to make this time ticker work?

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
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

How to make this time ticker work?

Post by kelly1111 »

Hello Fellow modders,

I am trying to make this next script run. the numbers 9,10,11 - should open wallgratings simutaniously at the same tick, but I am getting the code wrong I geuss. how do I combine them into one tick?
obviously placing the numbers in brackets does not work... i've also tried {"9,10,11"}, and only "9,10,11",

function dmgrat9tick()
local seq = {4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,{9,10,11},}

findEntity("dungeon_wall_grating_"..seq[step]).door:open()

step = step%#seq+1
end
User avatar
Zo Kath Ra
Posts: 944
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: How to make this time ticker work?

Post by Zo Kath Ra »

I don't understand your script :(
What is the purpose of the 4's?
It looks like you keep opening "dungeon_wall_grating_4".

What do you want the script to do?
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: How to make this time ticker work?

Post by Isaac »

*Untested!

Code: Select all

function dmgrat9tick()
	local seq = { 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
					 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
			 		4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
					 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
					 {9,10,11},}
	if type(seq[step]) == "table" then
              for x = 1,#seq[step] do
                    findEntity("dungeon_wall_grating_"..seq[step][x]).door:open()
              end
         else
	   findEntity("dungeon_wall_grating_"..seq[step]).door:open()
        end
	step = step%#seq+1
end
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: How to make this time ticker work?

Post by kelly1111 »

I don't understand your script :(
What is the purpose of the 4's?
It looks like you keep opening "dungeon_wall_grating_4".

What do you want the script to do?


each 4 is a tick that opens the same grating (somewhere in nomansland) ... what I need it to do is open the gratings with numbers 9,10,11 .. simultaniously ...but what code do I use for it?

I can get the gratings to open in order if I would do it like this :

4,4,4,4,4,4,4,4,9,10,11, ... but what I want is 9,10,11 to open on the exact same time (the same tick) ... how would I put them together as a group in this script ?
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: How to make this time ticker work?

Post by Isaac »

kelly1111 wrote:...what I need it to do is open the gratings with numbers 9,10,11 .. simultaniously ...but what code do I use for it?
... how would I put them together as a group in this script ?


Does the script in post #3 [above] not work in the way you need?
(Either in place of, or as an example to look at, and make your own.)
Post Reply