416 lines
13 KiB
HTML
416 lines
13 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<script language="javascript" src="../js/main.js"></script>
|
|
<script language="javascript">
|
|
start_page("../"); //path to root direction
|
|
</script>
|
|
|
|
<h1>Digilines</h1>
|
|
A complete guide to Lua controllers can be found at: <a href="http://mesecons.net/luacontroller/">http://mesecons.net/luacontroller</a><br>
|
|
Some of the crafting recipes are different.
|
|
|
|
<h1>The Noobs Guide to Digilines</h1>
|
|
written by Sivarajan (but grammar fixed by 56independent),<br>
|
|
published by Banana publications, Grapeyard superb.<br>
|
|
<br>
|
|
Third edition.<br>
|
|
All the live Apparatus are presented in automation museum
|
|
<h2>Preface</h2>
|
|
<p>
|
|
Hey this is sivarajan. I'm happy to present to you the Digiline tutorial page. This contains all the basics for a beginner to meddle with digilines. Digilines are powerful tools used for sending and receiving data, and conducting through wires. I hope this book will be a guide to begin Digilines. Thanks for reading this book.
|
|
<h2>Chapter 1 : Introduction.</h2>
|
|
Digilines is a mod by Jieja. It consists of:<ol>
|
|
<li>RTC (Real Time Clock): to get the in-game time.
|
|
<li>LCD : display text.
|
|
<li>light sensor: for sensing light level.
|
|
<li>Chest: inform players what is inside it .
|
|
</ol><p>
|
|
Some mods that use diglines: Digiterms(not included in this server), Pipeworks , Technic , Mescons.
|
|
Mesecons are needed since we need Lua controller to control our Diglines.
|
|
<p>Crafting:
|
|
<br>Look at your inventory for details.
|
|
<ul>
|
|
<li><a href="http://mesecons.net/luacontroller">A guide to use lua controller</a>
|
|
<li><a href="https://www.tutorialspoint.com/lua/">Lua tutorials</a>
|
|
</ul>
|
|
<h2>Chapter 2 : Hello world</h2>
|
|
Apparatus required:
|
|
<ol>
|
|
<li>Lua controller
|
|
<li>digiline cable
|
|
<li>digiline LCD display.
|
|
</ol>
|
|
Crafting digiline:
|
|
<script language="javascript">
|
|
images = [
|
|
{img:"digiline_lcd.png", txt:"Digiline LCD"},
|
|
{img:"digiline_digiline.png", txt:"Digiline wire"},
|
|
{img:"digiline_lua.png", txt:"Lua controller"},
|
|
];
|
|
galery(images, "200px");
|
|
</script>
|
|
Steps to print hello world with Lua controller circuit: <ol>
|
|
<li>Place the LCD and Lua contoller
|
|
<li>right click the digiline LCD
|
|
<li>set the channel to "tv". Click proceed
|
|
<li>connect the digiline LCD to the lua controller via digilines
|
|
<li>right click the Lua controller.
|
|
<li>Type the following: <pre>digiline_send("tv","Hello World!")</pre>
|
|
<li>The format to print a string on the digiline Display is : <pre>digiline_send("<channelname>","<message>")</pre>
|
|
<li>click execute to run the code. "Hello world" is printed on LCD.
|
|
</ol>
|
|
<h2>Chapter 2 : your own digiline Clock:</h2>
|
|
Required aparatus: <ol>
|
|
<li>LUA controller
|
|
<li>Digiline Display
|
|
<li>Digiline Wire
|
|
</ol>
|
|
Circuit:<br>
|
|
(if you have destroyed your previous Apparatus, skip the following)
|
|
place the lcd, and set the channel to "tv". place a luacontroller, somewhere else, and connect them both using a digline wire.
|
|
|
|
Program:<pre>
|
|
interrupt(1)
|
|
if event.type== "interrupt" then
|
|
time = os.datetable()
|
|
-- this is a built in fuction that returns time
|
|
digiline_send("tv",time.hour..":"..time.min..":"..time.sec)
|
|
-- to run press execute in lua controller
|
|
end
|
|
</pre>
|
|
|
|
<h2>Chapter 3: Communication between two or more LUA controllers using Digiline.</h2>
|
|
<p>Introduction: we can send or process the digiline signals by using a Lua controller.
|
|
<p>Connection:
|
|
Connect the Lua controllers with digilines. Also connect the Slave Lua controller to the LCD display. Set the channel of the LCD to "TV".
|
|
Code:<ol>
|
|
<li> Master/sender:<br>
|
|
<pre>digiline_send("ch","Hi")</pre> </li>
|
|
|
|
<li>Slave:
|
|
<pre>
|
|
if event.type =="digiline" then
|
|
--TV is channel of LCD
|
|
digiline_send("TV","channel: " .. event.channel ..
|
|
"message: " .. event.msg)
|
|
end
|
|
--[[Where: Event is a table generated by the lua controller when a
|
|
particular event is recoginzed by the LUA controller. It consists of :
|
|
|
|
event ={
|
|
type ="<eventtype>"
|
|
[Variables] =[values]
|
|
}
|
|
|
|
here the received event table will be
|
|
event={
|
|
type = "digiline",
|
|
channel ="ch"
|
|
msg ="hi"
|
|
}]]
|
|
</pre>
|
|
|
|
</li>
|
|
</ol>
|
|
<p>Click Execute on Slave first and then click execute on Master.
|
|
you can see the following output:
|
|
<pre>
|
|
Channel:ch
|
|
Message: hi
|
|
--slave controller
|
|
</pre>
|
|
<p>
|
|
Note : a digiline message ie event.msg. can be in the form of a Table. it must be noted that we cannot print a table. We can only print a particular value of the table.
|
|
Say this code is executed by the master digiline
|
|
<pre>
|
|
digiline_send("ch",{a=1,b=2})
|
|
|
|
--[[In that case the Table will be
|
|
event = {
|
|
type ="digiline"
|
|
msg= {
|
|
a=1,
|
|
b=2
|
|
}
|
|
} ]]
|
|
</pre>
|
|
<p>So if we try to print the msg on a digiline display, it will show an error: Message is too complex. But you can print a table to the command line (works if you have server privs). by using print()
|
|
function in Lua. Note that minetest must be started using commandline. Or you can use digiline termial to print values.
|
|
|
|
|
|
|
|
<h2>Chapter 4: Digline Injector and Autocrafter</h2>
|
|
<p>Introduction : these come with pipeworks.
|
|
<h3>4.1 Auto crafter</h3>
|
|
|
|
<p>Introduction: the autocrafter is a useful tool when it comes to automation.
|
|
If you put a crafting recipe in the 3*3 box, and place materials in the large box at the bottom, it will commence <b>auto</b>matically <b>craft</b>ing stuff (hence its name).
|
|
|
|
<p>To control auto crafter using lua controller:<ol>
|
|
<li>Place Lua controller near the Autocrafter/ Connect them with digiline wire.
|
|
|
|
<li>In auto crafter type the channel name (say <span class="alt">c</span>).
|
|
|
|
<li>Now the format to send the craft recipe is <br>
|
|
<pre>digiline_send("<channel>",{
|
|
{"node1","node2","node3"}
|
|
, {"node4","node5","node6"}
|
|
,{"node7","node8","node9"}})</pre>
|
|
</ol>
|
|
<p>Note: if there should be no node in the grid type e in place of nodeN
|
|
format of nodeN is <span class="alt">modname:nodename</span>
|
|
|
|
it can be checked in the inventory.
|
|
|
|
<p>after clicking execute the code.
|
|
send "on " to the appropriate digiline chanel to turn it on.
|
|
send "off" to the appropriate chanel to turn it off.
|
|
<h3>4.2 Injectors</h3>
|
|
<p>Craft a digiline injector and connect it with lua controller.
|
|
Now here is the digiline requests format to be sent to injector:<br>
|
|
<pre>
|
|
{
|
|
slotseq = "priority",
|
|
-- priority | random | rotation
|
|
exmatch = true,
|
|
-- true | false
|
|
name = name,
|
|
-- here we give the node name to be sent.
|
|
count = count,
|
|
-- no of count of node to be sent.
|
|
}</pre><br>
|
|
Some example code:<ol>
|
|
<li> Operating as a stack wise injector: <pre>
|
|
interrupt(1) -- pulse delay
|
|
if event.type == "interrupt" then
|
|
digline_send("injector",{}) --or {count =99}
|
|
end</pre>
|
|
<li> Operating it as an item wise injector: <pre>
|
|
interrupt(1)
|
|
if event.type =="interrupt" then
|
|
digline_send("injector",{count =1})
|
|
end</pre>
|
|
<li> Send only default:stone by the injector. <pre>
|
|
interrupt(1)
|
|
if event.type=="interrupt" then
|
|
digline_send("injector",{name="default:stone"})
|
|
end </pre>
|
|
</ol>
|
|
|
|
<h2>Chapter 5: Digiline Chest</h2>
|
|
<p>Introduction: A digiline chest is a powerful node that says what stuff is put/moved/taken from it.
|
|
<p>let's see how the event tables look by seeing examples.
|
|
<p>Here the digiline channel for all event table will be "d".
|
|
|
|
<ol>
|
|
<li>A node (Default:stone99):
|
|
<pre>
|
|
event = {
|
|
type = "digiline",
|
|
channel = "d",
|
|
msg = {
|
|
stack = {
|
|
meta = {
|
|
-- this field contains additonal memory for the node
|
|
},
|
|
metadata = "",
|
|
count = 99,
|
|
name = "default:stone",
|
|
--name and count will chage according to the node
|
|
wear = 0
|
|
-- this is the condition of the tool
|
|
},
|
|
action = "uput",
|
|
to_slot = 1 --denotes which slot the stuff is
|
|
}
|
|
}
|
|
</pre>
|
|
<li>A Technic node with charge (Blue energy Crystal)
|
|
<pre>
|
|
event ={
|
|
type = "digiline",
|
|
channel = "d",
|
|
msg = {
|
|
stack = {
|
|
meta = {
|
|
|
|
},
|
|
metadata = "return {[\"charge\"] = 450000}",
|
|
-- charge tells the amout of charge that crystal
|
|
count = 1,
|
|
name = "technic:blue_energy_crystal",
|
|
wear = 1
|
|
},
|
|
action = "uput",
|
|
to_slot = 2
|
|
}
|
|
}
|
|
</pre>
|
|
<li>A book with Title "my book" of content:
|
|
hello world
|
|
<pre>
|
|
event ={
|
|
type = "digiline",
|
|
channel = "d",
|
|
msg = {
|
|
stack = {
|
|
meta = {
|
|
owner = "sivarajan",
|
|
title = "my book",
|
|
page_max = "1",
|
|
text = "hello \ world",
|
|
-- \represents a new line in a book
|
|
page = "1",
|
|
description = "\27(T@default)\"\27Fmy book\27E\" by \27Fsivarajan\27E\27E"
|
|
--this is the text shown to other players viewing the book
|
|
},
|
|
metadata = "",
|
|
count = 1,
|
|
name = "default:book_written",
|
|
wear = 0
|
|
},
|
|
action = "umove",
|
|
from_slot = 11,
|
|
-- when moving stuff read the Notes
|
|
to_slot = 3
|
|
}
|
|
}
|
|
</pre>
|
|
</ol>
|
|
<h3>Note:</h3>
|
|
<p>
|
|
here :
|
|
<p>action takes the value :
|
|
<p> "uput" - when you put stuff inside the chest.
|
|
<p> "tput" - when a tube puts stuff inside the chest.
|
|
<p> "empty" - when digiline chest is empty*.
|
|
|
|
<p> "utake"- when you take stuff from inside the chest.
|
|
<p> "ttake" - when a tube takes stuff from inside the chest.
|
|
<p> "full" - when the digiline chest is full*
|
|
|
|
<p> "umove"- moving stuff from one slot to another.
|
|
|
|
<p> * /!\ be careful : "empty" and "full" action messages are sent just after "*take" and "*put" one !
|
|
|
|
<p>from_slot says from which slot the node is moved
|
|
<p>to_slot says in which slot the node is placed.
|
|
|
|
<p>from_slot is available when moving a stuff inside the chest.
|
|
</p>
|
|
<h2>Chapter 6 Digilines and Technic</h2>
|
|
<p>This chapter describes how to interface technic components to digilines. We can get the data of these technic machines to make useful things like a system that warns when the supply is at 0.
|
|
<h3>6.1 Switches</h3>
|
|
<p>A switching station is an important node that connects all of your techinc components. It sends the EU (Electronic Units) supply and EU demand to the digiline controller (LUA controller). A channel name for a switching station can be set by right clicking on it. Its event table will be in form of :
|
|
<pre>
|
|
event{
|
|
type="digiline",
|
|
channel="<channelname>"
|
|
msg={
|
|
supply = (integer value)
|
|
demand = (integer value)
|
|
}
|
|
}
|
|
--Before, you must send GET String to the switching station. This is decribed in 1.4.
|
|
</pre>
|
|
<h3>6.2 Supply converter</h3>
|
|
<p>It converts HV power to LV power, MV to LV,HV to MV Vise versa.(MV is not available in this server). The Channel of the converter can be set by right clicking on it and renaming the default channel. General form of Event table:
|
|
<pre>
|
|
event ={
|
|
type= "digiline"
|
|
msg={
|
|
mesecon_mode = (intergervalue),
|
|
enabled = (integervalue),
|
|
power = (integervalue)
|
|
}
|
|
}
|
|
</pre>
|
|
<p>
|
|
Messages that can be sent:<br>
|
|
1. "on": turn on the power supply <br>
|
|
2. "off": turn off the supply <br>
|
|
3. "toggle": Change the state of supply<br>
|
|
4. "GET": get the state of supply converter(returned as a Table).<br>
|
|
</p>
|
|
|
|
<h3>6.3 Batteries</h3>
|
|
<p>HV and Lv batteries store charge here is example table for that:</p>
|
|
<pre>
|
|
event ={
|
|
type = "digiline",
|
|
channel = "<channel>",
|
|
msg = {
|
|
input = (integer),
|
|
--input voltage
|
|
supply = 40000,-
|
|
--upgrade 1 and 2 are availabe only for HV tools
|
|
upgrade1 = {
|
|
meta = {
|
|
|
|
},
|
|
metadata = "",
|
|
count = 1,
|
|
name = "<modname:node>",
|
|
-- here the node will be a valid upgrade node
|
|
wear = 0
|
|
},
|
|
upgrade2 = {
|
|
meta = {
|
|
|
|
},
|
|
metadata = "",
|
|
count = 1,
|
|
name = "technic:battery",
|
|
wear = 0
|
|
},
|
|
demand = (integervalue)
|
|
charge = (integer value),
|
|
-- amount of charge it contains
|
|
max_charge = (integer),
|
|
-- maximum charge
|
|
src = {
|
|
meta = {
|
|
|
|
},
|
|
metadata = "return {[\"charge\"] = <integer>}",
|
|
count = 1,
|
|
name = "technic:<toolname>",
|
|
wear = (integervalue)
|
|
}
|
|
}
|
|
}
|
|
</pre>
|
|
<h3>6.4 Interfacing Technic and Digiline</h3>
|
|
<p>This is an example for using techic data in digiline. Here we are printing the demand in a digiline LCD</p>
|
|
<p>Items required:
|
|
<ol>
|
|
<li>Blinky Plant.
|
|
<li>Any Technic node. In this case, a Switching station.
|
|
<li>Digiline LCD.
|
|
<li>LUA controller.
|
|
<li>Digiline and Mesecon wires.
|
|
</ol>
|
|
<p>Procedure:
|
|
<ol>
|
|
<li> Connect the switching station and digiline display seperately with Lua Controller and digiline cable.
|
|
|
|
<li> Connect blinky plant in seperate port with mesecon wire.
|
|
|
|
<li> Assign the channel Name of the switching station and LCD as ch and LCD respectively or any name that you prefer.
|
|
</ol>
|
|
<p>Program:
|
|
<pre>
|
|
-- change the channel according to your needs
|
|
if event.type=="program" or event.type =="on" then
|
|
-- event on triggered when mesecon signal is obtained by Lua Controller
|
|
-- event program is triggered when execute button is clicked
|
|
digiline_send("ch","GET") --sending GET to ch
|
|
elseif event.type =="digiline" then
|
|
digiline_send("LCD",event.msg.demand)
|
|
end
|
|
</pre>
|
|
<script language="javascript">
|
|
end_page();
|
|
</script>
|
|
</html>
|