Timer and fx:setlight problems

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Timer and fx:setlight problems

Post by Lmaoboat »

I've almost finished a completely script self contained script for creating a number display, and to change the displayed number, I have to remove the lights and create them again. The only way to remove them is set the duration very low and have them time out, but even setting the duration to zero will have them still existing when the script does everything instantly. I didn't want to have to rely on extra external timers to make sure everything happens right, so a tried to make each script spawn it's own. There where my other problem is:

Code: Select all

spawn("timer", self.level, self.x, self.y, 3, "self.name".."time")

time = findEntity("self.name".."time")


time:setTimerInterval(0.1)

time:addConnector("activate", self.name, "makelight()")
time:addConnector("activate", self.name, "test()")

function test()
print("succsess")
end

time:activate()
I know it doesn't have anything to do with the naming, because it tried with static names as well. I'm not getting errors, but I still can't seem to get the timer to do anything.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: Timer and fx:setlight problems

Post by Montis »

Try the below (you need to replace "self" in the 3rd line to the script entity that contains the makelight function).

Code: Select all

spawn("timer", self.level, self.x, self.y, 3, self.id.."time")
	:setTimerInterval(.1)
	:addConnector("activate", self.id, "makelight")
	:addConnector("activate", self.id, "test")
	:activate()

function test()
print("success")
end

You might also want to add

Code: Select all

	:addConnector("activate", self.id.."time", "deactivate")
so it only runs once after activation.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: Timer and fx:setlight problems

Post by Lmaoboat »

Can't believe I was using self.name this entire time... and putting in quotes.
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: Timer and fx:setlight problems

Post by Lmaoboat »

Awesome, I think everything might just be working now! You have even hammer the button to no ill effect! Now just to write the timer part again because the editor crashed!
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: Timer and fx:setlight problems

Post by Montis »

Happy to help :)
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
Post Reply