LAMP EFFECTS QUESTIONS

34 views
Skip to first unread message

james cardona

unread,
Jan 31, 2013, 7:38:10 AM1/31/13
to fre...@googlegroups.com
Hi all,
in the process of trying to understand and write some lamp effects.
Got some to work by copying others that already exist and seems like idea is to:
1 specify the lamps in a list
2 call on that list in an effect and
3 either turn off, turn on, or flash the lamps in the list

I got those type to work no problem - they work both in the game and in the test menu.

Now what I want to do is to write my own, which are more complex or different than above.  So I did like above but instead of lamps in a lamp list my effect turns on, off or flashes specific lamps in specific ways using lamp_tristate calls in a loop.  The lamps that I am calling were only ones specified in the leff definition (so I specified a lamp list in the md and reserved that list in the leff declaration).  The results being as follows:

If the leff is called during a game it works fine.  If called using test menu it does not work at all.  If called by start ball or start player it does not work at all.  It only works after valid playfield is set and during a game. 

Some of these effects are basically reminders to let the player know that certain features/modes are available or one shot away - since some of these things are one shot away at the start of a game, I wanted them to start then.


Brian Dominy

unread,
Jan 31, 2013, 8:03:19 AM1/31/13
to fre...@googlegroups.com
James,

You can certainly update specific lamps in a lamp effect, as long as they are included in the lamp set for that effect.  (If they are not, it might work but it is undefined behavior.)  Make sure to use the leff_on, leff_off, etc. variants and not lamp_on, lamp_off, etc.  Lamp effect state is kept in a different data structure than the default playfield lamps.  Don't use the tristate functions in a lamp effect.  If you want to flash a lamp you have to flash it yourself by calling on and off.  This lets you control the speed.

When you say it fails in test mode, are you using the Lamp Effect test in the development menu?  That should work OK, I was just looking at that recently.

I haven't tried from start_ball or start_player.  Those should work.  Lamp effects are reset prior to those events (see start_ball()), so I'm not sure why that wouldn't work.  Sounds like a bug... I'll look into it some more.

For these "reminder" type effects, it's probably best though to put code into a "lamp_update" event that checks the condition and either calls leff_stop() or leff_start().  That way it is constantly updated and correct.  Also keep in mind that lamp effects have priorities.  So it is possible one of your reminder leffs could be overtaken by some high priority light show.  When that finishes, you would want your reminder leff to start back again.  Doing this in a lamp_update function keeps it running.  (If a higher priority effect is already running, leff_start() will just return and not doing anything.)

The entire leff system was rewritten not too long ago and examples of how to do this properly are unfortunately not available anywhere.  One of these days I'll get back and update my WCS code to show how it should be done.

- Brian

james cardona

unread,
Jan 31, 2013, 8:09:55 AM1/31/13
to fre...@googlegroups.com, br...@oddchange.com
When I said it fails I should have been more specific.  I am using development - yes.  The dmd acts as if the effect is running but none of the lights change state.  the machine does not crash.  I am guessing this is all becuase I am using the wrong lamp call as you said.  Let me change all that and get back to you.
I will also play with lamp update

james cardona

unread,
Feb 1, 2013, 10:30:53 AM2/1/13
to fre...@googlegroups.com, br...@oddchange.com
I changed to leff_on / off instead of tristate and everything is working correctly now.  many thanks.

Aeneas Verhé

unread,
May 16, 2016, 7:17:56 AM5/16/16
to FreeWPC, br...@oddchange.com
Have no idea if anyone else is still active here.. but if so can you explain the lamp_update() ?

I believed the theory behind it was that freewpc unlights all lamps and then in each lamp_update() part you do a check to see if a specific lamp needs to be lit / flashing ?

Whilst testing this works but not always..
Does it work different when lamp_on() or lamp_tristate_on() or lamp_on_if() is used ?

Sometimes lamps correctly go out but most of the time they don't, hope someone can quickly explain me how it should work before I have to do a lot of trial and error.
I thought at least the lamps would be reset at the start of a new game but even that doesn't always happen ?
And whilst looking in the other machines code I often see lamp_on but less lamp_off so somewhere they need to be reset, no ?

And as sometimes lamps are used for different things I really hope it'd works like this..
ie when a timed mode is running I want one lamp to flash, otherwise it can be off or on, set in the lamp_update from another rule ..

  AE.


Cardona, James E.

unread,
May 16, 2016, 7:27:08 AM5/16/16
to fre...@googlegroups.com, br...@oddchange.com

I am no longer developing using freewpc. I sold my DM. Here is what I know.

 

I don’t remember the difference between tristate and on/off but I always used tristate and that always worked for me.

Also note that there is a flash function with tristate:

 

lamp_tristate_flash(LM_CLAW_ACMAG);

           task_sleep(TIME_500MS);

           lamp_tristate_on(LM_CLAW_ACMAG);

 

Not sure why your lamps do not always work. Perhaps a bug somewhere else.

 

From: fre...@googlegroups.com [mailto:fre...@googlegroups.com] On Behalf Of Aeneas Verhé
Sent: Monday, May 16, 2016 7:18 AM
To: FreeWPC
Cc: br...@oddchange.com
Subject: Re: LAMP EFFECTS QUESTIONS

 

Email sent from outside of PSEG. Use caution before using links/attachments.


--

---
You received this message because you are subscribed to the Google Groups "FreeWPC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freewpc+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

http://facebook.com/psegTwitterLinkedIn

PSEGSC



The information contained in this e-mail, including any attachment(s), is intended solely for use by the named addressee(s). If you are not the intended recipient, or a person designated as responsible for delivering such messages to the intended recipient, you are not authorized to disclose, copy, distribute or retain this message, in whole or in part, without written authorization from PSEG. This e-mail may contain proprietary, confidential or privileged information. If you have received this message in error, please notify the sender immediately. This notice is included in all e-mail messages leaving PSEG. Thank you for your cooperation.

Aeneas Verhé

unread,
May 16, 2016, 8:08:13 AM5/16/16
to FreeWPC, br...@oddchange.com
Hi,

Thanks for the quick answer.
Anyway I didn't explain well - my issue is not with turning a lamp on, but getting it off later.

I thought using lamp_on after a test, or using something like
    lamp_on_if (LM_HZ_BOULDER_GARDEN, flag_test (FLAG_HZ1LIT));
in the lamp_update() part would turn if off itself.

Now the lamp will turn on once the flag is true, but it will remain lit when the flag becomes false later.
Somehow I thought it'd turn off itself ?
Maybe some inconsistent behavior comes I have a mix of lamp_on, lamp_tristate_on and this lamp_on_if statements..
I'm not sure but it doesn't like I thought it would..

I can rewrite everything into
if ( flag_test (FLAG_HZ1LIT))
  lamp_on (LM_HZ_BOULDER_GARDEN)
else
  lamp_off (LM_HZ_BOULDER_GARDEN)

but that not what I wanted to do as some lamps can be lit from other parts of code too and here they'd get turned off again..

  Aeneas.

Cardona, James E.

unread,
May 16, 2016, 8:22:38 AM5/16/16
to fre...@googlegroups.com, br...@oddchange.com

You need to control the on and off states yourself. I usually do this one of two ways:

 

1)    Lamp is on or flashing for a short time for a special effect after a target hit. In below example, the target is hit so I flash the lamp then turn it on.

 

lamp_tristate_flash(LM_CLAW_ACMAG);

           task_sleep(TIME_500MS);

           lamp_tristate_on(LM_CLAW_ACMAG);

           leff_start (LEFF_BOT2TOP);

 

 

 

2)    Lamp is set on or flashing or off to indicate a condition. The lamp does not change state until you tell it to.

 

void acmag_reset (void) {

     acmag_mode_shots_made = 0;

     if (get_dm_mode(ACMAG_COMPLETED))    lamp_tristate_on (LM_CLAW_ACMAG);

     else                                 lamp_tristate_off (LM_CLAW_ACMAG);

}//end of function

 

 

From: fre...@googlegroups.com [mailto:fre...@googlegroups.com] On Behalf Of Aeneas Verhé
Sent: Monday, May 16, 2016 8:08 AM
To: FreeWPC
Cc: br...@oddchange.com
Subject: Re: LAMP EFFECTS QUESTIONS

 

Email sent from outside of PSEG. Use caution before using links/attachments.


Hi,

--


---
You received this message because you are subscribed to the Google Groups "FreeWPC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freewpc+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages