Add NanoBasic to TA3 Terminal
This commit is contained in:
parent
750dc59e97
commit
ae6e1f2af3
@ -553,7 +553,7 @@ return {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"Das Terminal dient in erster Linie zum Austesten der Kommandoschnittstelle anderer Blöcke (siehe \"Logik-/Schalt-Blöcke\").\n"..
|
"Das Terminal dient in erster Linie zum Austesten der Kommandoschnittstelle anderer Blöcke (siehe \"Logik-/Schalt-Blöcke\")\\, sowie zur Automatisierung von Anlagen mit Hilfe der Programmiersprache BASIC.\n"..
|
||||||
"Man kann aber auch Kommandos auf Tasten legen und so das Terminal produktiv nutzen.\n"..
|
"Man kann aber auch Kommandos auf Tasten legen und so das Terminal produktiv nutzen.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" set <button-num> <button-text> <command>\n"..
|
" set <button-num> <button-text> <command>\n"..
|
||||||
@ -569,6 +569,8 @@ return {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden\\, die an diesem Ort bauen können\\, also Protection Rechte besitzen. Im öffentlichen Modus (public) können alle Spieler die vorkonfigurierten Tasten verwenden.\n"..
|
"Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden\\, die an diesem Ort bauen können\\, also Protection Rechte besitzen. Im öffentlichen Modus (public) können alle Spieler die vorkonfigurierten Tasten verwenden.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
|
"Über das Gabelschlüssel-Menü kann in den BASIC-Mode umgeschaltet werden. Weitere Infos zum BASIC-Mode findest du hier\n"..
|
||||||
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"Die Farblampe kann mit 'on'/'off' Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und\n"..
|
"Die Farblampe kann mit 'on'/'off' Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und\n"..
|
||||||
|
@ -553,7 +553,7 @@ return {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"The terminal is primarily used to test the command interface of other blocks (see \"Logic / switching blocks\").\n"..
|
"The terminal is primarily used to test the command interface of other blocks (see \"Logic / switching blocks\")\\, as well as for the automation of systems using the BASIC programming language.\n"..
|
||||||
"You can also assign commands to keys and use the terminal productively.\n"..
|
"You can also assign commands to keys and use the terminal productively.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
" set <button-num> <button-text> <command>\n"..
|
" set <button-num> <button-text> <command>\n"..
|
||||||
@ -571,6 +571,8 @@ return {
|
|||||||
"\n"..
|
"\n"..
|
||||||
"In public mode\\, all players can use the preconfigured keys.\n"..
|
"In public mode\\, all players can use the preconfigured keys.\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
|
"You can switch to BASIC mode using the open-ended wrench menu. You can find more information about BASIC mode here\n"..
|
||||||
|
"\n"..
|
||||||
"\n"..
|
"\n"..
|
||||||
"\n",
|
"\n",
|
||||||
"The signal lamp can be switched on or off with the 'on' / 'off' command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes\" and via Lua/Beduino commands.\n"..
|
"The signal lamp can be switched on or off with the 'on' / 'off' command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes\" and via Lua/Beduino commands.\n"..
|
||||||
|
@ -131,7 +131,7 @@ local function get_action(nvm, fields)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return function(pos, nvm, fields)
|
return function(pos, nvm, fields)
|
||||||
return ""
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ Der Timer kann Kommandos Spielzeit-gesteuert senden. Für jede Kommandozeile kan
|
|||||||
|
|
||||||
### TA3 Terminal
|
### TA3 Terminal
|
||||||
|
|
||||||
Das Terminal dient in erster Linie zum Austesten der Kommandoschnittstelle anderer Blöcke (siehe "Logik-/Schalt-Blöcke").
|
Das Terminal dient in erster Linie zum Austesten der Kommandoschnittstelle anderer Blöcke (siehe "Logik-/Schalt-Blöcke"), sowie zur Automatisierung von Anlagen mit Hilfe der Programmiersprache BASIC.
|
||||||
Man kann aber auch Kommandos auf Tasten legen und so das Terminal produktiv nutzen.
|
Man kann aber auch Kommandos auf Tasten legen und so das Terminal produktiv nutzen.
|
||||||
|
|
||||||
set <button-num> <button-text> <command>
|
set <button-num> <button-text> <command>
|
||||||
@ -644,6 +644,8 @@ Das Terminal besitzt folgende, lokalen Kommandos:
|
|||||||
|
|
||||||
Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden, die an diesem Ort bauen können, also Protection Rechte besitzen. Im öffentlichen Modus (public) können alle Spieler die vorkonfigurierten Tasten verwenden.
|
Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden, die an diesem Ort bauen können, also Protection Rechte besitzen. Im öffentlichen Modus (public) können alle Spieler die vorkonfigurierten Tasten verwenden.
|
||||||
|
|
||||||
|
Über das Gabelschlüssel-Menü kann in den BASIC-Mode umgeschaltet werden. Weitere Infos zum BASIC-Mode findest du [hier](https://github.com/joe7575/techage/tree/master/manuals/ta3_terminal.md)
|
||||||
|
|
||||||
[ta3_terminal|image]
|
[ta3_terminal|image]
|
||||||
|
|
||||||
|
|
||||||
@ -734,7 +736,6 @@ Er sendet ein `on`, wenn ein Item erkannt wird, gefolgt von einem `off` eine Sek
|
|||||||
Danach werden weitere Kommando für 8 Sekunden blockiert.
|
Danach werden weitere Kommando für 8 Sekunden blockiert.
|
||||||
Die Wartezeit, sowie die Items, die ein Kommando auslösen sollen, können über das Gabelschlüssel-Menü konfiguriert werden.
|
Die Wartezeit, sowie die Items, die ein Kommando auslösen sollen, können über das Gabelschlüssel-Menü konfiguriert werden.
|
||||||
|
|
||||||
|
|
||||||
[ta3_detector|image]
|
[ta3_detector|image]
|
||||||
|
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ The timer can send commands time-controlled. The time, the target number(s) and
|
|||||||
|
|
||||||
### TA3 Terminal
|
### TA3 Terminal
|
||||||
|
|
||||||
The terminal is primarily used to test the command interface of other blocks (see "Logic / switching blocks").
|
The terminal is primarily used to test the command interface of other blocks (see "Logic / switching blocks"), as well as for the automation of systems using the BASIC programming language.
|
||||||
You can also assign commands to keys and use the terminal productively.
|
You can also assign commands to keys and use the terminal productively.
|
||||||
|
|
||||||
set <button-num> <button-text> <command>
|
set <button-num> <button-text> <command>
|
||||||
@ -646,6 +646,8 @@ In private mode, the terminal can only be used by players who can build at this
|
|||||||
|
|
||||||
In public mode, all players can use the preconfigured keys.
|
In public mode, all players can use the preconfigured keys.
|
||||||
|
|
||||||
|
You can switch to BASIC mode using the open-ended wrench menu. You can find more information about BASIC mode [here](https://github.com/joe7575/techage/tree/master/manuals/ta3_terminal.md)
|
||||||
|
|
||||||
[ta3_terminal|image]
|
[ta3_terminal|image]
|
||||||
|
|
||||||
|
|
||||||
|
1547
manuals/nanobasic.md
Normal file
1547
manuals/nanobasic.md
Normal file
File diff suppressed because it is too large
Load Diff
100
manuals/ta3_terminal.md
Normal file
100
manuals/ta3_terminal.md
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# TA3 Terminal BASIC Mode
|
||||||
|
|
||||||
|
![Basic Terminal](https://github.com/joe7575/techage/blob/master/textures/techage_basic_mode.png)
|
||||||
|
|
||||||
|
The TA3 Terminal can be used in BASIC mode to interact with Techage devices for
|
||||||
|
automation and control.
|
||||||
|
|
||||||
|
BASIC (Beginner's All-purpose Symbolic Instruction Code) is a high-level programming
|
||||||
|
language that was designed to be easy to use. It is a good choice for beginners and
|
||||||
|
for simple automation tasks.
|
||||||
|
|
||||||
|
The BASIC interpreter in the TA3 Terminal is based on the
|
||||||
|
[NanoBASIC](https://github.com/joe7575/techage/tree/master/manuals/nanobasic.md) language.
|
||||||
|
NanoBASIC is similar to the Microsoft (TM) BASIC interpreter, which was available on
|
||||||
|
the Commodore 64 and other computers of the 1980s.
|
||||||
|
|
||||||
|
Information to the Microsoft (TM) BASIC interpreter can be found
|
||||||
|
[here](https://vtda.org/docs/computing/Microsoft/MS-BASIC/8101-530-11-00F14RM_MSBasic8086XenixReference_1982.pdf).
|
||||||
|
|
||||||
|
NanoBasic is available on the Techage TA3 Terminal and allows you to monitor and
|
||||||
|
control the Techage machines and devices. It works similar to the Lua Controller
|
||||||
|
of the Techage mod, but fits more into the era of TA3 machines.
|
||||||
|
|
||||||
|
NanoBasic is normally not visible on the Techage Terminal. But it can be activated
|
||||||
|
by means of the Techage Info Tool (open-ended wrench).
|
||||||
|
|
||||||
|
The NanoBasic manual is available [here](https://github.com/joe7575/techage/tree/master/manuals/nanobasic.md).
|
||||||
|
|
||||||
|
## NanoBASIC Examples
|
||||||
|
|
||||||
|
NanoBASIC does not distinguish between upper and lower case letters. The following
|
||||||
|
examples are written in lower case letters.
|
||||||
|
|
||||||
|
### Hello World
|
||||||
|
|
||||||
|
```basic
|
||||||
|
10 for i=1 to 10
|
||||||
|
20 print "Hello World!"
|
||||||
|
30 next i
|
||||||
|
```
|
||||||
|
|
||||||
|
### Input Demo
|
||||||
|
|
||||||
|
```basic
|
||||||
|
10 name$ = input$("What is your name")
|
||||||
|
20 print "Hello" name$ "nice to meet you!"
|
||||||
|
30 age = input("What is your age")
|
||||||
|
40 print "Next year you will be" age+1
|
||||||
|
50 end
|
||||||
|
```
|
||||||
|
|
||||||
|
### Blinking Light
|
||||||
|
|
||||||
|
The following example blinks a light on and off every second.
|
||||||
|
You need a Techage Color Lamp (techage:color_lamp_off) for this example.
|
||||||
|
You have to adapt the node number of the lamp to your setup.
|
||||||
|
|
||||||
|
```basic
|
||||||
|
10 for i=1 to 10
|
||||||
|
20 res = cmd(1234, 1, 1)
|
||||||
|
30 sleep(1)
|
||||||
|
40 res = cmd(1234, 1, 0)
|
||||||
|
50 sleep(1)
|
||||||
|
60 next i
|
||||||
|
```
|
||||||
|
|
||||||
|
### Read Minecart States
|
||||||
|
|
||||||
|
The following example reads the states of the minecarts 1 to 4 from the Cart Terminal
|
||||||
|
and outputs them to a techage display.
|
||||||
|
This example requires a Minecart Cart Terminal (minecart:terminal) and a Techage
|
||||||
|
TA4 Display (techage:ta4_display) for the output.
|
||||||
|
|
||||||
|
```basic
|
||||||
|
10 const display = 1234 ' node number
|
||||||
|
20 const cartterm = 1235 ' node number
|
||||||
|
30 const cmd_state = 129
|
||||||
|
40 const cmd_dist = 130
|
||||||
|
50 :
|
||||||
|
60 dputs(display, 1, " Carts")
|
||||||
|
70 :
|
||||||
|
80 for idx = 1 to 4
|
||||||
|
90 : gosub 140
|
||||||
|
100 next
|
||||||
|
110 sleep(5)
|
||||||
|
120 goto 60
|
||||||
|
130 :
|
||||||
|
140 state = cmd(cartterm, cmd_state, idx)
|
||||||
|
150 if state == 1 then
|
||||||
|
160 : dputs(display, idx+1, "#" + str$(idx) + " stopped")
|
||||||
|
170 else
|
||||||
|
180 : dist = cmd(cartterm, cmd_dist, idx)
|
||||||
|
190 : s$ = "#" + str$(idx) + " " + str$(dist) + "m"
|
||||||
|
200 : dputs(display, idx+1, s$)
|
||||||
|
210 endif
|
||||||
|
220 return
|
||||||
|
230 :
|
||||||
|
65000 print "error =" param$() "in" param()
|
||||||
|
65010 return
|
||||||
|
```
|
BIN
textures/techage_basic_mode.png
Normal file
BIN
textures/techage_basic_mode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Loading…
Reference in New Issue
Block a user