Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 9 10 [11] 12 13 ... 93

Author Topic: [0.96a] Console Commands v2023.05.05  (Read 1536731 times)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.6a] Console Commands v1.6b (released 2013-09-18)
« Reply #150 on: December 13, 2013, 01:56:21 PM »

I've noticed that spawning in modded ships won't work sometimes.

Does adding the ship as an empty hull work? If it doesn't could you tell me what ship, and from what mod?

If it does work with just the hull, make sure you're using the actual variant ID in the command. This ID is sometimes different from the filename (including for two variants in vanilla, last I checked). If it's not working for a specific ship, check the "variantId" tag inside the .variant file and see whether it's different.
Logged

SpaceRiceBowl

  • Commander
  • ***
  • Posts: 188
    • View Profile
Re: [0.6a] Console Commands v1.6b (released 2013-09-18)
« Reply #151 on: December 14, 2013, 07:07:02 AM »

I was using ship IDs from the ship.csv files
Seems to work for vanilla ships
Edit: Blackrocks, Neutrinos are the ones i'm having problems with. Haven't really tried spawning in other ships.
« Last Edit: December 14, 2013, 09:23:44 AM by SpaceRiceBowl »
Logged
I really don't know what I'm doing...

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: [0.6a] Console Commands v1.6b (released 2013-09-18)
« Reply #152 on: December 14, 2013, 09:21:43 AM »

that doesn't tell him anything tho. what mod? what ships?
Logged

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2846
  • Your Friendly Forum Friend
    • View Profile
Re: [0.6a] Console Commands v1.6b (released 2013-09-18)
« Reply #153 on: January 18, 2014, 04:08:04 PM »

OK, I keep getting a "Fatal: null" error when I try to start a new game with this mod on. I have the latest version
Log info:
Spoiler
52643 [Thread-5] WARN  com.fs.starfarer.loading.SpecStore  - Description with id flarelauncher_fighter_SHIP_SYSTEM not found
52643 [Thread-5] WARN  com.fs.starfarer.loading.SpecStore  - Description with id traveldrive_SHIP_SYSTEM not found
52643 [Thread-5] WARN  com.fs.starfarer.loading.SpecStore  - Description with id inferniuminjector_SHIP_SYSTEM not found
52643 [Thread-5] WARN  com.fs.starfarer.loading.SpecStore  - Description with id skimmer_drone_SHIP_SYSTEM not found
52645 [Thread-5] DEBUG com.fs.graphics.TextureLoader  - Loading [graphics/particlealpha32sq.png] as texture with id [fs.common/graphics/particlealpha32sq.png]
52650 [Thread-5] DEBUG com.fs.graphics.TextureLoader  - Loaded 247.21 MB of texture data so far
52650 [Thread-5] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/particlealpha32sq.png (using cast)
52908 [Thread-5] DEBUG com.fs.graphics.TextureLoader  - Loading [graphics/backgrounds/background4.jpg] as texture with id [graphics/backgrounds/background4.jpg]
222899 [Thread-5] ERROR com.fs.starfarer.combat.O0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.combat.CombatEngine.addFloatingText(Unknown Source)
   at data.scripts.console.Console.printMessage(Console.java:1066)
   at data.scripts.console.Console.showMessage(Console.java:910)
   at data.scripts.console.Console.showMessage(Console.java:920)
   at data.scripts.console.AddConsole.generate(AddConsole.java:24)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.OoOO.dialogDismissed(Unknown Source)
   at com.fs.starfarer.ui.K.dismiss(Unknown Source)
   at com.fs.starfarer.ui.impl.I.dismiss(Unknown Source)
   at com.fs.starfarer.campaign.save.OooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.O00oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.o00000(Unknown Source)
   at com.fs.starfarer.ui.F.processInput(Unknown Source)
   at com.fs.starfarer.ui.newsuper.super(Unknown Source)
   at com.fs.starfarer.B.ØÓÒ000(Unknown Source)
   at com.fs.oOOO.A.Ò00000(Unknown Source)
   at com.fs.starfarer.combat.O0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

[close]
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: [0.6a] Console Commands v1.6b (released 2013-09-18)
« Reply #154 on: January 18, 2014, 04:16:33 PM »

Just to chime in on this - it turns out I didn't quite fix that bug.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #155 on: January 18, 2014, 04:25:35 PM »

Console Commands hasn't really been updated since .54.1a. I'm actually surprised it continued to function this long! I'm in the middle of a complete rewrite of this mod*, so hopefully there will be a working version again soon. :)

*Which it desperately needs. Every time I look at the 1.6 codebase I die a little inside.


Just to chime in on this - it turns out I didn't quite fix that bug.

I wouldn't worry about it, it's probably my code's fault. The core of this mod hasn't changed much since .53a, and it's probably doing things in a ridiculously convoluted manner due to predating most of the current API. :)
« Last Edit: January 18, 2014, 04:32:28 PM by LazyWizard »
Logged

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2846
  • Your Friendly Forum Friend
    • View Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #156 on: January 18, 2014, 04:58:50 PM »

Are you gonna update here or start a new topic?
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

SpaceRiceBowl

  • Commander
  • ***
  • Posts: 188
    • View Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #157 on: January 19, 2014, 01:44:40 PM »

Most likely he's gonna update here, why would he want to start a new topic?
Logged
I really don't know what I'm doing...

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #158 on: January 19, 2014, 05:48:27 PM »

I'll continue using this thread for the rewrite.

I'm hoping to release a WIP of the new console soontm. This first release will be little more than a rough prototype and will be missing several features the old one had (in-combat commands being the most obvious), but I'd like to get it out there just so others have something to use.
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #159 on: January 20, 2014, 05:06:13 AM »

Thanks, LW. I'll be waiting with anticipation. This mod is a great tool to help out in the mod testing department. ;)
Logged
  

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #160 on: January 21, 2014, 09:14:32 PM »

If anyone desperately needs this mod in their life, I have an early, mostly working version of the rewrite here (requires LazyLib).

It's still pretty rough and several features haven't made it in yet. I've ported most of the old stuff to the new system but haven't thoroughly tested anything. I'd greatly appreciate it if anyone who plays around with this would let me know of any bugs they find. :)

The following commands have been implemented in the new version:
  • AddAptitudePoints
  • AddCommandPoints
  • AddCredits
  • AddCrew
  • AddFuel
  • AddItem
  • AddMarines
  • AddShip
  • AddSkillPoints
  • AddSupplies
  • AddWeapon
  • AddWing
  • AddXP
  • AdjustRelationship
  • Echo
  • GC
  • Help
  • Nuke
  • Reload
  • RunCode
  • SetRelationship
  • SpawnFleet

These commands from the old mod require other things to be implemented first and haven't been ported yet:
  • Alias
  • AllWeapons
  • God
  • GoTo
  • Home
  • InfiniteAmmo
  • InfiniteFlux
  • NoCooldown
  • Purge
  • Reveal
  • SetHome
  • Status
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #161 on: January 21, 2014, 09:18:05 PM »

Oh, almost forgot to mention. The console is now summoned with backspace instead of tilde by default. You can change this in data/console/console_settings.json. It also doesn't work in menus as the mod is no longer multi-threaded (that was more trouble than it was worth).

This mod doesn't require a new game, and it doesn't save anything either so you can safely disable it at will.
« Last Edit: January 21, 2014, 10:54:58 PM by LazyWizard »
Logged

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2846
  • Your Friendly Forum Friend
    • View Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #162 on: January 21, 2014, 11:04:50 PM »

*cracks fingers and pulls out my code testing sledge hammer*
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #163 on: January 22, 2014, 11:03:29 PM »

A second WIP of the rewrite is ready, get it here. Still requires LazyLib. ;)

Support for multiple commands is back! Just separate commands with a semicolon and it'll execute all of them. RunCode ignores separators for obvious reasons.

In addition, the following old commands have been added since the last WIP (a few have changed from their old versions, see notes):
  • AllWeapons - doesn't default to the player cargo if you misspell a station name
  • God - also protects armor now
  • GoTo
  • Home - can now teleport you between systems and your fleet is intangible for two seconds after using it
  • InfiniteAmmo
  • InfiniteFlux - also removes overloads
  • NoCooldown
  • Reveal
  • SetHome
  • Status

Alias and Purge are the only old commands that haven't been converted. Purge is no longer necessary since convoys will remove old cargo by themselves. I might leave Alias out too and just make a separate csv for aliases.

Again, please let me know if you spot any bugs. :)
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [OUTDATED] Console Commands v1.6b (released 2013-09-18)
« Reply #164 on: January 23, 2014, 07:12:17 PM »

I don't know if anyone will find this interesting, but I thought I'd post about the old mod and the reasons behind scrapping everything for a rewrite.

A few posts back I mentioned that the 1.x codebase made me die a little inside every time I looked at it. To elaborate on that statement:

Age
The biggest problem is simply that the console mod was old. This mod dates back to 2012 and was written for Starfarer 0.53a. Back then the API was only 15% the size it is now. I can't overstate just how many problems were caused due to ugly workarounds for missing features (the big ones being campaign-level scripts, keeping track of the combat engine and saving persistent data; though users of the old mod probably know these better as "why isn't the pop-up working?").

That even in this state the mod continued to function with minimal changes until now is a testament to the amazing work Alex put into making the API forwards compatible. That said, using the modern Starsector API methods allows the rewrite to do everything the old one did with a fraction the effort and a much lower chance of errors. :)

Bloat
The old version had become insanely bloated, largely due to the necessary workarounds described above.

To throw some numbers at you: the old console's main class was 1,300 lines of code (including 40 lines spent defining variables) and was a confusing mix of static and local code. It also had several commands hard-coded into it. That's pretty reprehensible for a class whose only duties are to check for input, parse and validate entered text, and create and pass arguments into the proper command object.

The new version? Completely static, with 270 lines for the console itself and 150 for the class that handles command loading/storage/lookup. It does virtually everything the old version did in a third the code and with almost none of the complexity! The only command that has any special code dedicated to it is RunCode, and that's just a single line to prevent it from being parsed into multiple commands since the default command separator is a semicolon.

If you're curious as to how bad it was, you can find the source for the old console here. Compare to the new version.

Poor design decisions
There were a lot of these (having the default console key not easily accessible on several international keyboard layouts was a big one), but for the worst example, here's what you had to go through to implement a custom command in 1.6b:
  • Make a script that extends the abstract BaseCommand class. This class contained 20 methods (of which you'd actually care about 3-7 depending on what kind of command you're making) and had default implementations for most of them, so you'd be forced to check BaseCommand's source to see what methods you needed to override. The irony? These extra methods were intended to make writing commands easier, but instead ended up making it a chore for anyone who wasn't already familiar with the codebase.
  • Place your script in the data/scripts/console/commands directory. That's the only folder it will accept commands in, for no good reason. Putting it inside data/scripts also means these scripts are loaded by Starsector's built-in compiler, so you can't bundle commands with your mod without creating a dependency on the Console mod. The rewrite suggests putting them somewhere else where they will only be loaded when the Console mod is active.
  • Have another script (somewhere, somehow) call Console.registerCommand(<your script's class>). This would throw an Exception if your command was in the wrong package, overwrote a core command, made a mistake extending BaseCommand, or if the code decided it just didn't like you; so you'd also have to write exception handling code. This limited custom commands to those modders who were already proficient in Java (pretty rare at the time).

In the new console, here's the process for adding a custom command:
  • Make a script that implements the BaseCommand interface. This interface contains one method - runCommand(). Where this script is placed and how you implement it is completely up to you.
  • Describe and point to your command in data/console/commands.csv
  • Step 3? What step 3? You're done!

Here's an example of a command implementation in the rewrite:
Spoiler
Here's the code for AddSkillPoints:
Code: java
package org.lazywizard.console.commands;

import com.fs.starfarer.api.Global;
import org.lazywizard.console.BaseCommand;
import org.lazywizard.console.Console;
import org.lazywizard.console.CommonStrings;

public class AddSkillPoints implements BaseCommand
{
    @Override
    public CommandResult runCommand(String args, CommandContext context)
    {
        if (context == CommandContext.COMBAT_MISSION)
        {
            Console.showMessage(CommonStrings.ERROR_CAMPAIGN_ONLY);
            return CommandResult.WRONG_CONTEXT;
        }

        int amount;

        try
        {
            amount = Integer.parseInt(args);
        }
        catch (NumberFormatException ex)
        {
            Console.showMessage("Error: Skill points must be a whole number!");
            return CommandResult.BAD_SYNTAX;
        }

        Global.getSector().getPlayerFleet().getCommanderStats().addSkillPoints(amount);
        Console.showMessage("Added " + amount + " skill points to your character.");
        return CommandResult.SUCCESS;
    }
}
And here's the CSV data for it:
Quote
command,class,syntax,help
AddSkillPoints,org.lazywizard.console.commands.AddSkillPoints,addskillpoints <amount>,"Adds the specified amount of skill points to your character."
[close]


tl;dr: The old mod was a mess. It's going to be much better now. :)

You can grab the latest WIP here if you want to try the rewrite out yourself (this is the same one I posted yesterday). It's pretty much done at this point except for a few new commands I have planned and some bugtesting/polish.
« Last Edit: January 23, 2014, 08:47:17 PM by LazyWizard »
Logged
Pages: 1 ... 9 10 [11] 12 13 ... 93