You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code/BCP_Protocol/switch.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# switch (BCP command)
2
2
Indicates that the other side should process the changed state of a switch. When sent from the media controller to the pin controller, this is typically used to implement a virtual keyboard interface via the media controller (where the player can activate pinball machine switches via keyboard keys for testing). For example, for the media controller to tell the pin controller that the player just pushed the start button, the command would be:
3
3
4
-
```
4
+
```console
5
5
switch?name=start&state=1
6
6
```
7
7
8
8
followed very quickly by
9
9
10
-
```
10
+
```console
11
11
switch?name=start&state=0
12
12
```
13
13
@@ -17,7 +17,8 @@ When sent from the pin controller to the media controller, this is used to send
Copy file name to clipboardExpand all lines: docs/code/Writing_Tests/RunUnitTests.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
Once MPF is installed, you can run some automated tests to make sure that everything is working. To do this, open a command prompt, and then type the following command and then press <enter>:
5
5
6
-
```
6
+
```console
7
7
python3 -m unittest discover mpf/tests
8
8
```
9
9
@@ -13,7 +13,7 @@ When you do this, you should see a bunch of dots on the screen (one for each tes
13
13
14
14
The important thing is that when the tests are done, you should have a message like this:
15
15
16
-
```
16
+
```console
17
17
Ran 587 tests in 27.121s
18
18
19
19
OK
@@ -27,7 +27,7 @@ These tests are the actual tests that the developers of MPF use to test MPF itse
27
27
28
28
Remember though that MPF is actually two separate parts, the MPF game engine and the MPF media controller. The command you run just tested the game engine, so now let’s test the media controller. To do this, run the following command (basically the same thing as last time but with an “mc” added to the end, like this):
Copy file name to clipboardExpand all lines: docs/code/Writing_Tests/WritingCustomTestsForYourMachine.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ These test methods will also load the machine config files (just like if the com
51
51
52
52
Anyway, in our test method, we have the only actual line that does anything:
53
53
54
-
```
54
+
```python
55
55
self.assertModeRunning('attract')
56
56
```
57
57
@@ -63,7 +63,7 @@ You can run your tests via the command prompt from your machine folder. (In othe
63
63
64
64
The exact command to run is `python -m unittest`. This should produce output similar to the following:
65
65
66
-
```
66
+
```console
67
67
C:\pinball\your_machine>python -m unittest
68
68
C:\Python34\lib\imp.py:32: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
69
69
PendingDeprecationWarning)
@@ -82,13 +82,13 @@ That warning about the deprecation can be ignored (if you even have it.. you mig
82
82
83
83
When you’re writing unit tests, you’ll end up dealing with failed tests a lot! So let’s purposefully change the test so it fails. In this case, change the line which asserts a mode called “attract” is running to look for a mode called “foo” instead, like this:
84
84
85
-
```
85
+
```python
86
86
self.assertModeRunning('foo')
87
87
```
88
88
89
89
Save the file and rerun the tests and you should see results like this:
90
90
91
-
```
91
+
```console
92
92
C:\pinball\your_machine>python -m unittest
93
93
C:\Python34\lib\imp.py:32: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
Copy file name to clipboardExpand all lines: docs/code/api_reference/misc_components/Players.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,15 +17,15 @@ This Player class is responsible for tracking player variables which is a dictio
17
17
18
18
First, player variables can be accessed as attributes of the player object directly. For example, to set a player variable foo for the current player, you could use:
19
19
20
-
```
20
+
```python
21
21
self.machine.player.foo =0
22
22
```
23
23
24
24
If that variable didn’t exist, it will be automatically created.
25
25
26
26
You can get the value of player variables by accessing them directly. For example:
27
27
28
-
```
28
+
```python
29
29
print(self.machine.player.foo) # prints 0
30
30
```
31
31
@@ -44,7 +44,7 @@ For the change parameter, it will attempt to subtract the old value from the new
0 commit comments