Jump to: navigation, search

Difference between revisions of "SkeletonGame"

(Created page with " == Skeleton Games HD Programming Reference. == This is meant to be a programming reference for commands, and simple snippets eventually. For setup and getting started with...")
 
 
Line 1: Line 1:
 +
== Programming Reference ==
  
== Skeleton Games HD Programming Reference. ==
+
This is meant to be a reference for commands, and simple snippets eventually.  For setup and getting started with sample files start at the main SkeletonGame [http://skeletongame.com/ website].
  
This is meant to be a programming reference for commands, and simple snippets eventually. For setup and getting started with sample files start at: http://skeletongame.com/
+
=== Machine Config YAML ===
 +
This is where you define your attached hardware sorted by board.
  
----
+
==== PD-16 (coil-driver board) ====
 +
Define coils or flashers on the PD board using the <code>Ax-By-z</code> format.
 +
 +
''x'' is the '''Board ID''' (0-16) and must not conflict with any other ''PD-LED'' or ''PD-16''
 +
<br>
 +
''y'' is the '''Bank''' on board.  So, '''Bank A''' is 0, '''Bank B''' is 1
 +
<br>
 +
''z'' is the '''Switch ID''' on the bank (0-7).  Pin 1 is '''Switch ID 0'''
  
Machine Config YAML:  
+
Custom <code>tags</code> can also be used. See Advanced section.
This is where you define your attached hardware sorted by board.
 
  
PD-16 (coil-driver board)
+
An example of coil configuration:
Define coils or flashers on the PD board Ax-By-z
 
x=board ID (0-16) must not conflict with any other pd-led or pd-16
 
y=bank on board bank A=0; bank B=1
 
z=switch id on that bank (0-7) pin 1 is switch ID 0
 
Tags; Need more detail whats all available, custom tags can also be used, see advanced section
 
Example;
 
  
    trough:
+
trough:
 
         number: A0-B0-3
 
         number: A0-B0-3
 
         pulseTime: 30  # the duration of the pulse, in ms.  Default is 32ms
 
         pulseTime: 30  # the duration of the pulse, in ms.  Default is 32ms
    plunger:
+
plunger:
 
         number: A0-B0-4
 
         number: A0-B0-4
 
         tags: autoPlunger
 
         tags: autoPlunger
Line 26: Line 28:
  
  
SW-16 (switch input board)
+
==== SW-16 (switch input board) ====
Switches can be Optos or standard, there are certian name reserved for special cases
+
 
''trough1'' (or Trough1) must be numbers at end for each ball.   
+
Switches can be ''Optos'' or ''Standard''.  Certain names are reserved for special cases, like
''troughJam
+
<code>trough1</code>.  There must be numbers at end for each ball.   Some examples of reserved names:
shooter  
+
 
startbutton
+
  troughJam
tilt
+
shooter  
exit
+
startbutton
down
+
tilt
up
+
exit
enter''
+
down
 +
up
 +
enter
 +
 
 +
Switch example:
  
Example;
+
PRSwitches:
PRSwitches:
+
  # **** Format ****
    # **** Format ****
+
  # name:
    # name:
+
  #  number: <number>
    #  number: <number>
+
  #  type: <type>
    #  type: <type>
+
  #
    #
+
  #  <number> SW-16 board ID multiplied by 16 plus switch number. ID-0 bank-A Switch-0 is "0".  The second bank adds 8 or range is switch 8-15
    #  <number> SW-16 board ID multiplied by 16 plus switch number. ID-0 bank-A Switch-0 is "0".  The second bank adds 8 or range is switch 8-15
+
  #  <type> can be: 'NO' (normally open.  This is the default; so no need to use this)
    #  <type> can be: 'NO' (normally open.  This is the default; so no need to use this)
+
  #                  'NC' (normally closed.  Common for optos)
    #                  'NC' (normally closed.  Common for optos)
 
 
     flipperLwL:
 
     flipperLwL:
 
         number: 8
 
         number: 8
Line 61: Line 66:
 
         tags: anyswitch
 
         tags: anyswitch
  
PD-LED
+
 
LEDs can be single color or RGB
+
==== PD-LED ====
 +
 
 +
LEDs can be single color or RGB.
 +
 
 +
Example:
 +
 
 
     #################################################################
 
     #################################################################
 
     # LED numbering format: Ax-Rr-Gg-Bb
 
     # LED numbering format: Ax-Rr-Gg-Bb
Line 79: Line 89:
 
         polarity: False
 
         polarity: False
  
 +
== Coils ==
 +
Code examples for using coils.
  
----
+
<code>self.game.coils.''coilname''.enable()</code>:  Enable coil.  Turn on full power, useful for lamps.  '''Warning!''' this setting can fry coils.
 
+
<br>
 
+
<code>self.game.coils.''coilname''.disable()</code>: Disable coil.
== Coil ==
+
<br>
 
+
<code>self.game.coils.''coilname''.pulse()</code>:  Pulses coil with either default pulse or defined pulse in config YAML.
enable coil - self.game.coils.''coilname''.enable() - are there any arguments for this?
+
<br>
turn on full power, usefull for lamps, warning can fry coils.
+
<code>self.game.coils.''coilname''.schedule(schedule=0x80808080, cycle_seconds=0, now=True)</code>:  Activates coil driver on an ''on/off'' pattern an allows for custom patterns. Parameters include '''schedule''', an 8 digit pattern based on  intensity (1-F),  ''''cycle_seconds''' and '''now''' (True/False) - assume start time?
enable coil - self.game.coils.''coilname''.disable() - are there any arguments for this?
 
turn off power.
 
pulse coil - self.game.coils.''coilname''.pulse() - are there any arguments for this?
 
pulses coil with either default pulse or defined pulse in config YAML.
 
pulse on pattern - self.game.coils.''coilname''.schedule(schedule=0x80808080, cycle_seconds=0, now=True)
 
activates coildriver on a on off pattern.
 
-schedule - 8 digit pattern based on  intensity can be 1-f
 
-cycle_seconds - no clue here
 
-now=True/False - assume start time?
 
 
 
Example;
 
        self.game.coils.becon.enable()
 
        self.game.coils.becon.disable()
 
        self.game.coils.magnet.pulse()
 
        self.game.coils.scoopflasher.schedule(schedule=0x80808080, cycle_seconds=0, now=True)
 
 
 
----
 
 
 
  
 
== Advanced ==
 
== Advanced ==

Latest revision as of 18:45, 21 February 2020

Programming Reference

This is meant to be a reference for commands, and simple snippets eventually. For setup and getting started with sample files start at the main SkeletonGame website.

Machine Config YAML

This is where you define your attached hardware sorted by board.

PD-16 (coil-driver board)

Define coils or flashers on the PD board using the Ax-By-z format.

x is the Board ID (0-16) and must not conflict with any other PD-LED or PD-16
y is the Bank on board. So, Bank A is 0, Bank B is 1
z is the Switch ID on the bank (0-7). Pin 1 is Switch ID 0

Custom tags can also be used. See Advanced section.

An example of coil configuration:

trough:
       number: A0-B0-3
       pulseTime: 30   # the duration of the pulse, in ms.  Default is 32ms
plunger:
       number: A0-B0-4
       tags: autoPlunger
       pulseTime: 30   #pulsetime is optional


SW-16 (switch input board)

Switches can be Optos or Standard. Certain names are reserved for special cases, like trough1. There must be numbers at end for each ball. Some examples of reserved names:

troughJam
shooter 
startbutton
tilt
exit
down
up
enter

Switch example:

PRSwitches:
 # **** Format ****
 # name:
 #   number: <number>
 #   type: <type>
 #
 #   <number> SW-16 board ID multiplied by 16 plus switch number. ID-0 bank-A Switch-0 is "0".  The second bank adds 8 or range is switch 8-15
 #   <type> can be: 'NO' (normally open.  This is the default; so no need to use this)
 #                  'NC' (normally closed.  Common for optos)
   flipperLwL:
       number: 8
       ballsearch: stop
   throughJam:
       number: 37 #21
       type: NC
       ballsearch: reset
       tags: troughJam,tilt_visible #advanced see yaml tags below
   StandUpRight:
       number: 41 #25
       ballsearch: reset
       tags: anyswitch


PD-LED

LEDs can be single color or RGB.

Example:

   #################################################################
   # LED numbering format: Ax-Rr-Gg-Bb
   # x = PD-LED board address
   # r = LED output number connected to the red input of an LED
   # g = LED output number connected to the green input of an LED
   # b = LED output number connected to the blue input of an LED
   #################################################################
   bonus01:
       number: A3-R0-G1-B2
       polarity: False
       tags: bonusMatrixLED
       label: '001 Bonus 1k' 
   startButton:
       number: A3-R83
       polarity: False

Coils

Code examples for using coils.

self.game.coils.coilname.enable(): Enable coil. Turn on full power, useful for lamps. Warning! this setting can fry coils.
self.game.coils.coilname.disable(): Disable coil.
self.game.coils.coilname.pulse(): Pulses coil with either default pulse or defined pulse in config YAML.
self.game.coils.coilname.schedule(schedule=0x80808080, cycle_seconds=0, now=True): Activates coil driver on an on/off pattern an allows for custom patterns. Parameters include schedule, an 8 digit pattern based on intensity (1-F), 'cycle_seconds and now (True/False) - assume start time?

Advanced

Code snippets for common things every program will use, and advanced concepts that are easy to master.

Custom Switch tags: Yaml changes; Code changes; Init/ use.