Circumventing Event Timing

For questions about using Classic.

Post » Tue Dec 08, 2009 4:03 am

I'm trying as hard as I can to work around the lack of a wait function, but it just isn't working.
Every single event happens at once across the board, and attempting to prioritize or restrict the active events just causes freezing (using complex variable strings to kludge a wait function) or crashes (all the time division functions like 'while' just break eventually while waiting for input).

There needs to be a simpler way to call events and cause delays (and no, functions aren't effective, unless you make a different one for every single game event and make constant calls back and forth, in which case I may as well be coding.) I don't want an entire scene to flash by in a series of ticks because I have no way to slow it down.

Can someone help me figure out how to make the system wait without causing an endless loop or a crash?

What would also be useful is a 'wait until user input' plugin, because that would at least solve a couple of the problems with having any kind of pausing in your game (allowing for prompting in a turn-based system, for example.)
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 08, 2009 4:25 am

timer behavior, timeline object, key press and enabling/disabling groups.

Wouldn't any of those do the trick?
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Tue Dec 08, 2009 4:33 am

Timeline and timer seem to have a mind of their own, and attempts to work them in doubled the size of my event sheets and still didn't work.
Theoretically I could separate everything into individual groups, but that would be equally as convoluted as making a function for every little event lineup.

Keypress doesn't stop the system. It just allows for a key input while merrily wandering off through the code, even when I attempt to bracket it in with states/variables/groups/etc.
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Tue Dec 08, 2009 5:45 am

If your using behaviors that use timedelta, you could use timescale to stop those actions.
There's a nice article on the wiki about it.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Dec 08, 2009 7:34 am

I just make my own timers (globals or pv's) and use a state machine to control events. I've never had any problem with that, even with complex tasks like choreographing cut-scenes.

If you're having trouble with that method or the timeline object then I suggest you post your attempts so someone can help you work out a solution.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Dec 08, 2009 10:27 am

On the few occasions I've needed to delay the running of some actions, I'd just throw in the function object and call a function after a delay.

What are you doing that requires so many of these delays as to make it impractical?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Dec 09, 2009 2:15 am

A turn-based battle system that requires deliberate separation of events with delays in between, to prevent events from not happening in a sequential order, eg.

Player attacks (with corresponding movement)
Delay until it finishes and slight afterdelay
Damage floater
Delay until it finishes and slight afterdelay
Prompt for next turn

It just burns through all of the events over the course of five ticks and I see nothing but the variables jump from initiating to done, even with dozens of events in between. And then crashes because there is no way for it to wait for user input without causing an endless loop behind the scenes if the user does not input.

I'm attempting to get the hang of timescale, but it's honestly really confusing.
The call function after delay I have tried in multiple ways but I cannot seem to get it to work, as it does delay the function call but delays nothing else.

[quote="deadeye":2ndbd401]I just make my own timers (globals or pv's) and use a state machine to control events. I've never had any problem with that, even with complex tasks like choreographing cut-scenes.[/quote:2ndbd401]

This is more what I'm looking for.
I attempted to do this in a few different ways, and could not get it to actually work. Could you elaborate on how you do it?
B
2
S
1
G
3
Posts: 43
Reputation: 1,086

Post » Wed Dec 09, 2009 5:03 am

[quote:3r1yrsfh]Player attacks (with corresponding movement)
Delay until it finishes and slight afterdelay
Damage floater
Delay until it finishes and slight afterdelay
Prompt for next turn[/quote:3r1yrsfh]

I think I see what you mean. The function behavior probably is your best bet, but I would use it in combination with groups. You could then enable group player a with a function, at the same time disabling player b group.
Timescale would be better for messages, pop up windows, imputing stats, etc.
BTW the timer behavior does remember picked objects, but you cant make new timers. Its a bug I think, but you can add additional timer behaviors.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Dec 09, 2009 6:44 am

[quote="GoldMatenes":2ls5wqwb][quote="deadeye":2ls5wqwb]I just make my own timers (globals or pv's) and use a state machine to control events. I've never had any problem with that, even with complex tasks like choreographing cut-scenes.[/quote:2ls5wqwb]

This is more what I'm looking for.
I attempted to do this in a few different ways, and could not get it to actually work. Could you elaborate on how you do it?[/quote:2ls5wqwb]

Here's a simple version that does basically what you outllined:
http://www.box.net/shared/xdjh6kjg4d

A state machine is basically you defining the state of the game, however you choose, and restricting events based on what that state is. In this example I define the state in global('state'), and use global('state') as a condition to control events.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests