Difference between revisions of "Redstone Input Port"

From WebDisplays
Jump to: navigation, search
(Recipe)
(JavaScript)
Line 7: Line 7:
  
 
==JavaScript==
 
==JavaScript==
The upgrade name returned by <code>GetUpgrades</code> is <code>webdisplays:redinput</code>.
+
* The upgrade name returned by <code>GetUpgrades</code> is <code>webdisplays:redinput</code>
 +
* If this upgrade is used in combination with the [[Redstone Output Port]] upgrade, the redstone level obtained by any of these queries/callbacks on an emitting block is undefined
 +
* For more information on how to use these queries, check out [[Screen#JavaScript]]
  
If this upgrade is used in combination with the [[Redstone Output Port]] upgrade, the redstone level obtained by any of these functions/callbacks on an emitting block is undefined.
+
===Queries===
 
+
This upgrade adds the following queries:
===Functions===
 
This upgrade adds the following functions:
 
  
 
{| class="wikitable"
 
{| class="wikitable"

Revision as of 02:24, 14 February 2018

The Redstone Input Port is an upgrade which allows web pages to read the redstone levels around the screen.

Recipe

Upgrade redin.png

The item on the left is a Blank Upgrade.

JavaScript

  • The upgrade name returned by GetUpgrades is webdisplays:redinput
  • If this upgrade is used in combination with the Redstone Output Port upgrade, the redstone level obtained by any of these queries/callbacks on an emitting block is undefined
  • 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
GetRedstoneAt int, int {"level":int} 0, 0 is the bottom left block. Rotation is not handled.
GetRedstoneArray None {"levels":[int]} The block x, y is at levels[y * width + x]

Callbacks

This upgrade adds the following callbacks:

  • webdisplaysRedstoneCallback(x, y, level) will be called if the redstone level of the block at x, y has changed.