Difference between revisions of "Redstone Output Port"

From WebDisplays
Jump to: navigation, search
(Limitations)
(Limits)
Line 12: Line 12:
  
 
===Limits===
 
===Limits===
Every player has its own instance of the web browser, as described [[Screen#Multiplayer synchronization|here]]. When any redstone-output-related query is executed, each client (player) receives it, but <strong>only the screen owner will forward the query to the server.</strong> Thus, using redstone output queries on non-owner web browsers is useless. This shouldn't be a problem in the following scenario:
+
Every player has its own instance of web browser, as described [[Screen#Multiplayer synchronization|here]]. When any redstone-output-related query is executed, each client (player) receives it, but <strong>only the screen owner will forward the query to the server.</strong> Thus, using redstone output queries on non-owner web browsers is useless. This shouldn't be a problem in the following scenario:
 
* You have a web page that runs a redstone output query when a button is clicked
 
* You have a web page that runs a redstone output query when a button is clicked
 
* A player clicks on the button
 
* A player clicks on the button

Revision as of 02:55, 14 February 2018

The Redstone Output Port is an upgrade which allows web pages to change the redstone state of blocks around the screen.

Recipe

Upgrade redout.png

The item on the left is a Blank Upgrade.

How to use

Like any other upgrades, install it by right-clicking on a screen with the upgrade in your main hand. You will need the "Link & upgrade" permission to do that.

Please note that the emitting status of each blocks is conserved even when the screen is destroyed. Thus, a good programmer should use the ClearRedstone query when the page loads to make sure that all blocks are in the passive state. You can know if a screen block is in the emitting state by using the Minecraft F3 key. The emitting status is then displayed when hovering the block on the right side.

Limits

Every player has its own instance of web browser, as described here. When any redstone-output-related query is executed, each client (player) receives it, but only the screen owner will forward the query to the server. Thus, using redstone output queries on non-owner web browsers is useless. This shouldn't be a problem in the following scenario:

  • You have a web page that runs a redstone output query when a button is clicked
  • A player clicks on the button
  • Every (near enough) player receives the click information, executing the redstone output query
  • For each non-owner players, the query does nothing
  • For the owner, on the other hand, the query is forwarded to the server
  • The server recives the query from the owner (and only him), and enable or disables the redstone emitting status for the specified block

However, if the owner is disconnected or if the owner is too far away, this will of course not work. The IsOwner query can be used to know if the web page is running on the owner's web browser.

JavaScript

The upgrade name returned by GetUpgrades is webdisplays:redoutput. For more information on how to use these queries, check out Screen#JavaScript.

Queries

This upgrade adds the following queries:

Query name Arguments Return value Comment
ClearRedstone None {"status":string} Sets all blocks in the passive state
SetRedstoneAt int, int, bool {"status":string} Enable/disable the emitting state for the block at x, y. Rotation is not handled</code>

The status returned by each queries is either "ok" or "notOwner".