Modding Help Help me make a simple mod With commandProcessorScripts:conf

Discussion in 'Starbound Modding' started by DrakenGDL, Jul 4, 2015.

  1. DrakenGDL

    DrakenGDL Space Hobo

    Hi guys, I'm new here and I'm lost. I keep reading the forum that after several hours I could not make a mod. I'm trying to make a custom command with a .lua file and commandProcessorScripts config (universe_server.config)

    [​IMG]


    My custom command It should only be used from the console or with admin in game. and pass the arguments, either the user's UUID, coordinate or some method to deliver items to a player. (filename.lua)

    Code:
    function myNewCommand(arguments)
        -- do magic here
    end
    

    Anyone know how I can do this, at least guide me to create a custom command. No matter if you only print text console, what I need is help with part of creating my new custom command.

    Really thank you very much, regards.
     
    Last edited: Jul 4, 2015
  2. kyleetehkitty

    kyleetehkitty Title Not Found

    Best Answer
    What I did to test was:

    Made a universe_server.config.patch file with the following contents:

    Code:
    [
      {
      "op": "add",
      "path": "/commandProcessorScripts/-",
      "value": "/commandtest.lua"
      }
    ]
    
    and then the commandtest.lua file contained just the example from the forums:
    Code:
    function ownclientid(clientId, arguments)
      return clientId
    end
    
    I reloaded my running starbound client and put myself into admin mode /admin and fired off /ownclientid and got a return of 1

    Heres a link to the test mod zipped

    http://1drv.ms/1HDDMdS
     
    Last edited: Jul 4, 2015
    kikitehkitty, Dunto and DrakenGDL like this.
  3. kyleetehkitty

    kyleetehkitty Title Not Found

    Kayuko likes this.
  4. DrakenGDL

    DrakenGDL Space Hobo

  5. kyleetehkitty

    kyleetehkitty Title Not Found

    Best Answer
    What I did to test was:

    Made a universe_server.config.patch file with the following contents:

    Code:
    [
      {
      "op": "add",
      "path": "/commandProcessorScripts/-",
      "value": "/commandtest.lua"
      }
    ]
    
    and then the commandtest.lua file contained just the example from the forums:
    Code:
    function ownclientid(clientId, arguments)
      return clientId
    end
    
    I reloaded my running starbound client and put myself into admin mode /admin and fired off /ownclientid and got a return of 1

    Heres a link to the test mod zipped

    http://1drv.ms/1HDDMdS
     
    Last edited: Jul 4, 2015
    kikitehkitty, Dunto and DrakenGDL like this.
  6. DrakenGDL

    DrakenGDL Space Hobo

    Thanks @kyleetehkitty
    I'll try now =) I see that is different to what I was doing.

    Edit:
    It worked, thank you very much for the help, I spent all night trying :(
    +10
     
    Last edited: Jul 4, 2015
    kyleetehkitty likes this.
  7. DrakenGDL

    DrakenGDL Space Hobo

    I can use objects that are out of commandProcessor?

    Code:
    function location(clientId, arguments)
       local myPos = tech.position()
       return ("X:" .. myPos[0] .. "Y:" .. myPos[1])
    end
    [​IMG]

    Exampla call: world.spawnItem(), Storage functions

    Thanks
     
  8. Kayuko

    Kayuko Oxygen Tank

    I'm really not sure how scripts work, but world.entityPosition() or even mcontroller.position() should suffice.
    There's not really a need to use the tech table, and it probably won't work because it's not a tech.

    I think your best bet is reading the charId of the clientId (or might they even be the same?) and call world.entityPosition()

    And you probably can use scriptedEntities via the callScriptedEntities thing, but as mentioned before, I never ever even thought about meddling with commands yet.

    Oh, another thing, the return of myPos would look like this anyways:

    {x, y}

    Which means you should probably change your coordinates to myPos[1] and myPos[2], also, I'm not sure this return type does what you want to do.

    I'd rather use universe.adminWhisper() function or something similar, I guess.
     
    Last edited: Jul 6, 2015
  9. DrakenGDL

    DrakenGDL Space Hobo

    I understand what you say, but will not let me call world.entityPosition (). The same problem with mcontroller.position ().
    I do something extra before trying to get the position?

    [​IMG]

    Same error with world callbacks, tech, etc... sure I'm missing something
     
  10. Kayuko

    Kayuko Oxygen Tank

    Okay, digging a bit deeper, I figured how this whole things works.
    It's not as usefull as you might think (altho it IS indeed very usefull).

    You have access to two kinds of things while writing commands.

    The commandProcessor class and the UniverseServer Lua-namespace.

    I'll probably run a few tests later and get back to more info on that, but no promises there yet.
    But yeah, everything outside those two is more or less rendered useless (unless makeCommandCallback() does a different thing from what I'd expect it to do).
     
    kyleetehkitty likes this.
  11. lornlynx

    lornlynx Cosmic Narwhal

    Anyone tried this with the 1.0 version?
    It says my function doesn't exist, but all I can say is that it isn't the patch file.
    Also tried it with the same function as the example.
     
  12. kyleetehkitty

    kyleetehkitty Title Not Found

    Not sure if it is in 1.0 or not, I am still playing modding info catchup from a year of doing other things xD If I come across anything I will be sure to share it.
     
  13. RebelArms

    RebelArms Void-Bound Voyager

    Did steps described above but no luck, game says such a command does not exit
     
  14. kyleetehkitty

    kyleetehkitty Title Not Found

    The command processing stuff looks to have changed since the above example was created. Waiting for Docs to shed some more light at this point.
     

Share This Page