Space Engineers

Space Engineers

Solar Panel Alignment Script [BROKEN]
358 Comments
mezzodrinker  [author] Oct 9, 2017 @ 11:34am 
@Nicoleise Now that I am once again on my Windows installation, first of all, thanks for your effort of finding a way to run my script! It would be even greater if you could open an issue [github.com] with your improvements or create a pull request [github.com] on the GitHub site. That way, I'd have the code at hand and update the script accordingly :)

However, please do note that I am not trying to force you into doing that. Also, if you do decide to contribute to the code, please be aware that all code you contribute will be published under the project's license, which is currently a BSD 3-clause [github.com].
Nicoleise Sep 25, 2017 @ 5:39am 
There's a pretty agressive character limit on comments, so I'll elaborate in a second comment, that the portion of the script that we can comment out has the following purpose (in my understanding):

If you enter an incorrect component name, usually compilers will give you real useful stuff like "An instance is not set" or "Something went wrong". To increase user friendliness, the author of this script has made sure his script searches through the available groups. If the correct is found, all is well. If not, it outputs a more useful message like "The script cannot find your group name."

Points for useablity, but when the game then goes and breaks it, I feel the better option for the time being, is to simply comment out those lines of code, so that the script actually works - because it does a good job, once it's allowed to. :)
Nicoleise Sep 25, 2017 @ 5:36am 
We downloaded this yesterday and implemented it on our planet base. Here's the fix:

The problem is with the way the script searches for groups of components. But we don't actually need that functionality. So set the property that the solar panels is a group to false, and point to the rotors individually rather than as a group name (like "Rotor 1","Rotor 2").

Then click Check Script and it'll give you four lines with errors. In those lines, the script searches for groups with the name you entered, to give you useful information about why the script fails. Simply comment out these two entire blocks of code (every line) including the full {} containers they are in, and presto - script runs and works.

The only functional loss of not using a group for solar panels, is that the power output will be listed for one panel. To mend this, just multiply your variable by the number of panels.
mezzodrinker  [author] May 31, 2017 @ 9:51am 
@YrriNoTherapy It's a combination of Keen's updates and my perfectionism. They work hand in hand to bring me maximum enjoyment while writing scripts.
The_Yrri May 28, 2017 @ 9:53am 
@mezzodrinker - is that something with new Keen updates that keep breaking it apart? No rush or attempts to push here, just a dedicated fan wants to know the future of the project.
mezzodrinker  [author] May 20, 2017 @ 3:47am 
Time to plunge myself into despair. I'm reworking the whole script... again. *sighs*
mezzodrinker  [author] May 9, 2017 @ 7:21am 
@YrriNoTherapy I am planning to pick it up again once I get the time to read into Space Engineer's nice programming API again. I'm lovin' it.
The_Yrri May 7, 2017 @ 6:03pm 
I wonder will this be updated or should it be considered abandoned. Love this one somehow.
Nikolas March Mar 26, 2017 @ 3:13am 
might work with the older compatibility version
Cronos.exe Dec 1, 2016 @ 12:41pm 
This script currently broken
Ja dAttaque Nov 27, 2016 @ 3:49am 
Program (279,38) Error "|MyGroupBlock" does not contain a definition for Blocks... and more.
gromoche Nov 24, 2016 @ 11:06am 
I m trying to fix it. I found this :
https://steamcommunity.com/sharedfiles/filedetails/?id=709010443
I think i m on a good way.
keep you posted
mezzodrinker  [author] Nov 24, 2016 @ 11:03am 
I have lots of stuff to do at the moment (including, but not limited to completely rebuilding a website, migrating data from another website and a full-time apprenticeship), so an update for this script may have to wait until January 2017. I do hope you can understand and will stay patient.

If you're a programmer and would like to contribute, feel free to visit the repository on GitHub and dig into the code.
gromoche Nov 24, 2016 @ 10:26am 
Hi,
Same issue :
Error : 'IMyBlockGroup' does not contain a definition for 'Blocks' and no extension methode 'Bolcks' accepting a first argument of type 'IMyBlockGroup' could be found
jouster500 Nov 10, 2016 @ 5:29pm 
@zeriambh Check to see if the scope, ie, where the variable is being defined, is accesible to the function thats calling for it
zeriambh Nov 10, 2016 @ 2:19pm 
When I am following the directions on GitHub and get to the check code part I get a compile error that is saying the MyBlocks values aren't defined
Queue Oct 29, 2016 @ 4:40am 
umm it doesnt work. like. at all
mezzodrinker  [author] Sep 29, 2016 @ 10:30am 
@jouster500 No, all Space Engineers scripts and mods are written in C#.
jouster500 Sep 29, 2016 @ 10:24am 
Its written in java right?
mezzodrinker  [author] Sep 29, 2016 @ 10:18am 
@BadHumour There have been efforts made by other people to update the script (see for example https://github.com/mezzodrinker/spas/pull/22 ) and make it compatible with Keen's recent updates. I honestly haven't been working on it at all recently. That is mostly because of Keen's tendency to slap me right into the face with their updates and my internship. We'll see where this is going. I'm planning to update the script eventually, though.
Bad Humour Sep 28, 2016 @ 6:55am 
Does this script still work with the updated ingame scripting?
OmegaConstruct Aug 23, 2016 @ 12:11pm 
It seemed like other people were complaining about the script not working properly, not aligning perfectly, not the fact that it wasn't compiling. The last time that compilation errors were mentioned was a month ago and you said it was something to with the dev/stable split, so I thought this might be a new issue and wanted to make you aware. Sorry for wasting your time. Good luck with your internship.
mezzodrinker  [author] Aug 23, 2016 @ 10:52am 
@OmegaConstruct Yes. It's been broken by a recent update. Which was said at least three times now. You don't even have to read through one page of comments to find that out. The more you bug me about it, the less time I have to work on the script. My time is already short because I am doing a full-time internship for the time being.
OmegaConstruct Aug 22, 2016 @ 11:01pm 
Was this script by any chance borked by a recent update? Perhaps I am setting it up wrong, but I keep getting this message: http://steamcommunity.com/sharedfiles/filedetails/?id=750094430
Vas Aug 16, 2016 @ 12:02pm 
Maybe you should make a script that makes Rotors function without exploding into randomness. :P Keen can't program Rotors that don't do this. Take a look at the reddit I posted. Even my pistons are fucking up.
mezzodrinker  [author] Aug 16, 2016 @ 11:13am 
@Vas Thanks Keen for fucking up stuff that my script uses twice!
Vas Aug 15, 2016 @ 6:13pm 
Well as I found out, I can't use rotors so this script won't help. :/
https://www.reddit.com/r/spaceengineers/comments/4xwtfl/rotors_are_entirely_unusable/
mezzodrinker  [author] Aug 15, 2016 @ 2:16pm 
@Vas Up until now, that has always been possible: How to: Using the script with solar panel mods [github.com]
Vas Aug 15, 2016 @ 7:12am 
Ah. Alright. Will you be able to make it not use "max output from default game" though? As some mods, such as my own, change solar panels to have a different output of energy. Some lower, some higher. I have tons of solar panels that produce lower and higher amounts. Even "solar paint" which is a flat block against the side of a ship.
mezzodrinker  [author] Aug 15, 2016 @ 2:38am 
No, you don't need 2 programmable blocks and timers each, one should suffice. The problem is that the sun detection logic is (apparently) flawed. I'm working on it.
Vas Aug 14, 2016 @ 10:47am 
I'm assuming you need 2 programmable block and 2 timers minimum because all this does is make the rotor spin forever. I had the second rotor also named correctly but it didn't detect the second one. I ended up manually doing that one and it did the same thing again, so I must classify this as nonfunctional. :/
ShieldKnight857 Aug 11, 2016 @ 5:01pm 
Thanks for doing that. It is so cool but it's kind of a bummer it's not working right now.
mezzodrinker  [author] Aug 11, 2016 @ 3:04pm 
@OMoo And here I was thinking it would actually work for someone. I'm already working on rewriting the script.
ShieldKnight857 Aug 11, 2016 @ 12:23pm 
It doesn't work very well. It seems to not know exactly where the sun is.
mezzodrinker  [author] Aug 11, 2016 @ 10:34am 
@TheWarMaster97 Yeah, I already know about that. It's certainly not caused by your changes.
mezzodrinker  [author] Aug 11, 2016 @ 10:33am 
@OMoo It works for you?
TheWarMaster97 Aug 10, 2016 @ 12:09pm 
@mezzodrinker I changed only the necessary lines to solve the issue, i tested it now and it seems also to have some issue functionality wise, but i think this is not related to my changes, specifically sometimes it aligns properly and some times it turns away from the sun.
ShieldKnight857 Aug 10, 2016 @ 12:06pm 
Awesome! Perfect for when the sun is constantly moving. Especially on planets. Very cool script, thanks a lot! :)
mezzodrinker  [author] Aug 10, 2016 @ 10:14am 
@TheWarMaster97 If it compiles, that should be good. If you didn't change anything functionality-wise, that is.
TheWarMaster97 Aug 10, 2016 @ 2:24am 
@mezzodrinker I solved the issue with your code mentioned by ZeroZeven, i havn't tested it because i have no time, but at least the code compiles. I uploaded the code to pastebin: http://pastebin.com/y3VpjkFj Sorry if my english isn't clear.
mezzodrinker  [author] Jul 25, 2016 @ 12:18am 
@ZeroZeven I'm aware of that. It's because Keen made the awesome decision to split SpaceEngineers into two different branches with different APIs for the programmable blocks. Once I figure out the problem that has been pointed to below, I will probably split this script in two as well because apparently, I do not yet waste enough time on this.
Zero Zeven Jul 24, 2016 @ 4:04pm 
So yeah, i read the previous comments, but i just wanted to confirm that this script is completely 100% broken for me. It doesnt compile, and says something about blockgroup errors on lines 279+
mezzodrinker  [author] Jul 9, 2016 @ 3:01pm 
@Kirkkid I know. I don't know what's wrong. I'm working on it. Thanks for reading the previous few comments.
Kirkkid Jul 9, 2016 @ 1:25pm 
I have this script running on my single player survival world. Everything seems to be working properly, but my solar panels are more likely to turn away from the sun vs towards it. Then they start panicking, turning even further away from the sun (X axis 90 degrees off, Y axis panels pointed towards the ground) and then it hibernates until I manually get them lined up again. Rinse repeat. Can't leave it alone for more than 10-15 minutes. Any advice? I am playing with 45 minute day cycle...could that be the problem?
jouster500 Jul 4, 2016 @ 10:40am 
By default when you build a solar panel, it is given a number to indicate the number of panels built to the ship or station. Knowing this, you can have the script look for increments of this value
mezzodrinker  [author] Jul 4, 2016 @ 9:37am 
@jouster500 I don't understand what you mean by "solar panels of numbered value instead of user defined", sorry.
jouster500 Jul 3, 2016 @ 6:06pm 
So right now im reading through your entire code to get an understanding of how it works (i am aiming to make improvements/add ons to it) and understanding the SE coding style.

For starters i wanted to know if its possible to change naming scheme around so by default it looks for solar panels of numbered value instead of user defined. Just to speed up time and not have people dig through your code to configure it correctly.
Darian Stephens Jun 25, 2016 @ 2:43pm 
I have noticed it, and that's why the script had been sitting on a programmable block, turned off for months.
I've decided to say goodbye to this script for the time being, since the 'Stop Rotor on High Solar Power Output' one can at least avoid doing the exact opposite of what it's meant to.
mezzodrinker  [author] Jun 25, 2016 @ 11:58am 
@DarianStephens Yeah, I noticed and am working on it. No idea why that is, though. If you had read the comments, you'd have noticed that yourself.
Darian Stephens Jun 25, 2016 @ 8:27am 
This thing now sucks at finding the right angle to produce maximun power, instead opting for the option that produces the smallest amount of power possible.
I almost think that, for single-rotor setups, rotating the result by 90 degrees would be best.