Space Engineers

Space Engineers

Not enough ratings
PLC-OS Manual
By Twotwinbrothers and 1 collaborators
InGame Script Manual for PLC-OS
   
Award
Favorite
Favorited
Unfavorite
Introduction
This is a manual for a Ingame Script:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2610010357

This script allow you to control most of te terminal action on a lcd by mouse control and show the blocks information.

The Name PLC-OS stands for "Programmable Logic Controller - Operating System".
PLC are used in the electronic industry to automate and control operation.
Automation can be done by Logic Gates.

In this Manual we try to explain how to add item(s) to the screen(s), and how you can control/automate them.

Each line consists of one rule in the Customdata of the programmable block on which the script runs.

An extra Customdata of other blocks can be used as long the "ScreenTag"+[D] consists in block name

in the balk like this must be placed in de CustomData or blocks name.
Thing that get added in line are Underlined

Enjoy.

Twotwinbrothers
What do you need
  • 1 Programmable block:
    This one will run this script

    Add "log" to Name of the program block to see log in the terminal (K)
    Add first three letter + "-" To Remove Log item Example: -SET (removes setting out of log)

  • 1 Flight seat or Remote block
    If no tag is set, it wil use a rondom control seat

  • 1 LCD panel(can be a lcd of other blocks to like Flight Seat, Sci fy Button panel or programmable blocks.)
    screentag+[screen name or number] must be set in the Name of the lcd Block

(note: the screens like the "Sci Fy Control panel" can't be use by scripts (KEEN didn't program these)
Settings
Type below in customdate to request current settings in the customdata:

settings

List below wil be shown whit changes made in translation strings in the customdata after reopening.
Its a quick way to get al the settings and tags in the customdata.

More about below tags in chapter: basic setup. (You wil see some of these tags there too.)

SETTINGS

TAGS
// itemname,+objectname = sets itemname, script only handle blocks whit itemname in it.
itemname,
// lcdtag,+lcdtag = sets first part of the lcdtag.
lcdtag,
// pittag,cockpit tag = name that the cockpit must contain.
pittag,
// remtag,remote tag = name that the remote must contain.
remtag,

MOUSE(only use for setup)
// mouse,+screen = sets mouse to screen, mouse can't leave set screen.
mouse,Screen C
// mouse mode,true or false = if true mouse is shown on screen.
mouse mode,True
// park switch,true or false = if true mouse is shown on screen when park is on.
park switch,False

IGC SETTINGS.
// sendfrom,channel name = set this PB IGC Channel Name.
sendfrom,
// sendto,channel name = set IGC Channel Name to send to, wen set you can't change it in script. sendto,Everyone

ADDITIONAL
// sleep,+number = sets sleepmode timer, if set to 0 ,sleepmode is off.
sleep,0
// update,+1 or 100 = sets script updatetype, usefull for reading log.
update,Update1
// WSAD,+true or false = allows to put these characters directly into memory
WSAD,False



Everything after "//" is seen as an explanation is not run by the script.

Put // in front op a line it will switch off the line for the script until you remove the // again.
Some tags are not always needed, and should be switch off whit // .
Every line that is not a line recognise by the script should be behind //. Otherwise the script stop running whit al kinds of errors in the ditails window of the programmeble block terminal menu.


Commant list
Type below in customdata to request al available commands in the customdata:

commands

List below wil be shown whit changes made in translation strings in the customdata after reopening. It just a quick way to get available commands in de customdata.

BLOCK RENAME COMMANDS.(Chapter: Itemname)
  • add all,+tag = add tag to all blocks , even blocks after rotor en connectors.
  • remove all,+tag = remove tag to all blocks , even blocks after rotor en connectors.
  • add group,+tag = add tag to all blocks in group , even blocks after rotor en connectors.
  • remove group,+tag = remove tag to all blocks in group , even blocks after rotor en connectors.
LCD SET ARGUMENTS. (Chapter: Basic Setup => Add Screens)
  • lcdtag,screentag,surfacenumber,screenname,X,Y,-X,-Y = make an surface to write on and enable to set the resolution.
    X,Y, (resolution) -X,-Y (offset)
    if X,Y,-X,-Y = 0, it calculate and set the resolution and/or offset automatically.
  • res,screenname = tels you the set or calculated resolution.
LCD OBJECT COMMANDS (Chapter: Advanced)
  • link,screenname,memory,X,Y,Shape,H,B,°,screen to, new mouse X, new mouse Y, , , , ,
  • output,screenname,memory,X,Y,Shape,H,B,°, text, Size, Name, typeQ, actionQ, typeE, actionE,
  • input,screenname,memory,X,Y,Shape,H,B,°, text, Size, Name, type, , , ,
  • object,screenname,memory,X,Y,Shape,H,B,°, text, Şize, R, G, B, status, ,

LOGIC GATES (Chapter: Logic Gates (automation))
logic will be place in the memory start with LOGIC NAME and than the memory items divided with vertical bar "|".
[space]OR,NOR,XOR,XNOR,AND,NAND are suported.
Basic Setup

Log
Log of this script can be shown two ways.
  • In details in te terminal (bottum right).
  • On a lcd panel.
In details(right bottum corner of the terminal menu)

Add "log" to the name of the programmeble block where this script is running on.

On a lcd panel

Add the the line below to the customdata.

[lcd],[log],0,log,0,0,0,0

lcdtag
[lcd]
sreentag
[log]
surface nr
0
screen name
This must be "log"
X
0
Y
0
-X
0
-Y
0

Add lcdtag+screentag to the lcd panell block name.

Log contents
  • COMBINED DATA
  • COUNT
  • SETTINGS
    • TAGS
    • CURRENT CONTROLER
    • MOUSE
    • ADDITIONAL
    • IGC
  • IGC CHANNELS
  • MEMORY
  • LOGIC
  • ERRORS

Log parts can be turn of by adding ("-" and first 3 capital letters of title) to the name of the programmeble block where this script is running on
That part wil not be shown in details or on the log screen.

Example: COMBINED DATA = "-COM"

From here we explane every log content

COMBINED DATA

The Combined data exist out of parts from the customdata

1 Part 0 of the programmable block. (this will be updated each run)
2 Part that contains mouse lcd. (the screen the cursor is on will be updated )
3 Diverend part aech run. (the part that is updated is shown in log)

(note: if "yield" is not in the customdate. the customdata = Combined data)

To reduse the amount of instruction the programmable block have to exicute each run,
We can divide de customdata in parts by using the word "yield".

Wen do we yield

  • after settings.
  • before a new screen or screens are made.

COUNT

It is important to keep an eye on the number of instructions. If this exceeds the maximum then the script will stop working. Grid with a lot of block with same ownership will result in a higher instruction count.

  • total itemname blocks
  • total controler blocks
  • maximum instruction count
  • current instruction count

SETTINGS
  • TAGS (part of Settings)

    List off the tags that will be shown.

    • itemname = shows itemname, tag if set
    • lcdtag = shows first part of the lcd Tag
    • pittag = shows cockpit tag, if set
    • remtag = shows remote tag, if set

  • CURRENT CONTROLER

    • Controler = Selected controler that the script uses
    • Cockpit = Selected Cockpit
    • Remote = Selected Remote

  • MOUSE (part of Settings)

    Shows current state of cursor

    • mouse lcd = Current lcd the cursor is shown on.
    • mouse mode true or false = When true mouse is shown.
    • park switch true or false = When true mouse is only shown when park is activated.

  • ADDITIONAL

    • sleepmode timer = Shows countdown timer of the sleepmode.
    • Update freg. = update Speed in tiks
    • WSAD = use of keyboard Keys (true or False)

    Sleepmode turn the script off, run the prorammeble block turn the script back on.
    As long the cockpit or remote is occupide the timer wil not count down.
    By defauld sleepmode is off.


  • IGC (Inter grid communication)
    • Sendfrom = Name of grid or the name hat has bin given.
    • Sentto = Channel that has been selected to sent to
IGC CHANNELS
  • Shows All Grids/Channels that run this Script
  • Sending Message:
    To:
    Date:
    From:
    Message delivered:

MEMORY

Every memory item + its value wil be shown in here.

LOGIC

The outcome of the logic will be shown here.
Begin with type of gate, then where it looks for followed by the result.

CONTROLERS

The current controlers will be shown here by name.

ERRORS

Shows the combined data line the error is found in.
Itemname
Every block that you used whit this script need the itemname in is Name.

to tell the script what the itemname is.
itemname,[item]

After closing the customdata it wil add "[item]'' is as the itemname to the script

The scrip wil look for this word in the name of the blocks. Make shore that the word isn't a word that is use often. For example the word "door" is a bad itemname, But door between backets [door] is better,

If you want to check if the right Itemname is set you can look the Log in the Details Window of the Program Block terminal Menu under -----SETTINGS-----

To add the itemname (or another words) to all blocks.
(Note: disconnect connectors first.)

add all,[item]

After closing the customdata it will add "[item]" to every blocks name.

(Note: you can switch off a command by putting it behind // or by deleting from the Customdata.)

To remove the itemname(or another words) from all the blocks.

remove all,[item]

After closing the customdata it will remove "[item]'' form every blocks name.

To add the itemname(or another words) to every blocks name in a group.

add group,[item], group name

After closing the customdata it will add "[item]" to every blocks name in group whit " group name ".

To remove the itemname(or another words) to every blocks name in a group

Remove group,[item], group name

After closing the customdata it will remove "[item]'' from every blocks name in group whit " group name ".

You can run these commands in the argument field of the program block as well.
Add Cockpit and Remote
This script wil look at who is in control. This is needed for when the cockpit and remote is occupide at te same time. In that case the remote will control the cunsor, else the cockpit.

To set the Cockpit Tag

pittag, [control]

The Controller whit " [control]" in its Name will be seen as the cockpit.

To set the Remote Tag

remtag, [remote]

The Controller whit " [remote]" in its Name will be seen as the remote.

If you want to check if the right contoller is set you can look in the Log in the Details window of the programmeble block terminal menu under: -----SETTINGS-----
Add Screens
LCD SET ARGUMENTS.
  • lcdtag,tag = Sets screen tag is the same for every screen.

  • lcdtag,screentag,surfacenumber,screenname,X,Y,-X,-Y = Make an surface to write on and enable to set the resolution.

    If X,Y,-X,-Y = 0, it calculate and set the resolution and/or offset automatically.
    X,Y, (resolution)
    -X,-Y (offset)
Each lcd tag starts with the lcdtag followed by indetifier(screentag).
surface nr is most of the time "0" only is a block have more then one surface it can be a other nr.
Later on i tel you how to get the surface nr.
screenname, is the indetifier we use in the lines we use to place item on screen.
  • To set a Lcdtag
  • Get surface nr
  • Remove the screen numbers
  • Create a surface

To set a Lcdtag

lcdtag, [lcd]

" [lcd]"is now the lcd tag.

Get surface nr
iI the block have only one screen the surface number is "0" .

But cockpits and programmeble block have more than one surface
This script profide you whit a way to show surface number on the screens.

add lcdtag+[asterisk] in de Name of the block.
asterisk = *

text panel 1 [lcd][asterisk]

the surface numbers are now displayed on every screen of that block.

Remove the screen numbers

text panel 1 [lcd][-]

Now that we have the surface number we can create a surface to place objects on

Create a surface

lcdtag,screentag,surfacenumber,screenname,X,Y,-X,-Y

For this example we give it names:

lcdtag
[lcd]
Is the same for every surface
sreentag
[0]
Is the second part of the lcdtag and must be differend for every surface
surface nr
0
Must be the surface nr.
screen name
Screen 0
This name we use in the rest off the lines to indentify the srceen
X
0
X resolution (width), If 0 it calculate it by it self
Y
0
Y resolution (height), If 0 it calculate it by it self
-X
0
X offset, If 0 it calculate it by it self
-Y
0
y offset, If 0 it calculate it by it self

Place this line in the customdata
[lcd],[0],0,Screen 0,0,0,0,0

Place this line in the block name. you dont need to remove the name just add it
[lcd][0]

The screen should change to just an background color. If it does it connected to the script.
You can now place item on the screen. Whit commands in customdata: object, input, output, link.

Mouse Check
To check if the mouse is working, place these line in the customdata.

After Closing customdata the script place the cunsor on "Screen 0" .
mouse,Screen 0

(Note: If this command is in Customdata, the cunsor can't leave the screen becase it is forced to above screen.put it behind // .

//mouse,Screen 0

This wil set mouse mode to true .
mouse mode,true

After closing the Customdata the cunsor (the arrow on the screen) wil will be on the screen now.

You can switch de cunsor (Moude Mode) off by placing in behind //.
//mouse mode,true

In the Log in de Details window of the programblock terminal under -----Mouse----- you can check the mouse mode status.

Note: The cunsor use the conttrol Gyro movement of the remote whit remtag or cockpit whit Pittag to move over the screen(s) And Q en E for Right en Left buttons. As log as the mouse mode is true your ship gyro can't move whit these control services.

The cunsor can now leave the surface if a link is placed.
(de)activate cursor (mouse).
By programableblock run argument.
Place in the G menu the programmable block (with this script ) on action "Run" with the argument "mouse".
Press it to activate or deactivate the mouse cursor.

Park switch
by defauld this will be turn off.

when "Park" is on the cursor will be shown as well.
when "Park" is off the cursor get removed.

to turn off this behavore
park switch,false

to turn back on
park switch,true

(Note:This script disables the gyros for the cockpit or Remote block that your using at that moment.)
get Surface Resolution and offset
  • on screen
  • In the customdata

show resolution and offset on screen

lcdtag,screentag,surfacenumber,screenname,X,Y,-X,-Y
[item],[0],0,Screen 0 res,0,0,0,0
Add "res" to screenname.

If you dont want to see resolution and offset any more, remove "res".

Show resulution and offset in customdata
res,sreenname

[item],[0],0,Screen 0,0,0,0,0
In this example
screenname = Screen 0

[item],[0],0,Screen 0,0,0,0,0 res,Screen 0

Reopen customdata and "res,Screen 0" get replaced

[item],[0],0,Screen 0,0,0,0,0 //Calculated or set resolutie of screen 0 =X 256, Y 256,-X 0,-Y 0

X and Y are resolutie
-X and -Y is offset

surface
Small examples to place in the customdate after the surfacetag of the surface you want these objects on. Something to begin whit. To help you on your way.

Note: makes sure to "screenname" are the same..

PLC-OS Example Codes
Advanced

LINK - (Move to another screen / hop cursor)
To move the cunsor between screens we use te line start whit ''link''

link,screenname,memory,X,Y,Shape,H,W,°,screen to,new mouse X,new mouse Y, , , , ,
link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , ,

agrument 0 = link
Type of command
agrument 1 = screenname
Screen 0 ( if we are on screen 0)
agrument 2 = memory
space (We dont do anyting whit that at the moment
agrument 3 = X
2|1 (This will divide by 2 x 1 = center of surface)
agrument 4 = Y
10|9 (This will divide by 10 x 9 = bottum of surface)
agrument 5 = Shape
SquareSimple (So we can see the link as a Square on surface)
agrument 6 = H
10|1 (This will divide by 10 x 1 = 1/10 height )
agrument 7 = W
1|1 (This will divide by 1 x 1 = width of the screen)
agrument 8 = °
0 (Rotation of object in degrees)
agrument 9 = screen to
Screen |1( we want to move Screen 1,"|" gets remove but must be in name)
agrument 10 = new mouse X
256 (If Resolution 512 this wil place cunsor in center of screen to)
agrument 11 = new mouse Y
256 (If Resolution 512 this wil place cunsor in center of screen to)

"new mouse X" and "new mouse Y" is the new location on the screen set in "screen to".
We can not use the auto calculate to determine the new location, That location must be set manually by number. (So no divide by number x number, like we did at X ,Y ,H and W ).

Disable the "mouse check" by putting // in front of it, if it not already done

//mouse,Screen 0

Example 1: Place hover link
for this example we need 2 surfaces, see chapter: Add Screens.
"screen 1" is below "screen 0".

[item],[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , , [item],[1],1,Screen 1,0,0,0,0
Note: See that the link is place below the surface where you link from.

Now your cunsor should be able to move between "screen 0" to "screen 1" but not back.
So add another for the other screen.

[item],[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , , [item],[1],1,Screen 1,0,0,0,0 link,Screen 1, ,2|1,10|1,SquareSimple,10|1,1|1,0,Screen |0,256,256, , , , ,
Note: make sure that the cursor will not land on the other link.

Now your cunsor should be able to move between screens.

Example 2: hop cursor to another position on screen
For this example we need 1 surfaces, see chapter: Add Screens.
Screen 0

[item],[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen 0,256,256, , , , ,

OBJECT (Place object on a screen)
To place an object to the screen we use:

object,screenname,memory,X,Y,Shape,H,W,°, text, Şize, R, G, B, status, ,

agrument 0 = object
type of command
agrument 1 = screenname
Get only placed on surface whit that screenname
agrument 2 = memory
what in here must be in the memory
agrument 3 = X
X Vertical position on surface (center of object)
agrument 4 = Y
Y Horizontal position on surface (center of object)
agrument 5 = Shape
Sprite Name
agrument 6 = H
Height of Sprite
agrument 7 = W
Width Of Sprite
agrument 8 = °
Rotation in Decrees
agrument 9 = text
text the object must show
agrument 10 = Şize
text size (color of text can be added as "|255|255|0)
agrument 11 = R
color R of object between 0-255
agrument 12 = G
color G of object between 0-255
agrument 13 = B
color B of object between 0-255
agrument 14 = Status
number Between 1 and 100 or memory name


PLC,[0],0,Screen 0,0,0,0,0 object,Screen 0, ,2|1,2|1,bar|100|0,2|1,2|1,0, test bar,1, 255, 0, 0,20, ,

OUTPUT (Button, set something)
To place an output to the screen we use:
output,screenname,memory,X,Y,Shape,H,B,°, text, Size, Name, typeQ, actionQ, typeE, actionE,

agrument 0 = output
Type of command
agrument 1 = screenname
Get only placed on surface whit name
agrument 2 = memory
What in here must be in the memory, logic is also placed here
agrument 3 = X
X position on surface
agrument 4 = Y
Y position on surface
agrument 5 = Shape
Sprite Name
agrument 6 = H
Hieght of Sprite
agrument 4 = W
Width Of Sprite
agrument 8 = °
Rotation
agrument 9 = text
text the object must show
agrument 10 = Şize
Text size (color of text can be added as "|255|255|0)
agrument 11 = Name
Block Contains Name
agrument 12 = typeQ
Type when press Key "Q" ( See Type list - output )
agrument 13 = actionQ
Action when press Key "Q"
agrument 14 = typeE
Type when press Key "E" ( See Type list - output )
agrument 15 = actionE
Action when press Key "E"

1 output can activate 2 different action on the same block.

If Press "Q" on the keboard confirms actionQ.
typeQ must be specified for actionQ

If Press "E" on the keboard confirms actionE.
typeE must be specified for actionE

Example:

PLC,[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , , output,Screen 0, ,2|1,2|1,SquareSimple,2|1,2|1,0, test block,1, Block, term, OnOff_0n,term, OnOff_0ff
press "Q" wil activate "Block"
press "E" wil deactivate "Block"


Direct mouse activation(no confirm needed)

if typeQ and typeE are the same, ActionQ will be executed when the cunsor moves over it.

Example:
PLC,[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , , output,Screen 0, ,2|1,2|1,SquareSimple,2|1,2|1,0, test block,1, Block,term, OnOff_0n,term,
Note: that agrument 12 (typeQ) and 14 (typeE) are the same as soon the cursor hits agrument 13 (actionQ) wil be executed, no need to place anything in argument 15(actionE).

Simple add (space) extra in typeQ prevent this.


Direct activation (for automation)

This is possible. Moved to Chapter "Memory" for this you need to know how the "memory" works.
INPUT (get info )
to place an input to the screen we use:
input,screenname,memory,X,Y,Shape,H,B,°, text, Size, Name, type, , , ,

agrument 0 = input
type of command
agrument 1 = screenname
Get only placed on surface whit this name
agrument 2 = memory
what in here must be in the memory
agrument 3 = X
X position on surface
agrument 4 = Y
Y position on surface
agrument 5 = Shape
Sprite Name
agrument 6 = H
Hieght of Sprite
agrument 7 = W
width Of Sprite
agrument 8 = °
Rotation
agrument 9 = text
text the object must show + info to be show in text ( See Type list - input )
agrument 10 = Şize
text size (color of text can be added as "|255|255|0)
agrument 11 = Name
Block Contains Name
agrument 12 = type
Type of info to place in the status( See Type list - input )

PLC,[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareHollow,10|1,1|1,0,Screen |1,256,256, , , , , input,Screen 0, ,2|1,2|1,SquareHollow,2|1,2|1,0, <#>,1,Block, term, , , ,
This wil show onoff status of blocks that contains "Block" in there name.

ACTIONS and PROPERTIES
In this Chapter i show you how to get a list of Action And Properties of a block and how to use them.

show Properties and actions

input,Screen 0, ,4|1,2|1,SquareFilled,1|1,2|1,0,action ##,0.4,block,action, , , input,Screen 0, ,4|3,2|1,SquareFilled,1|1,2|1,0,properties ##,0.4,block,prop, , ,

first line:
Shows a list of action of Block contains "block" in its name on first half of screen
secondLine:
Shows a list of Propertiestof Block contains "block" in its name on second half of screen

Use of Action

output,Screen 0, ,8|7,2|1,SquareFilled,4|1,4|1,0, ,1,block,term ,OnOff_On, , , ,

In this example, we'll turn on every block that contains "block" in its name.

Note: if you want te use an action out of the action list "type" must be "term".

Use of Property

show on screen
type
Boolean
bool
Single
float
Color
color
Int32
not supported by this script
Long
not supported by this script

For the property that are not supported See Type list - input
Most of the time i made a type for it

  • Show whit Boolean(bool)Propery

    input,Screen 0, ,4|1,2|1,SquareFilled,1|1,2|1,0, ,0.4,block,bool|OnOFF, , ,

    In this example we'll show onoff status of every block that contains "block" in its name.
    Note: if you want te use an Boolean out of the property list "type" must be "bool"+"|"+"Boolean name".

  • Set Boolean(bool)Property

    Boolean can be set by an action most of the time. no way to set it whit this script. Use the action.

  • Show Single(float)Property

    input,Screen 0, ,4|1,2|1,SquareFilled,1|1,2|1,0, ,0.4,block,float|Radius|F0, , ,

    In this example we'll show "Radius" of every block that contains "block" in its name.
    Note: if you want te use an Single out of the property list "type" must be:
    "float" + "|" + "Single name"+ "|" + F0.

    F0 = no value after decimal marker.
    F1 = 1 value after decimal marker.
    F2 = 2 value after decimal marker.

  • Set Single (float)Property

    output,Screen 0, ,8|7,2|1,SquareFilled,4|1,4|1,0, ,1,block,float ,Radius| |1, , , ,

    In this example we'll set the "Radius" + 1 of every block that contains "block" in its name.

    Note: if you want te use an action out of the action list "type" must be:
    "float" + "|" + "Symbool" + "|" + "number".

    Symbool can be :
    + = add nummer from value
    - = remove number from value
    (space) = set value to number


  • Show Color Propery

    input,Screen 0, ,4|1,2|1,SquareFilled,1|1,2|1,0, ,0.4,block,color|Color, , ,

    In this example we'll show "Color" property of every block that contains "block" in its name.

    Note: if you want te use an action out of the action list "type" must be:
    "color" + "|" + "Color name".

  • Set Color Propery

    output,Screen 0, ,8|7,2|1,SquareFilled,4|1,4|1,0, ,1,block,color ,Color|0|0|0, , , ,

    In this example we'll set the "Color"property to black(0|0|0|) of every block that contains "block" in its name.

    Note: if you want te use an action out of the action list "type" must be: "color"
    action: Color name + "|" + R + "|" + G + "|" + B. RGB must Between: 0-255
Memory

One menory item exist most of the time out of one line and out of two part
  • Part 1: Is the memory name (Note: you can use a Space in memory name.)
    Separated by space
  • Part 2: is the value or status ( only there if a Value or Status is set.)

You can search for memory items of the program block in the details window of the terminal menu under the headline -----MEMORY----- . that the place where the memory items are stored. Each memory item has it own line. ( see Chapter log )

Add in memory
This script allow you to add small part of text to memory string and check them.

Add memory item whit Button panel by "Run" Programmable Block whit argument.

setput,(What you want to put in the Memory)

When run again, it will remove the Memory Item.

(note: Only for checking this can be placed in the Customdata, everytime you close the Customdata this code wil be executed, More for Manual Use like buttons or hotbar. you can use this in the argument Field of programmable Block as well)

Add memory item whit output.

output,Screen 0, 2|1,2|1,SquareFilled,2|1,2|1,0, ,1, ,mem ,S0|P1, , , ,

If "|" is added it wil split. "S0" is the name "P1" value or status.

First push, it add S0 and P1.
Second push, it removes P1.
Third push, it add P1 again.

If "|" is there, it replace the value or Status of the memory item.
If not it make another memory item if the value is different.

If "|" is not added it wil only Add "S0 P1"

Change S0|P1 in S0|P2.

output,Screen 0, ,2|1,2|1,SquareFilled,2|1,2|1,0, ,1, ,mem ,S0|P1,mem ,S0|P2, ,

Press Q "S0" has value "P1".
Press E "S0" value is change in "P2".
Press Q again "S0" has value "P1" again.

Store memory item whit Input.

You have to give memory item a name. Add this in the argument Called "name" (argument 11 )divided "|".

The name we give the Memory item in this Example = BL
In "type"(argument 12) we have to set what to store. In this Example = term<#> = on/off Status

input,Screen 0, ,2|1,2|1,SquareFilled,2|1,2|1,0, <#>,1, BL |Block, term<#>, , , ,
Remove from memory
Remove memory item whit output.

In "TypeQ" (agrument 12) or "typeE" (argument 14) we place "mem-".
In "ActionQ" (agrument 13) or "ActionE" (argument 15) we place memory item we want to remove.

output,Screen 0, ,2|1,2|1,SquareFilled,2|1,2|1,0, ,1, ,mem- ,S0 P1, , , ,

note: mem contains a minus after it.
Store memory whit Input
When a input is use you can store that value that you have shown as text also to the memory

You have to give memory item a name. Add this in the argument Called "name" divided "|".

The name we give the Memory item in this Example = BL
In type we have to set what to store. In this Example = term<#> = on/off Status

input,Screen 0, ,2|1,2|1,SquareFilled,2|1,2|1,0, <#>,1, BL |Block, term<#>, , , ,
Clear memory
In some cases you want to be able to clear the memory.

The memory get saved. Compiling the script will not clear it.

So how do we clear it than?

You can clear it whit "setput", just like you add one.

Clear memory by "Run" Programmable Block whit argument.

setput, cl

Note: there is a space before and after "cl",
Invert memory value
In some cases you want the memory value to be positive instead of negative. or the other way around. The script can handle negetieve values to, so dont worry.

Invert memory Value whit output.

Example: S0 -100
It is a negetive value, we want it to be positive.

output,Screen 0, 0,0, ,0,0,0, ,1, ,mem | inv ,S0, , , ,

Example: S0 100

Note: "S0" has now a positive value.
Direct activation of an output line
for this you need to now how to use the Memory and is the first step to automation by the script

If typeQ contains "<auto>", ActionQ will be executed if memory contains agrument 2(memory)
If typeE contains "<auto>", ActionE will be executed if memory DONT contains agrument 2 (memory)
in argument 2 we can add a logic gate that compares multiply memory values

but for now we check only one value, in the example that is "hello" in the tirth line.

example:

PLC,[0],0,Screen 0,0,0,0,0 link,Screen 0, ,2|1,10|9,SquareSimple,10|1,1|1,0,Screen |1,256,256, , , , , output,Screen 0,hello,0,0, ,0,0,0, ,1, Block, term <auto>, OnOff_0n,term <auto>, OnOff_Off

in this example, a block named "Block" is enabled if the memory has "hello" in its memory, otherwise it is disabled

note: that as long the memory has Argument 2 in it ,agrument 13(actionQ) wil be executed,
else 15(actionE).
W S A D C F in memory
W S A D C SPACEBAR are the default movement keys on the keyboard. These are accessible by the programmable block.

This function must be turn on in the Customdata and is called "WSAD".
when false this turn off.
when true this in turn on.

WSAD,true

SPACEBAR return as F in this script. This can be change in the translation string in the script editor in the game

If one of these keys will be pressed that key get stored (like: space + key + space) in the memory but will not be removed.
to remove it we add a line in the Customdata for every key we want to remove. In this Example it is: " W "

output,Screen 0, W ,0,0, ,0,0,0, ,1, ,mem- <auto>, W , , , ,

(Note: We place this line ones after the lines that does something whit " W ")

Most of the time i place these lines on the bottom of the Customdata. for every letter once
output,Screen 0, W ,0,0, ,0,0,0, ,1, ,mem- <auto>, W , , , , output,Screen 0, S ,0,0, ,0,0,0, ,1, ,mem- <auto>, S , , , , output,Screen 0, A ,0,0, ,0,0,0, ,1, ,mem- <auto>, A, , , , output,Screen 0, D ,0,0, ,0,0,0, ,1, ,mem- <auto>, D , , , , output,Screen 0, C ,0,0, ,0,0,0, ,1, ,mem- <auto>, C , , , , output,Screen 0, F ,0,0, ,0,0,0, ,1, ,mem- <auto>, F , , , ,

(Note: "Screen 0" must be a screen name that exist)

Do Something whit W or S Key

In "memory" (argument 2) we place the letter ( W )whit the space before and after it.
In "TypeQ" (agrument 12) or "typeE" (argument 14) we place "<auto>" to automate the line.

output,Screen 0, W ,0,0, ,0,0,0, ,0,Piston,float <auto>,Velocity| |0.5, , ,
In the example above when pressing W the velocity of all blocks called "Piston" wil change to "0.5" (Plus)

output,Screen 0, S ,0,0, ,0,0,0, ,0,Piston,float <auto>,Velocity| |-0.5, , ,
In the example above when pressing " S " the velocity of all blocks called "Piston" wil change to "-0.5" (Min)

output,Screen 0, XNOR| W | S ,0,0, ,0,0,0, ,0,Piston,float <auto>,Velocity| |0, , ,
In the example above both " W " and " S " in not used the velocity of all blocks called "Piston" wil change to "0".
In this case we already used a logic gate that we try to explane in the next chapter.

(Note: If there a block called "Piston" that do not know the terminal action 'Velocity" the script wil stop working. In that case you should change the blockname and recompile the script).

Logic Gates (automation)

Logic Gates are place in the memory part of a line.

In this chapter i wil show how to use them.

It will always begin whit the type of Logic Gates followed by "|".
After "|" you will place what it have to look for in the memory.
This can be repeated.
You can't use two different gates in one line.

Every memory item wil return "1" or ''0''.
If memory item is there it wil "1".
If memory item is not there it wil "0".

the outcom of the logic is visable in the log shown in Terminal(K).
when "log" is placed in the programmeble block Name.

Depending on what Gate is used, the line will be displayed or is usable.

Note: make sure there is a space before the Gate name.

OR
Contains "1"
NOR
Contains "0"
XOR
Contains "1"and ''0'' dont work when it only has "0"s or only has"1"s
XNOR
work when it has only "0"s or only has "1"s
AND
Contains only "1"
NAND
Contains only "0"
OR gate example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, OR|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S1 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "S1 P1" or "S2 P1" is in the memory wil "S3 P1" wil be placed in the menory
NOR Gate Example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, NOR|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S1 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "SO P1" or "S1 P1" is not in the memory, "S3 P1" wil be placed in the menory
XOR Gate Example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, XOR|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S3 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "SO P1" or "S1 P1" is in the memory, "S3 P1" wil be placed in the menory. But if both will be there, it's not.
XNOR Gate Example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, XNOR|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S1 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "SO P1" or "S1 P1" is in the memory, "S3 P1" wil not be placed in the menory. But if both will be there or not, it's will.
AND Gate Example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, AND|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S3 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "SO P1" and "S1 P1" is in the memory, "S3 P1" wil be placed in the menory.
NAND Gate Example
input,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,S0 P1,0.4, ,mem|S0 P1, , , input,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,S1 P1,0.4, ,mem|S1 P1, , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, ,8|4,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem ,S0|P1, mem,S1|P1, , output,Screen 0, XNOR|S0 P1|S1 P1,8|6,2|1,SquareFilled,4|1,4|1,0,S2 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Shows green if "S0 P1" is in the memory
secondLine:
Shows green if "S1 P1" is in the memory
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
Button press"Q" to "S0 P1" and press "E" to "S1 P1"
FifthLine:
as long "SO P1" and "S1 P1" is in the memory, "S3 P1" wil not be placed in the menory.
Compare memory items values
We can do this by placing "=",">" or "<" between memory name and value or another memory name.

">" is smaller then memory item in front of it
"<" is bigger then memory item in front of it
"=" is the same as memory item in front of it

This will only work whit numbers.
Also we have to tell which gate we want to use.

Example 1: Compare 1 memory value whit fix number
in de memory we have 1 memory items whit name "G1".

G1 60

output,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,G1,1, ,mem <auto> ,G1 60, , , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, OR|G1>100,8|6,2|1,SquareFilled,4|1,4|1,0,S3 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Create memory "G1" whit Value 60
secondLine:
if "S3 P1"is in the memory its remove it
ThirdLine:
wil check G1 is Bigger than 100

If G1 is bigger than 100 this wil return a "1" and because we use a OR gate, "S3 P1" wil be place in the memory.

In our example this is not he case so "S3 P1" will not be place in the memory.

Example 2: Compare 2 memory values
In de memory we have 2 memory items whit names "G1" and "G2"

G1 60
G2 80

output,Screen 0, ,8|2,8|3,SquareFilled,4|1,4|1,0,G1,1, ,mem <auto> ,G1 60, , , , output,Screen 0, ,8|2,8|5,SquareFilled,4|1,4|1,0,G2,1, ,mem <auto> ,G2 80, , , , output,Screen 0,S3 P1,8|7,2|1,SquareFilled,4|1,4|1,0, ,1, ,mem- <auto> ,S3 P1, , , , output,Screen 0, OR|G1< G2,8|6,2|1,SquareFilled,4|1,4|1,0,S3 P1,1, ,mem <auto> ,S3 P1, , , ,

first line:
Create memory "G1" whit Value 60
secondLine:
Create memory "G2" whit Value 80
ThirdLine:
if "S3 P1"is in the memory its remove it
FourthLine:
wil check G1 is smaller than G2

If G1 is smaller than G2 this wil return a "1" and because we use a OR gate, "S3 P1" wil be place in the memory. In our Example this is the case.
INTER GRID COMUNICATION (IGC)

This script allow to get info(some kind of webpage)form another programeble block (PB) whit this same script on it.
  • You need at lease 2 PB.
    (Note: they don't need to be on te same grid. But need to be connected by antenne or mechanical connection)
  • Ownership must be in the same faction.
Set channels (sentfrom and sentto)
Now you need to set a Channel Name for every PB.
(Note:these may not contain the name of te other.)

sendfrom,channel name

For this example we name te chanels like:
PB 1= Main Station
PB 2= Small ship

PB 1
sleep,0
sendfrom,Main Station
PB 2
sleep,0
sendfrom,Small ship

(Note: script in "sleepmode" can not receive anything. we turn of sleepmode by adding "sleep,0")

The channel to sent to can be set as well.
(Note: wen set you can't change it in script)

sendto,channel name
PB 2
sleep,0 sendfrom,Small ship sendto,Main Station
To See wat is been sent or resieved
There are to way to see wat has been send or resieved.
  • in the log under -----IGC CHANNELS-----
    This shows the channels.
    Under it shows last massege sent or resieved.
  • on a surface.

on a surface.

We make a surface for each PB.

iIn "type" (argument 12) we add "com <to> <list>".
  • com = type
  • <to> = get replaced by channel to sent to.
  • <from>= get replaced by channel to sent from.
  • <list> = get replaced bij list of channel known and last
    resieved message
PB 1
sleep,0 sendfrom,Main Station itemname,[main]
lcdtag,main

main ,[0],0,Screen 0,0,0,0,0
input,Screen 0, ,2|1,2|1,SquareFilled,5|3,1|1,0, ,0.3, ,com <to> <list>, ,
(Note:dont forget to add the "itemname" and the "lcdtag+screentag" to the block name)

PB 2
sleep,0 sendfrom,Small ship sendto,Main Station itemname,[ship]
lcdtag,ship

ship,[0],0,Screen 0,0,0,0,0
input,Screen 0, ,2|1,2|1,SquareFilled,5|3,1|1,0, ,0.3, ,com <to> <list>, ,
Simple test send
lets send the text "Hello" from PB 2 to PB 1 as test

Can be done 2 ways.
  • Via Pb "Run" whit argument "Hello".

  • In the CustomData by placing an output.

In this example we add an output
in "typeQ" (argument 12) we place "com".
in "ActionQ" (argument 13) we place the message want to sent.

Note: we have placed a second message in "typeE" "ActionE" .

PB 2
sleep,0 sendfrom,Small ship sendto,Main Station itemname,[ship] lcdtag,ship ship,[0],0,Screen 0,0,0,0,0 input,Screen 0, ,2|1,2|1,SquareFilled,5|3,1|1,0, ,0.3, ,com <to> <list>, , output,Screen 0, ,2|1,2|1,SquareFilled,10|1,10|1,0,send hello ,0.3, ,com,hello, com ,bye
Push the button on de surface will sent the the text "hello".

if done right the follow messege wil appaer:
PB 1
Resieved IGC Private message From: Small ship To: Main Station Data: Hello
PB 2
Sending message From: Small ship To: Main Station Data: Hello Main Staion ,Private message deliverd: Hello
IGC browser
The lines below wil show some kind of browser
With which you can find and browse channels.
With the button "go" we ask to show information stored (web) on the channel of your choice
not every PB have info stored.

input,Screen 0, ,2|1,2|1,SquareFilled,5|3,1|1,0,<to>##<list>,0.3, ,com, , , output,Screen 0, ,20|11,10|1,SquareFilled,10|1,6|1,0,ping,0.3, ,com,ping, , output,Screen 0, ,20|1,10|1,TriangleFilled,10|1,10|1,-90, p,0.3, ,com,prev, , output,Screen 0, ,20|3,10|1,TriangleFilled,10|1,10|1,90,n ,0.3, ,com,next, , output,Screen 0, ,20|7,10|1,SquareFilled,10|1,6|1,0,list,0.3, ,com,list, , output,Screen 0, ,20|15,10|1,SquareFilled,10|1,6|1,0,go,0.3, ,com,www@Screen 0, , output,Screen 0, ,20|18.5,10|1,SquareFilled,10|1,10|1,0,x,0.3, ,com,cl, ,

(note: To be able to cycle through the channels "sendto" must be deactivated)
Web (making website)
We can store info by adding "web" instead of "screenname"

// door 1 output,web, ,20|3,8|5, ,20|2,20|1,0, ,0.7,Door 1,term <send Q> ,Open,term <send E>,OnOff input,conv, ,20|3,8|5,SquareFilled,20|2,20|1,0,Door 1#<#>,0.5,Door 1, door, , , //door 2 output,web, ,20|3,8|5, ,20|2,20|1,0, ,0.7,Door 2,term <send Q> ,Open,term <send E>,OnOff input,conv, ,20|3,8|5,SquareFilled,20|2,20|1,0,Door 2#<#>,0.5,Door 2, door, , , // base vent output,web, ,20|5,8|5, ,20|4,20|4,0, ,0.7,Airvent Base,term <send Q>,Depressurize, , input,conv, ,20|5,8|5,SquareFilled,20|4,20|4,0,<%>,0.7,Vent base, vent, , ,

In this above example we have small base whit 1 airvent and 2 doors.

Note that the input has "conv" instaed of "web". it converts the input to object whit the status of the input. if requested it wil send the output and object to the requesting PB.

The requesting PB can interact whit it. Opening Door 1, 2 and de/pressurize the Airvent Base.

(Note: dont forget to put "<send Q>" and "<send E>" so it can be send back.)
Conclusion / Request.

This script is still a work in progress.

If you want make a movie or serie about it, we will make some free time for it, We tried, but our setup wasn't really made for it. The sound was really bad.

We have not yet discussed everything in this manual, so if you have any questions, ideas or suggestions, we would like to hear them.

Enjoy

Twotwinbrothers