http://www.computercraft.info/wiki/api.php?action=feedcontributions&user=Sora+the+Hedgehog&feedformat=atomComputerCraft Wiki - User contributions [en]2024-03-29T08:34:48ZUser contributionsMediaWiki 1.24.1http://www.computercraft.info/wiki/index.php?title=Monitor&diff=5918Monitor2013-08-01T18:53:23Z<p>Sora the Hedgehog: Changed CCSensors reference to OpenCCSensors, seeing as OCCS is up to date.</p>
<hr />
<div>{{Block<br />
|name=Monitor<br />
|image=Iso_Monitor.png<br />
|id=4094<br />
|damage-value=0<br />
|is-peripheral=Yes<br />
|peripheral-api=Term (API)<br />
}}<br />
The '''Monitor''' is a block that can display text on its front side. When several screen blocks are placed on the same plane, it will form a single monitor. The maximum size of a single monitor is 8 blocks wide and 6 blocks tall, and must be placed to be shaped as a rectangle, else it will separate into multiple parts. It is useful for displaying information at a server spawn, showing a program on the monitor, and even showing the status of an IC2 reactor! (provided you have [[OpenCCSensors]] installed)<br />
<br />
==Recipe==<br />
{{Crafting grid<br />
|A1=stone |B1=stone |C1=stone<br />
|A2=stone |B2=glass_pane |C2=stone<br />
|A3=stone |B3=stone |C3=stone<br />
|Output=Monitor<br />
}}<br />
<br />
==Redirecting Programs to a Monitor==<br />
[[File:Computer_w_DiskDrive_w_Monitor.png|frame|428x241px|right|A 2x2 [[Monitor]], connected to a [[Computer]], with a [[Disk Drive]] connected.]]<br />
From the CraftOS shell, type <tt>monitor [top|bottom|left|right|front|back] [a-program-name]</tt>. For example, typing <tt>monitor top hello</tt> would show "Hello world." on the top Monitor.<br />
<br />
==Monitor as a Peripheral==<br />
To use a Monitor, you need to either call a method directly using [[peripheral.call]](), or, wrap the monitor using the [[Peripheral_(API)|Peripheral API]]. Wrapped monitors provide all functions listed in the [[Term_(API)|Term API]], with the exception of [[Monitor.setTextScale|monitor.setTextScale(size)]], which is native to monitors only.<br />
<br />
For this example, we have a Monitor connected to the top of our [[Computer]]:<br />
<br />
-- Immediately invoke a method without wrapping<br />
peripheral.call("top", "write", "Hello World!")<br />
<br />
-- You can also "wrap" the peripheral side to a variable:<br />
local monitor = peripheral.wrap("top")<br />
monitor.write("Hello World!")<br />
<br />
{{BlocksItemsList}}<br />
[[Category:Blocks]][[Category:Peripherals]]</div>Sora the Hedgehoghttp://www.computercraft.info/wiki/index.php?title=Monitor.setTextScale&diff=5917Monitor.setTextScale2013-08-01T18:51:33Z<p>Sora the Hedgehog: Changed the pointed-to API to Term, removed TLC notice</p>
<hr />
<div>{{lowercase}}<br />
{{Function<br />
|name=monitor.setTextScale<br />
|args={{type|number}} scale<br />
|api=Term<br />
|addon=ComputerCraft<br />
|desc=Sets the size of all text on the monitor. scale can be any multiple of 0.5, starting at 0.5 and ending at 5.<br />
|examples=<br />
{{Example<br />
|desc=Sets the monitor's text scale to 2.<br />
|code=monitor.setTextScale(2)<br />
|output=none<br />
}}<br />
}}<br />
<br />
[[Category:API_Functions]]</div>Sora the Hedgehoghttp://www.computercraft.info/wiki/index.php?title=Term_(API)&diff=5916Term (API)2013-08-01T18:50:17Z<p>Sora the Hedgehog: Added monitor.setTextScale() to the list, seeing as it's techincally a term API function.</p>
<hr />
<div>The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics.<br />
<br />
Methods in ''italics'' are available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor|Advanced Monitors]].<br />
Methods in '''bold''' are available only to [[Monitor|Monitors]].<br />
<br />
{{API table|Term|image=Grid disk.png|2=<br />
<br />
{{API table/row|[[term.write]]({{type|string}} text)<br />
|Writes ''text'' to the screen.|odd}}<br />
<br />
{{API table/row|[[term.clear]]()<br />
|Clears the entire screen}}<br />
<br />
{{API table/row|[[term.clearLine]]()<br />
|Clears the line the cursor is on|odd}}<br />
<br />
{{API table/row|[[term.getCursorPos]]()<br />
|Returns two arguments containing the x and the y position of the cursor.}}<br />
<br />
{{API table/row|[[term.setCursorPos]]({{type|number}} x, {{type|number}} y)<br />
|Sets the cursor's position.|odd}}<br />
<br />
{{API table/row|[[term.setCursorBlink]]({{type|boolean}} bool)<br />
|Disables the blinking or turns it on.}}<br />
<br />
{{API table/row|[[term.isColor]]()<br />
|Returns if the computer supports color. (Used to determine whether or not an [[Advanced Computer]] is being used)|odd}}<br />
<br />
{{API table/row|[[term.getSize]]()<br />
|Returns two arguments containing the x and the y values stating the size of the screen. (Good for if you're making something to be compatible with both [[Turtle]]s and [[Computer]]s.)}}<br />
<br />
{{API table/row|[[term.scroll]]({{type|number}} n)<br />
|Scrolls the terminal ''n'' lines.|odd}}<br />
<br />
{{API table/row|[[term.redirect]](target)<br />
|Redirects terminal output to a monitor or other redirect target. (Use [[peripheral.wrap]] to acquire a monitor "object".)}}<br />
<br />
{{API table/row|[[term.restore]]()<br />
|Restores terminal output to the previous target.|odd}}<br />
<br />
{{API table/row|''[[term.setTextColor]]({{type|number}} [[Colors (API)|color]])''<br />
|Sets the text color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.}}<br />
<br />
{{API table/row|''[[term.setBackgroundColor]]({{type|number}} [[Colors (API)#Colors|color]])''<br />
|Sets the background color of the terminal. Available only to [[Advanced Computer|Advanced Computers]] and [[Advanced Monitor]]s.|odd}}<br />
<br />
{{API table/row|'''[[monitor.setTextScale]]({{type|number}} scale)'''<br />
|Sets the text scale on a [[Monitor]].}}<br />
<br />
}}<br />
<br />
[[Category:APIs]]</div>Sora the Hedgehoghttp://www.computercraft.info/wiki/index.php?title=Tutorials&diff=5291Tutorials2013-04-05T20:28:54Z<p>Sora the Hedgehog: /* External Tutorials/Guides */ Added PIL as a guide</p>
<hr />
<div>As some tutorials might not be listed here, you can also browse the [[:Category:Tutorials|tutorials category]].<br />
<br />
== Basic Tutorials ==<br />
These tutorials are designed to be used in the order shown, each tutorial will build on the previous ones.<br />
=== Introduction to Coding ===<br />
*[[Hello_World_Tutorial|Hello World!]]<br />
*[[Variables]]<br />
*[[Conditional_statements|If, Then, Else]]<br />
*[[Function (type)|Function]]<br />
*[[Loops]]<br />
*[[Tables]]<br />
<br />
== Example Programs ==<br />
These pages guide you through programs created by other users. They are not necessarily well-coded, but can be useful as a loose guide.<br />
<br />
=== Programming & Wiring ===<br />
*[[Guess_The_Number_(tutorial)|Guess the Number]]<br />
*[[Making_a_Password_Protected_Door|Password Protected Door]]<br />
*[[Making_an_API_(tutorial)|Programming an API]]<br />
*[[Startup|Running script automatically at boot with Startup]]<br />
*[[Raw key events| Detecting specific keys (such as the arrow keys)]]<br />
*[[Receiving a rednet message through os.pullEvent()|Receiving a rednet message through os.pullEvent()]]<br />
*[[Calculator Tutorial]]<br />
*[[Rednet Tutorial]].<br />
<br />
=== Turtles ===<br />
The nice little robots that do the hard work for you.<br />
*[[Turtle_Tutorial|Turtles!]]<br />
*[[Turtle_Lumberjack_(tutorial)|Turtle Lumberjack]]<br />
*[[Advanced_Turtle_Lumberjack_(tutorial)|Advanced Turtle Lumberjack]]<br />
*[[Cobble_Generator|Cobblestone Generator]]<br />
*[[Turtle_Stairbuilder_(tutorial)|Turtle Stairbuilder]]<br />
<br />
== External Tutorials/Guides ==<br />
*[http://www.minecraftforum.net/topic/907632-mod-tutorial-computercraft-v12-very-basic-lua-tutorial-updated-1112/page__p__11556908#entry11556908 Onionnion's Basic Lua Tutorial]<br />
*[http://www.computercraft.info/forums2/index.php?/topic/1516-ospullevent-what-is-it-and-how-is-it-useful/page__view__findpost__p__11156 Onionnion's os.pullEvent() Guide]<br />
*[http://wiki.roblox.com/ Roblox Wiki (Has tutorials on Lua)]<br />
*[http://www.lua.org/pil/contents.html Programming in Lua, a general purpose guidebook written by a programmer that writes the Lua interpreter]<br />
<br />
[[Category:Tutorials]]</div>Sora the Hedgehoghttp://www.computercraft.info/wiki/index.php?title=Talk:Login_with_Roaming_Profiles&diff=5290Talk:Login with Roaming Profiles2013-04-05T20:20:29Z<p>Sora the Hedgehog: </p>
<hr />
<div>Does not work. Not authorised<br />
<br />
== Not the best tutorial ==<br />
<br />
And by that, I mean that this program isn't conceptually simple enough.<br />
We should make room for other tutorials that are simpler to understand.<br />
Hopefully that will stop the flood of lock programs, as that is the<br />
only tutorial on the wiki that is simple enough for new programmers to<br />
follow.<br />
<br />
[[User:Sora the Hedgehog|Sora the Hedgehog]] 00:20, 6 April 2013 (MSK)<br />
<br />
== Should be posted in "Programs" instead? ==<br />
<br />
My argument is that this does not belong on the wiki. My reason is: we have forums for this. That simple.<br />
<br />
Just wanted to make a quick note here - <br />
<br />
if validSender then<br />
for i,v in ipairs(users) do<br />
if message == v then<br />
password = passwords[i]<br />
valid = true<br />
else<br />
valid = false<br />
end<br />
end<br />
<br />
That section of code is why it doesn't work - after the 'valid = true', there needs to be a 'break' or it will continue to iterate.<br />
<br />
if validSender then<br />
for i,v in ipairs(users) do<br />
if message == v then<br />
password = passwords[i]<br />
valid = true<br />
break<br />
else<br />
valid = false<br />
end<br />
end</div>Sora the Hedgehoghttp://www.computercraft.info/wiki/index.php?title=Wireless_Modem&diff=5287Wireless Modem2013-04-05T20:11:18Z<p>Sora the Hedgehog: Changed the first example to use the Modem API rather than the Rednet API</p>
<hr />
<div>{{NeedsWork|The behaviour of Rednet has changed as of 1.5 - please consider updating this page with information. (Please don't add prerelease info!)}}<br />
:''This page is for the Modem blocks. For the modem API, see [[Modem_(API)|Modem (API)]]''<br />
{{Block<br />
|name=Modem<br />
|image=WirelessModem.png<br />
|id=4094<br />
|damage-value=1<br />
|is-peripheral=Yes<br />
|peripheral-api=Modem (API)<br />
}}<br />
Modems are blocks which can be used to wirelessly transfer data between [[Computer|computers]] and [[Turtle|turtles]], using the [[Rednet_(API)|Rednet API]] or the [[Modem_(API)|Modem API]].<br />
To place a modem on a side of a computer, right-click to place the modem while sneaking.<br />
<br />
It is also possible to turn the modem on and off by typing "rednet.open ( side )" to open and "rednet.close ( side )" to close.<br />
<br />
Modems can send messages to other modems located up to 64 meters away, or 16 meters during a thunderstorm.<br />
As of 1.4 Modem range is increased with higher altitudes. If there is no thunderstorm, the range will always be higher than 64, and at max altitude you would have a range of 384 meters.<br />
<br />
In 1.4 and 1.41 there is a miscalculation that causes the range to only be 381 meters at max altitude.<br />
<br />
== Recipe ==<br />
{{Crafting grid<br />
|A1=stone |B1=stone |C1=stone<br />
|A2=stone |B2=ender_pearl |C2=stone<br />
|A3=stone |B3=stone |C3=stone<br />
|Output=Modem<br />
}}<br />
<br />
== Example (Modem API)==<br />
* Place 2 computers and add modems to them by clicking the right mouse button while sneaking.<br />
* Access them, and start Lua.<br />
* Once Lua has started, wrap your modem using peripheral.wrap() (something like "modem = peripheral.wrap("<side of modem>")<br />
* Type "[[modem_(API)|modem.open]] (<A modem port number, anything from 1 to 65535>)" on one computer.<br />
* Check if there exists a connection: a dim, red light should be found on the modem.<br />
* Now, type "[[modem_(API)|modem.transmit]] (<Same number as above>, <Also the same number>, 'Your message')" on the other computer. This should send your message to all computers connected.<br />
* Opening the first computer should show the message written on the second computer.<br />
<br />
<br />
==Modem as a Peripheral==<br />
To use a Modem as a peripheral, you need to either call a method directly using [[peripheral.call]](), or, wrap the modem using the [[Peripheral_(API)|Peripheral API]]. Wrapped modems provide all functions listed in the [[Modem_(API)|Modem API]].<br />
<br />
For this example, we have a Modem connected to the top of our [[Computer]], we are going to open channel 5:<br />
<br />
-- Immediately invoke a method without wrapping<br />
peripheral.call("top", "open",5)<br />
<br />
-- You can also "wrap" the peripheral side to a variable:<br />
local modem = peripheral.wrap("top")<br />
modem.open(5)<br />
<br />
[[Category:Peripherals]]</div>Sora the Hedgehog