Suggestion for the new Sensor Block

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    Briefly:
    I love the new sensor blocks, and I can see myself making all sorts of cool creations from them. However, one simple modification would increase their usefulness quite a bit, I think. How about we allow them to sense when an "empty" state is achieved? For example, when a storage is empty, or shields are at 0%, or power, ect.

    Example:
    I'll use a sensor block connected to a storage as an example. Right now , players can press C on a sensor block and V to one or more activation blocks, then C on the sensor block and V to a storage. Place an activation block next to the sensor.. And then they can then turn on or off the activation blocks to set the "ratio" at which the sensor block will transmit an on signal. Cool. So if you put 4 activation blocks and turn one on and the rest off, then the sensor triggers at 25% or greater. But what if you want it to trigger when nothing is in the storage? Right now if you have 0 out of the 4 connected activation blocks on, then the sensor block ALWAYS transmits an on signal when pulsed by a clock. What is the use of this?

    The Solution:
    Why not instead have the sensor block behave a little differently, so that when 0 out of the 4 activation blocks are on, it will ONLY transmit an on signal when the storage is empty? This would allow an easy way to sense when an individual item is placed into the storage.

    Now, I know that OR blocks have a similar function, but there is one big problem with them. They will only trigger if an item is placed in the storage as a result of the storage pulling the item from another storage. If a player places an item into the storage, the OR block does not turn on, nor does it turn off when the item is removed and the storage is empty again. This leads to some wonky and slow logic systems that have to move items back and forth, leaving the user a bit confused as to what is going on and having to wait for it all to work. But changing the way the sensor block deals with empty storages would largely fix this issue and allow better logic systems.

    Thank you for your time. :)
     
    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    The Solution:
    Why not instead have the sensor block behave a little differently, so that when 0 out of the 4 activation blocks are on, it will ONLY transmit an on signal when the storage is empty?
    I'd rather make it vice versa and make it transmit a signal if the storage isn't empty, that seems to be more logical to me. Just interpret 0 active avtivators as >0 instead of >=0.
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I'd rather make it vice versa and make it transmit a signal if the storage isn't empty, that seems to be more logical to me. Just interpret 0 active avtivators as >0 instead of >=0.
    I can see the reasoning for this and I like it. Right now it's like "25% or higher" when one of four activation blocks is on. Though to me, all activation off means it should be true when it's off. To me this means "nothing" not "0% or greater." So it is testing for the condition of "nothing." Whereas if an activation block is turned on, then it becomes "whatever % or greater". I think both ways make sense and would work the same, but perhaps your solution is more readily understandable.

    But there is a 3rd option here. What if when activation blocks are connected, but off, it works in your way. But with NO activation blocks connected at all, it works my way. So the presence of activation blocks equates to the "or greater", and the number of them activated creates the number percentage. However, if no activation blocks are connected, the comparison becomes "nothing."

    To put it into scripting terms:

    With no activation blocks connected to the sensor:
    if [ $storage == null ]; then
    echo "Storage has nothing in it!"
    else
    echo "Storage has something in it!"
    fi

    With activation blocks connected, but all are off:
    if [ $storage -ge 0 ]; then
    echo "Storage has something in it!"
    else
    echo "Storage has nothing in it!"
    fi

    You might think this is all inane, but.. the reason why you might want this is because.. gravity blocks. They can only accept a logic signal that is one deep. So if you want gravity to change for an astronaut when a storage is emptied, you couldn't do it with your method. (Though it would work when the player places an item into the storage). With both methods available, however, then the logic could be set up either way (so long as the devs allow a logic signal from a sensor to be used in this manner).
     
    Last edited:
    Joined
    Jan 25, 2015
    Messages
    964
    Reaction score
    225
    • Wired for Logic
    • Councillor 2 Gold
    • Legacy Citizen 5
    some "programming terms"
    Carefull with that, some programmers get triggered when you "put something in programming terms" unless you are a programmer yourself. even worse, saying you are putting something in "scripting terms" when talking about java can get people triggered.

    Just warning you, don't know if it's just the people I surround myself with (expect schema, he's cool) that get triggered easily.

    anyways Love the idea!
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    Carefull with that, some programmers get triggered when you "put something in programming terms" unless you are a programmer yourself. even worse, saying you are putting something in "scripting terms" when talking about java can get people triggered.

    Just warning you, don't know if it's just the people I surround myself with (expect schema, he's cool) that get triggered easily.

    anyways Love the idea!
    Well, I just find it easier to talk about logic by giving it a framework that can be typed out, rather than "connect an activation block to an and gate and then to an or gate and then blah blah." I just used some simple bash shell scripting there. I figure anyone that doesn't understand the syntax would just skip over that part anyhow. I was just trying to illustrate the concept.

    But, I didn't say "programming," did I? And what's wrong with scripting? I've been learning a ton of bash scripting to work on the wrapper for the Light vs Dark server. I created the wrapper for it. I've spent over 100 hours so far on the scripts for the server, just for Starmade. I've spent thousands of hours scripting in different languages throughout the years. Not saying I'm some sort of savant at scripting or anything, but I've put in my time. And I'm not about to call myself a programmer, because I'm not. I'm a scripter. (Not as good as a programmer, but still a lot more useful than an AOL user - I got mail, yay!)

    But glad you like the idea! ;)
     
    Joined
    Jan 25, 2015
    Messages
    964
    Reaction score
    225
    • Wired for Logic
    • Councillor 2 Gold
    • Legacy Citizen 5
    Well, I just find it easier to talk about logic by giving it a framework that can be typed out, rather than "connect an activation block to an and gate and then to an or gate and then blah blah." I just used some simple bash shell scripting there. I figure anyone that doesn't understand the syntax would just skip over that part anyhow. I was just trying to illustrate the concept.

    But, I didn't say "programming," did I? And what's wrong with scripting? I've been learning a ton of bash scripting to work on the wrapper for the Light vs Dark server. I created the wrapper for it. I've spent over 100 hours so far on the scripts for the server, just for Starmade. I've spent thousands of hours scripting in different languages throughout the years. Not saying I'm some sort of savant at scripting or anything, but I've put in my time. And I'm not about to call myself a programmer, because I'm not. I'm a scripter. (Not as good as a programmer, but still a lot more useful than an AOL user - I got mail, yay!)

    But glad you like the idea! ;)
    There have been heating discussions about java scripting and java programming. Java vs. JavaScript just to show that there is a difference between programming and scripting. I don't quite know the difference, but man did my friend get mad when I said scripting when we were talking about java :P You are a programmer when you write in a programming language. a scripter when you write in a scripting language ;)
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    There have been heating discussions about java scripting and java programming. Java vs. JavaScript just to show that there is a difference between programming and scripting. I don't quite know the difference, but man did my friend get mad when I said scripting when we were talking about java :p You are a programmer when you write in a programming language. a scripter when you write in a scripting language ;)
    I'm probably the last person you need to explain this to. I have thousands of hours of experience scripting over the last 22 years of so. I've also studied a few programming languages, but I never became proficient. Scripting is easier to get into as a hobbyist because there are more immediate and practical uses. I studied C++ for a little though. Declaring variables and having to #include everything.. I also did some java programming at one point for some MineCraft modding (particularly to fix bugs in existing mods and get mods to cooperate with each other better), but I didn't really like the methodology. But I wouldn't consider myself a programmer until I fully learned a programming language and could code at a professional level. I consider the term "programmer" to denote a professional, to which I wouldn't have a claim.

    But if someone gets angry at a scripter for putting something into "scripting terms," using bash shell syntax, then I'm not really going to be too worried about their feelings (no offense). Because that would be utterly mad.
     
    Last edited:
    Joined
    Jan 25, 2015
    Messages
    964
    Reaction score
    225
    • Wired for Logic
    • Councillor 2 Gold
    • Legacy Citizen 5
    I'm probably the last person you need to explain this to. I have thousands of hours of experience scripting over the last 22 years of so. I've also studied a few programming languages, but I never became proficient. Scripting is easier to get into as a hobbyist because there are more immediate and practical uses. I studied C++ for a little though. Declaring variables and having to #include everything.. I also did some java programming at one point for some MineCraft modding (particularly to fix bugs in existing mods and get mods to cooperate with each other better), but I didn't really like the methodology. But I wouldn't consider myself a programmer until I fully learned a programming language and could code at a professional level. I consider the term "programmer" to denote a professional, to which I wouldn't have a claim.

    But if someone gets angry at a scripter for putting something into "scripting terms," using bash shell syntax, then I'm not really going to be to worried about their feelings (no offense). Because that would be utterly mad.
    Had I known that you are an experienced scripter... I would have never said all that stuff :P
     
    Joined
    Apr 1, 2015
    Messages
    4
    Reaction score
    0
    • Legacy Citizen
    Well, I just find it easier to talk about logic by giving it a framework that can be typed out, rather than "connect an activation block to an and gate and then to an or gate and then blah blah." I just used some simple bash shell stripping there. I figure anyone that doesn't understand the syntax would just skip over that part anyhow. I was just trying to illustrate the concept.

    But, I didn't say "prostitution," did I? And what's wrong with stripping? I've been learning a ton of bash stripping to work on the wrapper for the Light vs Dark server. I created the wrapper for it. I've spent over 100 hours so far on the strips for the server, just for Starmade. I've spent thousands of hours stripping in different languages throughout the years. Not saying I'm some sort of savant at stripping or anything, but I've put in my time. And I'm not about to call myself a prostitute, because I'm not. I'm a stripper. (Not as good as a prostitute, but still a lot more useful than an AOL user - I got mail, yay!)

    But glad you like the idea! ;)
    Had I known that you are an experienced stripper... I would have never said all that stuff :p
    Sorry, I often like to play games with the text I read. Thought I would illustrate one. I apologize
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    Sorry, I often like to play games with the text I read. Thought I would illustrate one. I apologize
    haha
    [doublepost=1475327911,1475326854][/doublepost]
    Had I known that you are an experienced scripter... I would have never said all that stuff :p
    It's ok, I was just kind of confused why you were telling me that stuff. lol.
     

    DrTarDIS

    Eldrich Timelord
    Joined
    Jan 16, 2014
    Messages
    1,114
    Reaction score
    310
    Briefly:
    I love the new sensor blocks, and I can see myself making all sorts of cool creations from them. However, one simple modification would increase their usefulness quite a bit, I think. How about we allow them to sense when an "empty" state is achieved? For example, when a storage is empty, or shields are at 0%, or power, ect.

    Example:
    I'll use a sensor block connected to a storage as an example. Right now , players can press C on a sensor block and V to one or more activation blocks, then C on the sensor block and V to a storage. Place an activation block next to the sensor.. And then they can then turn on or off the activation blocks to set the "ratio" at which the sensor block will transmit an on signal. Cool. So if you put 4 activation blocks and turn one on and the rest off, then the sensor triggers at 25% or greater. But what if you want it to trigger when nothing is in the storage? Right now if you have 0 out of the 4 connected activation blocks on, then the sensor block ALWAYS transmits an on signal when pulsed by a clock. What is the use of this?

    The Solution:
    Why not instead have the sensor block behave a little differently, so that when 0 out of the 4 activation blocks are on, it will ONLY transmit an on signal when the storage is empty? This would allow an easy way to sense when an individual item is placed into the storage.
    couldn't you just add a not block and reverse your trigger conditon blocks?
     
    Joined
    Oct 22, 2014
    Messages
    338
    Reaction score
    148
    • Legacy Citizen 3
    So if a sensor set to read greater than 0(0 activation blocks active) had a NOT connected to the activation that reads the signal from the sensor not do what you're looking for? If set to read anything greater than 0, the NOT should be active when the storage is empty right?
     
    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    couldn't you just add a not block and reverse your trigger conditon blocks?
    A sensor with all activators off triggers at >=0, which means always. If you want to know whether a storage with space for 1 million blocks is empty, you need 1 activator on and 999 999 activators off, and then add a NOT gate.

    So if a sensor set to read greater than 0(0 activation blocks active) had a NOT connected to the activation that reads the signal from the sensor not do what you're looking for? If set to read anything greater than 0, the NOT should be active when the storage is empty right?
    But it's not greater than 0, it's greater or equal than 0.
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    couldn't you just add a not block and reverse your trigger conditon blocks?
    Nope. For this to work, the mechanic needs to be changed. Right now the sensor block checks for the condition, "Nothing or anything" when all the activation blocks are off, therefore it always triggers on. Malacodor stated it well, with his example of a storage that has 1 million capacity. He said it would take 1 million activator blocks to set the condition of 1 item. But even that isn't entirely accurate, because many items do not take 1 mass. They may take 0.15 capacity. Or 0.01 capacity (as with a motherboard). So for that 1 million capacity storage, it would actually take 100,000,000 activation blocks, with one on, to detect that one motherboard block was placed into that storage.

    But let's say a fix is implemented to now allow all the activation blocks being OFF to have the sensor trigger the ON state when anything is placed into the storage it is connected to. It would switch to the OFF state when nothing is in the storage. This would solve the first problem, but creates another, as I mentioned earlier:

    ....gravity blocks...can only accept a logic signal that is one deep. .... With both methods available, however, then the logic could be set up either way (so long as the devs allow a logic signal from a sensor to be used in this manner).
    This is why there is a need to have a way to have a TRUE signal when the storage has "anything," and also have a TRUE signal when there is "nothing." Otherwise gravity cannot be triggered, without the devs coding in a way to extending the player info down more than 1 logic routing, so that a not-block connected to the activation block could, in fact, allow the gravity to be changed for the player accessing that inventory. Though that would be a nice feature, it is a pandora's box of coding for the StarMade dev's to do.


    A sensor with all activators off triggers at >=0, which means always. If you want to know whether a storage with space for 1 million blocks is empty, you need 1 activator on and 999 999 activators off, and then add a NOT gate.


    But it's not greater than 0, it's greater or equal than 0.
    Thank you for the illustration. Just to note though, items are not usually 1 mass large. Some are 0.01 mass large ( like motherboards). So it wouldn't need to have 1,000,000 activators. It would need 100,000,000. lol
     
    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    This is why there is a need to have a way to have a TRUE signal when the storage has "anything," and also have a TRUE signal when there is "nothing." Otherwise gravity cannot be triggered, without the devs coding in a way to extending the player info down more than 1 logic routing, so that a not-block connected to the activation block could, in fact, allow the gravity to be changed for the player accessing that inventory. Though that would be a nice feature, it is a pandora's box of coding for the StarMade dev's to do.
    I think that wouldn't work anyway. It's the clock or whatever is used that triggers the sensor, not the player accessing the storage.

    Thank you for the illustration. Just to note though, items are not usually 1 mass large. Some are 0.01 mass large ( like motherboards). So it wouldn't need to have 1,000,000 activators. It would need 100,000,000. lol
    I know, I just wanted to keep it simple (and was lazy ;) ).
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I think that wouldn't work anyway. It's the clock or whatever is used that triggers the sensor, not the player accessing the storage.


    I know, I just wanted to keep it simple (and was lazy ;) ).
    With area triggers, the player name is basically "stored" into an area trigger, then immediately passed to the area trigger controller, which activates it, which turns on the activation block, which then transmits the player's name to the gravity block through the logic pipeline. Just because it happens right away doesn't mean it has to.

    Here's how I imagine it happening with the storage/sensor combo: The last player to change a storage's contents has their name stored into a variable associated with the storage. When a sensor block is triggered, it grabs the player name associated with the change, activates the activation block next to it, and then transmits the name to the gravity block. And voila, gravity is changed and the behavior is congruent with how it works with area triggers. --- Though I imagine the game would have to also be smart enough to know if the player changed sectors or if longer than 5 seconds has gone by (or similar) it won't use the name associated with the storage. It would also want to clear this variable if it acts on it with the gravity block, so gravity would not keep switching on or off for that player.
     
    Last edited:
    Joined
    Aug 23, 2016
    Messages
    758
    Reaction score
    129
    A sensor with all activators off triggers at >=0, which means always. If you want to know whether a storage with space for 1 million blocks is empty, you need 1 activator on and 999 999 activators off, and then add a NOT gate.
    I'm ignorant on the finer details of storage, so this is just a question for me to learn something, but isn't the same storage block in a group always filled first? Couldn't you just test it for emptyness?
     
    Joined
    Mar 2, 2014
    Messages
    1,293
    Reaction score
    230
    • Thinking Positive
    • Community Content - Bronze 1
    • Legacy Citizen 3
    I'm ignorant on the finer details of storage, so this is just a question for me to learn something, but isn't the same storage block in a group always filled first? Couldn't you just test it for emptyness?
    A single storage block without any additional cargo space has room for 10 000 motherboard blocks, so you still need 10 000 activators to reliably test for emptiness.
     

    Benevolent27

    Join the Dark Side
    Joined
    Aug 21, 2015
    Messages
    585
    Reaction score
    327
    • Purchased!
    I'm ignorant on the finer details of storage, so this is just a question for me to learn something, but isn't the same storage block in a group always filled first? Couldn't you just test it for emptyness?
    What Malacodor said below.

    Here's the current workarounds a player might use:

    Detecting when an item is placed INTO a storage: Use an or block connected to the storage, then have another storage pull all items out and then switch off using a "latch" type system that locks it into an off position. Then you have to first storage pull all items out of the second storage. The OR-block now turns on. However, if the items are taken out, there is no way for this system to know that, so that latch cannot be reset. Another problem with this is that it relies on storage pulls, so at least 2 full storage pulls must take place before the logic can be set off.

    Detecting when an item is removed from a storage: Use two storages which each take turns pulling from each other. Have it pulse a logic system that has a timer on it each time that item changes between inventories. If the item is removed, the logic system does not receive the pulse and so the timer runs out, and an activation block somewhere turns on. The bad part about this is that it is very slow and the item that is in that inventory will need to move back and forth, so if a player accesses the storage, they will only see it half of the time.

    So, what I'm suggesting is a simple way to have the new sensor block detect whenever anything is IN the storage and also when there is nothing. It's totally doable, very simple, and would be very useful for anyone who ever wanted to create complicated logic for their storage systems.