As of v1.2.0, it is possible to associate levers to any globally scrollable view - that is, any view which has the same scroll position for all players in the world. At this time, those view types are the sign view, multisign view and public hologram view. (While map, Spout, and private hologram views are scrollable, they have a per-player scroll position).
The state of those levers is then automatically controlled by scrolling and/or executing menu items on that view. There are five possible modes:
- SELECTED (the default): any lever associated with a menu item is set to ON (generating redstone current) if that item is selected, and set to OFF (no current) if the item is not selected.
- TOGGLE: any lever associated with a menu item is toggled between ON and OFF each time that menu item is executed.
- PULSE: when a menu item is executed, any lever associated with that item item is flipped ON for a configurable period, then flipped OFF again (default: 10 ticks - 0.5 seconds - see below for customising it)
- PULSEANY: all levers associated with the view are flipped ON then OFF (same as for pulse) when any menu item is executed.
- RADIO: when a menu item is executed, any lever associated with that item item is flipped ON, and any levers for all other menu items are flipped OFF.
PULSE and PULSEANY were added in v1.4.0. RADIO was added in v2.0.0.
This provides interesting possibilities for affecting external redstone circuits, doors, pistons, tracks etc. with a scrollable sign. E.g. a sign could control the switching of a track simply by scrolling it. In toggle mode, a central sign could control the power to redstone lamps in multiple locations.
Levers can be anywhere in the world; they don't have to be next to (or even near) the view that controls them.
One menu item can have as many levers as you want associated with it; they'll all be flipped when the item is scrolled to (selected mode) or the item is executed (toggle/pulse/pulseany modes).
Here's a short demo on how it works. I create a sign with three entries, and attach an output lever to each one:
Attaching a Lever
To attach a lever to an item on a given view:
- scroll the view so that the item you want to attach the lever to is selected
- hit (left-click) the view with a lever in your hand
- now place the lever somewhere (or hit an existing lever block with it) to attach the lever
- if you want to cancel the attachment, just select a different item
You'll get a message that an output lever has been added to the view.
Detaching a Lever
Very simple: just break the lever and it will be detached from the view. You will get a confirmation message.
Changing Output Mode
The output mode (selected/toggle/pulse/pulseany/radio) is controlled by the rsoutputmode view attribute, which is 'selected' by default. To change this:
/sms view <view-name> rsoutputmode toggle
... substituting the actual view name for <view-name>. You can easily find the view name by looking at the view and typing
/sms view. Or even more easily, look at the view and type:
/sms view . rsoutputmode toggle
"." is a convenient shortcut for "the currently targeted view".
For pulse and pulseany output modes, a separate view attribute is also checked: pulseticks. This is the number of server ticks for which the lever will be switched on for. The default is 10, which is 0.5 seconds (the same as a stone button).
This sets up a simple menu with three items, and attaches a lever to each item, as in the video demo above:
- Place a sign, and while looking at it:
/sms create switchdemo &1Switch Demo /sms add switchdemo One \one /sms add switchdemo Two \two /sms add switchdemo Three \three
- Get three levers.
- Scroll the menu so that One is selected, and hit the sign while holding a lever
- Place the lever somewhere
- Do the same for items Two and Three
Now, scroll through the menu. You will see the levers flip each time the menu is scrolled. When One is selected, the first lever you placed will flip to ON, and the other two will flip to OFF, and similarly for the other two menu items.
Change the output mode:
/sms view switchdemo-1 rsoutputmode toggle
Now, scrolling the menu won't change anything, but each time you execute a menu item, the corresponding switch will flip.