Stationeers

Stationeers

View Stats:
iwassnow Apr 2, 2024 @ 9:13pm
Is there any way to us a device's ReferenceId to access it via IC10?
Quick summary: I am interested in overcoming the pin limit without needing to do a scan for a hash name every time I want to talk to a device. I figure since the device's ReferenceId is unique to it, it would make logical sense to utilize it. However I'm not sure how or even if I can use this. Trying to substitute it for a d? throws an exception, which does make sense, but I can't seem to find any other way to use this.

Basic structure of what I want looks like this:

initialization:
lbn r10 deviceHash HASH("thingIWant") ReferenceId 1

multipleUseSection:
yield
#do something with the device here using ReferenceID to find it faster than load batch name
j multipleUseSection


In the end it's not terribly important, but my curiosity was piqued as I heard the batch calls were slow from querying every device on the network(which makes sense). Technically, depending on how such a lookup using ReferenceId is implemented, it could be just as slow or slower, but the utilization of the ReferenceId in this way could have other uses as well.
< >
Showing 1-8 of 8 comments
BNE Apr 4, 2024 @ 5:39am 
have a look in this code
https://steamcommunity.com/sharedfiles/filedetails/?id=3174347450
it has plenty cpmments and detailed instructions. Its power manahment and solar tracking based on that commands and works pin free.. play with it.

define Sensors -1747737642 #gas-sensors-hash define mySensor HASH("mySensorsName") lbn r0 Sensors mySensor TEMPERATURE 3 lbn r0 Sensors mySensor TEMPERATURE MAXIMUM lbn r0 -1747737642 mySensor TEMPERATURE MAXIMUM lbn r0 -1747737642 HASH("mySensorsName") TEMPERATURE MAXIMUM

loads the TEMPERATURE value of the gas Sensor labeled mySensorsName into register 0 using MAXIMUM function ..all example lbn lines are equal and doing the same

lb -targetRegister- -prefabHASH- -PARAMETER TO READ- -BATCHMODE 0-3-
read ALL connected devices of prefabHASH

lbn -targetRegister- -prefabHASH- -HASHofSTRING(labelname) -PARAMETER TO READ- -BATCHMODE 0-3 (MIN/MAX/SUM/AERAGE)-
read ALL connected devices of prefabHASH with label Name


sb and sbn use same format as s
sbn Memory HASH("memory1") Setting r0

Memory is an alias for the prefabHASH in this example

*batchMode is a parameter equal to 0, 1, 2, or 3. These are also defined as the constants Average, Sum, Minimum, and Maximum respectively. The word or number can be used.

reference
https://stationeers-wiki.com/MIPS
iwassnow Apr 4, 2024 @ 6:16am 
No, I'm afraid this is the opposite of what I am asking for. I want to NOT use the batch commands to set or load values. I want to use them once to find a device's ReferenceId, and then find that device using said ID for further Read/Write.

I am perfectly aware of how to use the batch name commands to find things. I am specifically looking for alternatives. Finding things by name in an unsorted database is slow. I am hoping to be able to find things by device ReferenceID *with the assumption that those might be faster to locate in the database due to potentially being sortable.* If they are not sortable, then the answer to my question is a simple no, which would be fine, I am merely curious.
BNE Apr 4, 2024 @ 3:57pm 
I am sorry. Then the final answer is simply "no".

You got the choice of either using pins or lb(n).

Guess I am running the lowest spec hardware here all around, I dont see or notice an issue here. My IC´s codes all do their jobs inside one tick, (0,5) sec, whats seldom required by the given tasks btw. (i even add yields and sleep commands). Your code wount update faster than once a tick. Cant see the issue.
Torn4dO Apr 5, 2024 @ 1:30am 
Hi you can use the "ld" and "sd" functions for that, use a configuration card in your tablet to find the refID of a device (its on the top when you look at it with your tablet)
so for example if the REF id of a pump is "$AD4F" then you define and use it as this:

define pump $AD4F

sd pump On 1 (or whatever)

this is how you can add devices without using the batchcommands
BNE Apr 5, 2024 @ 5:50am 
whoops-- when was that one introduced... conpletely missed that.. thanks a lot.
iwassnow Apr 6, 2024 @ 12:18am 
Originally posted by Torn4dO:
Hi you can use the "ld" and "sd" functions for that, use a configuration card in your tablet to find the refID of a device (its on the top when you look at it with your tablet)
so for example if the REF id of a pump is "$AD4F" then you define and use it as this:

define pump $AD4F

sd pump On 1 (or whatever)

this is how you can add devices without using the batchcommands

Oh yes, this is exactly what I wanted! I will begin messing around with this very soon. thank you! I tried something similar and it did not work, I did not realize there was a different command.
iwassnow Apr 6, 2024 @ 12:24am 
Originally posted by BNE:
Your code wount update faster than once a tick. Cant see the issue.

Yeah it's not about that. It's about making sure it does only take one tick. If you have a lot of things to do all at once, each line of code takes time to process, and according to information about the yield command, the game only will process 128 lines per tick anyway. Additionally, if the lb(n) commands are as slow as I've heard, using them frequently can cause the connected scripts to actually not finish in a tick.

Clearly this won't apply to many people, and I did admit in my original post that this was merely curiosity on my part. As I am a programmer professionally, I was interested to see what ways I could optimize or restructure various tasks. This could very well be slower, but my goal was to learn and try something new, not to accept 'good enough.'
Originally posted by Torn4dO:
Hi you can use the "ld" and "sd" functions for that, use a configuration card in your tablet to find the refID of a device (its on the top when you look at it with your tablet)
so for example if the REF id of a pump is "$AD4F" then you define and use it as this:

define pump $AD4F

sd pump On 1 (or whatever)

this is how you can add devices without using the batchcommands
Thank you very much. I give you 300 points for this tip. You deserve them.
< >
Showing 1-8 of 8 comments
Per page: 1530 50