Modding Discussion Complete object name list and (almost) every object brush for Starstructor

Discussion in 'Starbound Modding' started by Punisherbr, Dec 25, 2013.

  1. Punisherbr

    Punisherbr Orbital Explorer

    I decided to stop modding for a bit and actually use my programming and Windows OS knowledge to help the community somehow.
    So I used some windows tricks to get an (almost) full list of objects names and I'm sharing with you guys.

    Object names list: http://pastebin.com/SBq045gx


    Also, I coded a small C++ algorythm to automatically write a JSON raw code for .structure brushes for Startructor.

    Brushes lists: http://pastebin.com/gW90Bj2m (make sure that none of them conflicts their unique RGB with brushes in the file you are going to add)


    Keep in mind:This code is far from perfection. I scratched and compiled it in around 10 minutes and can be improved in many ways, but it served its purpose. So I don't need to ever use it again, however, if you guys want it, I'm sharing with you.
    Code:
    #include <iostream>
    #include <iostream>
    #include <string>
    #include <fstream>
    
    using namespace std;
    
    int main(){
      using namespace std;
      int g=0,b=0,i=0,a=0; // green, blue, counter for array and counter for array output
      string sArray[984]; //number of objects
      ifstream file("filename.txt"); //object names file path
      if(file.is_open()){
          for(int i = 1; i <= 984; i++){
            file >> sArray[i]; // read file "line" and allocate into array position
          }
      }        
      while(g<=4){ //green loop
          for(b=1;b<=255;b++){ // blue will run from 1 to 255, everytime it reaches 255, it will add 1 to green value and reset blue value. Looping until green loop is finished.
            cout << "{\n      $value$ : [0, "<< g <<", "<< b <<", 255],\n      $foregroundBlock$ : false,\n      $backgroundBlock$ : true,\n      $object$ : $"<< sArray[a] <<"$\n    }," << endl;
            a++;
            if(b==255){
                g++;
            }
          }
      }
      //this loop will make the algorythm crash at the end for obvious reasons. But it doesn't matter since we get all the output we need from it.
      return 0;
    }
    
    Also, I'm including a mini tutorial on how to paste the result into a .txt file without having to code anything else

    change this code to suit your needs
    compile it
    place its .exe on desktop (only for this tutorial)
    run cmd.exe and type:

    cd Desktop
    yourcodefilename.exe > anothername.txt
    quit

    PS: use any software like notepad++ to edit the .txt file and replace every " $ " to " " " (there's a function for this)
    And it's done. Now you have a piece of code of .structure file that you can add
    to any .structure files to open and edit in Starbound.

    if you want to continue this project, a cool place to start would be to make this code work for .dungeon files too :)
    it won't be that hard at all.
     
    ejh1990 likes this.
  2. urna

    urna Tentacle Wrangler

    The first reply thanks again
     
  3. metaspy

    metaspy Void-Bound Voyager

    It is nice to have this list all in one place.
    All of these names can be found in the asset folders, but as I said - Great to have them in one place!
    Now if only we can get placeobject to work
     
    Last edited: Dec 26, 2013
  4. kafuka

    kafuka Poptop Tamer

    Is there a mod that I can craft all the objects/furniture in Starbound? ( for building purpose )
     
  5. peter1596352

    peter1596352 Space Spelunker

    I can not do it, because this step is too complicated, could help me to complete this step, give me the download.
     
  6. Punisherbr

    Punisherbr Orbital Explorer

    By crafting you mean placing stuff around the map? If yes, try Starstructor.
    What part you didn't understand? There's no need to download anything at all, just copy and place it. If you can't do this, you probably want to wait until Starstructor get some updates or someone else create another mod with an intuitive interface.
     
  7. heinermann

    heinermann Scruffy Nerf-Herder

    I just want to point out a few things:
    1. You're going out of bounds of your sArray. Array indices start at 0. Your for loop is causing a problem there by starting at 1 and including 984. It may be responsible for your crash.
    2. Can object names have spaces? Your loop doesn't read the lines in the file, it reads the words (up to whitespace).
    3. You are already using namespace std, you don't need it again. Same with #include <iostream>
    4. Consider using vectors. Consider your code's readability, don't put everything all on one line if you can split it up.
    5. You can escape quotations in strings using \".

    Here is my implementation/understanding of it. I instead just read from cin and don't store all the object names.
    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    /** Simple class for storing an RGB triplet.
     */
    class Color
    {
    public:
      /** Expected constructor. Takes an integral value and splits it into r,g,b values.
       */
      Color(unsigned value) : r((value>>16)%256), g((value>>8)%256), b(value%256) {}
      /** Data members for holding the red, green, and blue values respectively.
       *  Public for quick access.
       */
      int r,g,b;
    };
    
    /** Entry point.
     */
    int main()
    {
      std::string object_name;
      for ( unsigned value = 1; cin >> object_name; ++value )
      {
        Color col(value); // turn the value into a colour
       
        cout << "{\n"
             << "      \"value\" : [" << col.r << ", " << col.g << ", " << col.b << ", 255],\n"
             << "      \"foregroundBlock\" : false,\n"
             << "      \"backgroundBlock\" : true,\n"
             << "      \"object\" : \"" << object_name <<"\"\n"
             << "}," << endl;
      }
    }
    Usage:
    Same as before except for.
    yourcodefilename.exe <filename.txt >anothername.txt
     
  8. urna

    urna Tentacle Wrangler

    Want to update it as soon as possible
     
  9. peter1596352

    peter1596352 Space Spelunker

  10. Punisherbr

    Punisherbr Orbital Explorer

    That's pretty well implemented. I could've sharpened the entire code, probably wouldn't be as good as yours, but I would have fixed many things you mentioned, including the array issue and the double namespace std/include iostream. As I said, this wasn't a fine piece of code at all, I just scratched it pretty fast and since it worked for what I needed, I just posted it right here and documented the issues.

    Thanks for contributing to the thread.
     

Share This Page