Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Blog post: Raiding for Fun and Profit (11/27/19)

Pages: 1 ... 50 51 [52]

Author Topic: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)  (Read 491281 times)

Jaime Wolf

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)
« Reply #765 on: January 18, 2020, 12:50:31 AM »

Anyway there to ban me from this mod lol i cannot help but cheat once i found this and its bugging me. lol
Logged

Plasmatic

  • Captain
  • ****
  • Posts: 480
  • Curious no?
    • View Profile
    • Email
Re: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)
« Reply #766 on: January 18, 2020, 05:21:18 AM »

Anyway there to ban me from this mod lol i cannot help but cheat once i found this and its bugging me. lol
uninstall it? :)
Logged
"Better to remain silent and be thought a fool than to speak out and remove all doubt"
- Maurice Switzer

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1286
    • View Profile
    • Bitbucket Profile
Re: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)
« Reply #767 on: January 18, 2020, 12:51:37 PM »

Any way to change the shortcut to open the console window?

I dont have an English keyboard and I am unable to open the console with any combination of "CTRL+BACKSLASH".

I see someone already told you that it's actually control+backspace, but you can change the keystroke that summons the console with the Settings command.

If for some reason your keyboard doesn't have control or backspace, you can also change it manually by editing the "consoleKeystroke" field in saves/common/config/lw_console_settings.json.data. Set all the "true"s to "false" (these control if you need to hold shift, control, or alt), and the first number to the keycode of the key you want. Keycodes can be found here. If you wanted to summon the console by pressing 9, you'd look for VK_9, which has the keycode 57. So your "consoleKEystroke" would look like "consoleKeystroke": "57|false|false|false".

Yeah, using the settings command is much easier. :)


okay so for some reason what causes console command to crash... out of ALL THE THINGS IN EXISTANCE, is these two settings:

"decivSamplingMonths":16,
"decivMinStreak":3,

For some mystical reason, if you set these settings to bigger values (to prevent random deciv events) the game just refuses to open the console without crashing. I don't see how this is related but holy *** it took a lot of digging around to figure it out. Thing is for some reason changing those values after a save was created might or might not break console commands as well. I even tested it out and for some random reason sometimes it breaks it and other times its fine...

So there you go, I have no idea how this makes sense but hey, I didn't make the mod :3 

I think I also changed those values since I believe vanilla ones were smaller so I guess it has to do with back ground simulation freaking out.

That's incredibly weird. If anything I'd expect it to crash when the console closes, not when it first opens, since the game would be playing catch-up on however many thousands of frames it skipped. I'll look into it.


First off, I love the mod.

Though I'm having some issues, nothing crashing or anything, but i can't seem to get two commands to work..

Namingly \Clear\, and \Clear ships\

If I try storage\clear ships\ it says no such command
Storage\clear\ says the same thing

typeing in just clear simply clears the console, not my storage.

In reference to my earlier question, am I correct in assuming these clear commands are supposed to empty the storage? if so, how do I use them?

You want "storage clear" and "storage clear ships". I'll update Storage's help entry to be more clear (no pun intended).


Anyway there to ban me from this mod lol i cannot help but cheat once i found this and its bugging me. lol

A command to block access to the console on specific saves has been on my todo list for a while. I've just been lacking the motivation to mod for the last several months.


Ok. Current working code for adding planets is.
Code
 RunCode Global.getSector().getStarSystem("System_Name").addPlanet("Added_Planet_Name", Global.getSector().getStarSystem("System_Name").getStar(), "Added_Planet_Name", "Planet_type", Planet_Angle, Planet_Size, Planet_orbit_radius, Planet_Orbit_length) 
Code works great for spawning new planets in a star system. However, do you know how to spawn moons that orbit around a planet?

how to u get it to work? i get an unknown variable error for planet angle

@Coffeeboi: You'd have to do it manually. If you're docked with the planet you want to create a moon for, you can use $context.getEntityInteractedWith() as the anchor for an OrbitAPI you create, then spawn the moon with that orbit (which I _believe_ will handle the positioning of the planet for you).

@nuker22110: You need to replace the placeholder arguments. So Planet_Angle might be 140, Planet_Orbit_length might be 70, etc. You can find examples of addPlanet usage in starsector-core/data/scripts/world/corvus.Corvus.java. Runcode takes Java code as an argument, so checking the files in data/scripts is a good way to get ideas for how to use it.

Oh, and a general statement about runcode snippets: I'd recommend being _extremely_ careful with RunCode if you aren't a modder yourself. RunCode isn't a normal command. You're writing, compiling and running Java code at the same level as an actual mod, without any of the safeties the other console commands have to prevent you from breaking things. The benefit is that you can do almost anything a mod can do with this command, but the downside is you can ruin your savefile if you get something wrong, and mistakes might not be immediately apparent.
« Last Edit: January 18, 2020, 12:53:45 PM by LazyWizard »
Logged

Malleator

  • Ensign
  • *
  • Posts: 8
    • View Profile
    • Email
Re: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)
« Reply #768 on: Today at 08:49:10 AM »

Tried to use the code to add a stable point but I got the error in the screenshot.

This is what I use for stable locations.
Code
runcode SectorEntityToken fleet = Global.getSector().getPlayerFleet();  
      StarSystemAPI sys = (StarSystemAPI)fleet.getContainingLocation();
      SectorEntityToken stable = fleet.getContainingLocation().addCustomEntity(null, null, "stable_location", "neutral");
      float orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(fleet, sys.getCenter());
      float orbitDays = orbitRadius / (20f + new Random().nextFloat() * 5f);
      float angle = com.fs.starfarer.api.util.Misc.getAngleInDegrees(sys.getCenter().getLocation(), fleet.getLocation());
      stable.setCircularOrbit(sys.getCenter(), angle, orbitRadius, orbitDays);


Can anyone please help me understand how to fill out this command to create planets?
Code
RunCode Global.getSector().getStarSystem("System_Name").addPlanet("Added_Planet_Name", Global.getSector().getStarSystem("System_Name").getStar(), "Added_Planet_Name", "Planet_type", Planet_Angle, Planet_Size, Planet_orbit_radius, Planet_Orbit_length) 
From what I understand, I replace the "System_Name" variable with the system I want to spawn the planet in.
"Added_Planet_Name" is changed to whatever I want to name the planet. Correct me if wrong.
But I don't understand how to fill out: "Planet_type", Planet_Angle, Planet_Size, Planet_orbit_radius, Planet_Orbit_length

Can someone please provide a working example of the create planet command? Thanks.
Logged
Pages: 1 ... 50 51 [52]