Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Savage on December 18, 2005, 12:21:29 pm

Title: Need a solution for Key-pressed / key-reset event (Mantis 342 )
Post by: Savage on December 18, 2005, 12:21:29 pm
Hello,

I need the key pressed / rest  operator in an repeating event to switch on / off a generator as often as the player wants. I read about the failure in SEXP with this operator, but as I need it:

Does anybody knew a work around for this problem?

Present behaviour:
If the player switches on the generator the second time it goes on and off all the time, without a change to stop it.

Greetings
Malte
Title: Re: Need a solution for Key-pressed / key-reset ev
Post by: karajorma on December 18, 2005, 02:45:00 pm
The first thing to do is to stop using a repeating when in your events. Key-Pressed doesn't work well with events using when if any repeatition is required. Switch over to using every-time instead.

Second don't use the 1-4 keys. I know that they seem like the logical choice since nothing uses them in single player but you're asking for trouble if you use them in a repeating event too. I've had some limited success if I instead use one of the keys that actually has a current (but little used) purpose. B works pretty will in a mission with no bombers for instance.

There are some other pitfalls but at the moment mantis is taking an enormously long amount of time to load for me and I can't get to my original bug report to jog my memory. That should hopefully be enough to be getting on with for now.

EDIT  : As soon as I post Mantis suddenly spits out all my bug reports :D. Here's the original thread (http://www.hard-light.net/forums/index.php/topic,30921) I made when researching the problem. Unfortunately it looks like all the pictures are gone now.
Title: Re: Need a solution for Key-pressed / key-reset event (Mantis 342 )
Post by: Savage on December 18, 2005, 05:31:45 pm
With the every time operator. Everything works perfect now.

Using a Variable (0/1) to proof if the generator is on or off.

Thank you very much indeed!  :)
Malte