Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
e.g. seq or sge
They write a 0 or 1 into a variable and can be used to switch off or on.
l Temp TempSensor Temperature
sge ok Temp 299
s WallCooler On ok
Not the best example, but I think it shows what you want.
edit: And also look at the boolean comparisons.
In connection with 'select'
My question now is can this language do 2 things in the same chunk (main) for example a blt & bgt for 2 different things or will it always divert down the first set of blt / bgt before ever reading the 2nd set?
Take a look at "slt" and "sgt" instead of branching. Let's say if the temperature was less than 300 kelvin, I want to turn on a heater and activate a vent volume pump...
alias Sensor d0
alias Heater d1
alias VolPump d2
alias Var r0
alias Temp r1
Start:
l Temp Sensor Temperature #get the temperature
slt Var Temp 300 #if temp < 300 then Var = 1 else Var = 0
s Heater On Var #turn heater on/off
s VolPump On Var #turn volumne pump on /off
yield #wait a tic
j Start
Much easier than jumping around with conditional line branches.
Alternately, you can setup a function type call using "ra" as a return line #.
alias Sensor d0
alias Heater d1
alias VolPump d2
alias Var r0
alias Temp r1
Start:
l Temp Sensor Temperature #get the temperature
bltal Temp 300 HeatOn
bgtal Temp 299 HeatOff
j Start
HeatOn: #function call to turn on heater/vol pump
s Heater On 1
s VolPump On 1
j ra
HeatOff: #function call to turn off heater/vol pump
s Heater On 0
s Volpump On 0
j ra
define MAX_PRESSURE 45636 #42636 #20265kPa, 45,636kPa
define PUMP_SET 10
alias rIterator r10
alias rTemp r11
alias rCurrPressure r6
alias rGasPumpFlag r7
Start:
yield
move rIterator 0
Loop:
sleep 1
jal _UpdateReference
jal _FunctionForDevice
add rIterator rIterator 1
bgt rIterator 2 Loop_End
j Loop
Loop_End:
j Start
_UpdateReference:
mul rTemp rIterator 3
add rTemp rTemp 1
jr rTemp
alias dGasTank d0
alias dGasPump d1 #Index 0
j Select_end
alias dGasTank d2
alias dGasPump d3 #Index 1
j Select_end
alias dGasTank d4
alias dGasPump d5 #Index 2
j Select_end
Select_end:
j ra
_FunctionForDevice:
bdns dGasPump Function_End
bdns dGasTank Function_End
l rCurrPressure dGasTank Pressure
sge rGasPumpFlag rCurrPressure MAX_PRESSURE
#s dGasPump Lock 0
s dGasPump Setting PUMP_SET
s dGasPump On rGasPumpFlag
#s dGasPump Lock 1
Function_End:
j ra
alias Sensor d0
alias AirCleaner d1
alias CurrentTemp r1
alias MaxTemp r2
alias MidTemp r3
alias MinTemp r4
alias CurrentPollutant r5
alias CurrentVolatiles r6
alias DesiredPollutant r7
alias DesiredVolatiles r8
add MaxTemp 273.15 28
add MidTemp 273.15 25
add MinTemp 273.15 22
abs DesiredPollutant 0
abs DesiredVolatiles 0
define WallCoolers -739292323
define WallHeaters 24258244
lifesupport:
l CurrentTemp Sensor Temperature
l CurrentVolatiles Sensor RatioVolatiles
l CurrentPollutant Sensor RatioPollutant
bgtal CurrentVolatiles DesiredVolatiles volaclean
bgtal CurrentPollutant DesiredPollutant pollclean
bltal CurrentVolatiles DesiredVolatiles idleclean
bltal CurrentPollutant DesiredPollutant idleclean
bgt CurrentTemp MaxTemp overtemp
blt CurrentTemp MinTemp undertemp
bgt CurrentTemp MidTemp idleheater
blt CurrentTemp MidTemp idlecooler
j lifesupport
overtemp:
sb WallCoolers On 1
j lifesupport
undertemp:
sb WallHeaters On 1
j lifesupport
idlecooler:
sb WallCoolers On 0
j lifesupport
idleheater:
sb WallHeaters On 0
j lifesupport
volaclean:
s AirCleaner On 1
j ra
pollclean:
s AirCleaner On 1
j ra
idleclean:
s AirCleaner On 0
j ra
For my automatic lights I simply used 2 sgt lines to check occupants against 0 and used those variables to trigger my lights (all without a jump aside from looping), this allowed me to have multiple rooms acting off the same chip. Only Limit is the amount of devices per housing,
alias MainHallSensor d0
alias MainHallLight1 d1
alias MainHallLight2 d2
alias MainHallLight3 d3
alias KitchenSensor d4
alias KitchenLight1 d5
alias OccupantsMainHall r1
alias OccupantsKitchen r2
alias MainHallLights r3
alias KitchenLights r4
main:
l OccupantsMainHall MainHallSensor Quantity
l OccupantsKitchen KitchenSensor Quantity
sgt MainHallLights OccupantsMainHall 0
sgt KitchenLights OccupantsKitchen 0
s MainHallLight1 On MainHallLights
s MainHallLight2 On MainHallLights
s MainHallLight3 On MainHallLights
s KitchenLight1 On KitchenLights
j main
Congrats OP. Made me smile for real.
1. using batch command to control Same devices
2. db value setting to control Main-sub IC housing
3. Communication between IC housings through encoding-decoding
1 - I believe what you are referring to here is using the hash to control same items and I did use that "sb" i think in my life support code. The reason I did not use a batch command for my lights is because I wanted the rooms to be separate from each other while using same housing.
2 - I did some looking and is this referring to the debugging type thing that you can display the current line or register value to the housing? The examples on the wiki are "s db Settings r0" and "s db Settings 137".
3 - This one I failed to find documentation on can you give an example of this process? By the sounds of it you could essentially make a master script on 1 housing that can activate a connected housing (possibly through a device dial).
It can also be beneficial to re-send commands. For example, if you add a new solar panel to an existing circuit and a Vertical or Horizontal value isn't changing, then the new solar panel won't receive the initial codes it needs for setup orientation (like on the Moon). If you're in multi-player and another player turns on/off something they shouldn't have, then resending the code to keep the item at the desired setting could save you from a catastrophic failure. So yes, the redundancy seems wasteful but there are benefits to doing so.
Push's and Pop's are more complex than I'm willing to cover just now. Plenty of Google searches can cover this topic, it's useful but can be tricky to use.