FANDOM


V1Edit

BREPEAT is not a command in SmileBasic V1.

V2Edit

BREPEAT is a command used in conjunction with the function BUTTON(1). It has two forms: one numerical parameter, BREPEAT b, or three numerical parameters, BREPEAT b,i,r. All numerical parameters are rounded down to the nearest integer.

When SmileBasic is first started, BUTTON(1) behaves exactly as BUTTON(2) does: when a button gets pressed, one bit of BUTTON(1) is set for one frame, but the bit is cleared for the next frame even if the button stays down. It will remain clear for all the rest of the duration the button is down, and remain clear when it is released, and is only set again after the button is released and pressed once more. BREPEAT is used to alter the behaviour of BUTTON(1).

With a positive value for r, the command BREPEAT b,i,r will have the following effect. Say the button corresponding to b (see the table below) is pressed during frame t, and remains down for some time to follow. For the duration of frame number t+1, the corresponding bit in BUTTON(1) is set. For every frame from t+2 to t+i inclusive, the bit is clear (if i is zero or one, there are no such frames). For frame number t+i+1, the bit is set. For frame t+i+2, the bit is clear, and remains clear until t+i+r+2. Then, it is set for one frame, then clear for another r frames, then set for one frame, etc.. Once the button is released, the bit will not be set again until it is pressed again and the pattern starts over.

To express the same information in another way: for i=0, those frames that have the bit set (as an offset from the first time the bit is set), are:

0, r+1, 2*r+2, 3*r+3, etc. (until the button is released).

For i>0, the frames that have the bit set are:

0, i, i+r+1, i+2*r+2, i+3*r+3, etc. (until the button is released).

From this, it can be seen that the effect of i=r+1 is identical to the effect of i=0.

With a value of 0 for r, or when i and r are omitted, then BUTTON(1) once more functions the same as BUTTON(2) for that button.

If b, i, or r is negative, the command generates an error Out of range (BREPEAT). The relationship between b values and buttons is as follows:

bbutton
0D-pad up
1D-pad down
2D-pad left
3D-pad right
4A
5B
6X
7Y
8L
9R
10START
11SELECT

It can be seen that the mask used in the BUTTON function for button b is 2b.

b values above 12 generate an Out of range (BREPEAT) error. The purpose of allowing the value 12 is unknown.

V3Edit

No information on SmileBasic V3.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.