Timer behavior - how it works?

For questions about using Classic.

Post » Fri Feb 26, 2010 4:36 pm

Hi there, I'm unable to solve this one issue. I have set Timer behavior for object Elektropole (electric field) and I want to make it turn on and off using timers. Every elektropole should have different on/off interval.

So I created this... http://dl.dropbox.com/u/3433127/Constru ... er%201.png

And every time I run game game crasher after while (I think on On timer event - everything else was toggled off).
When I try to debug, game crashes immediately saying that it is probably a bug in Construct.

So, it is or I have weird thing in my script that causes crashes? In fact, I really dunno how to use timers, because there is absolutely no info on wiki or here. Thanx for advice.

edit: ... and I'm using 99.82 without plugins.
B
1
G
2
Posts: 2
Reputation: 629

Post » Fri Feb 26, 2010 6:01 pm

Yay, you finally posted! :) Anyway, I thought you got the timer issue fixed after we went through it that time in chat?

I don't know why it's crashing for you though.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Fri Feb 26, 2010 6:07 pm

It looks like you have the expression to call your length variable written incorrectly. It's written in your length field as 'vypnuto' when it should be showing Elektropole.Value('vypnuto'). Also, I don't believe you have to stop the timer in your On Timer trigger if you've set your timer to No Repeat.

There used to be a bug in the Timer behavior where you couldn't start the Timer again from an On Timer event, but it was marked as fixed. It could be that it's not 100% fixed.

At any rate, it's easy to set up your own timer, so you may want to consider doing that. I have an example here if you'd like to take a look:
http://dl.dropbox.com/u/529356/customtimers.cap
v0.99.83

I've commented it so you can see how it works. It uses TimeDelta though, so if you're not familiar with the expression then I'd recommend checking out the wiki article.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 26, 2010 6:24 pm

[quote="Lost my Keys":2edkypgl]Yay, you finally posted! :) Anyway, I thought you got the timer issue fixed after we went through it that time in chat?.[/quote:2edkypgl]As I told you... I really love to solve problems myself... so when I am finaly posting here, it means definitive crisis. :twisted:
[quote="deadeye":2edkypgl]It's written in your length field as 'vypnuto' when it should be showing Elektropole.Value('vypnuto').[/quote:2edkypgl]Well, I attempted to do it even how you are writing, but it gives me same crashes, so I tested and tested almost everything.
[quote="deadeye":2edkypgl]Also, I don't believe you have to stop the timer in your On Timer trigger if you've set your timer to No Repeat.[/quote:2edkypgl]Even one of my tries. It helped once in other case, so I tested it even here.
[quote="deadeye":2edkypgl]There used to be a bug in the Timer behavior where you couldn't start the Timer again from an On Timer event, but it was marked as fixed. It could be that it's not 100% fixed.[/quote:2edkypgl]I really hope so, because I have strong failure feelings :)
[quote="deadeye":2edkypgl]At any rate, it's easy to set up your own timer, so you may want to consider doing that. I have an example here if you'd like to take a look: http://dl.dropbox.com/u/529356/customtimers.cap (99.83)[/quote:2edkypgl]Yep, it comes on my mind I really don't need timer behaviors at all... I just wanted to know, if I totaly suck in basic Construct scripting.
[quote="deadeye":2edkypgl]It uses TimeDelta though, so if you're not familiar with the expression then I'd recommend checking out the wiki article.[/quote:2edkypgl]TimeDelta is OK for me. Thank you.
B
1
G
2
Posts: 2
Reputation: 629


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests