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 ... 20 21 [22] 23 24 ... 93

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

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2846
  • Your Friendly Forum Friend
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #315 on: December 04, 2015, 04:22:40 PM »

Your spawnfleet got a little bug , it seems EVERY ship now has an officer  ;D
Ah, the danger of thinking a minor last-minute change isn't worth testing. :)
I don't want to update now as I kinda liked this idea
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Auraknight

  • Commander
  • ***
  • Posts: 125
  • I am a Knight of Aura.
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #316 on: December 04, 2015, 06:22:50 PM »

Your spawnfleet got a little bug , it seems EVERY ship now has an officer  ;D
Ah, the danger of thinking a minor last-minute change isn't worth testing. :)
I don't want to update now as I kinda liked this idea
it IS the sort of thing that would make for a very neat option. maybe an argument (if that's the right word?) that lets you tell the spawner how many captains to spawn in the fleet, and otherwise defaults to how it is now?
Logged
~Aura be with you

Chronosfear

  • Commander
  • ***
  • Posts: 211
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #317 on: December 05, 2015, 02:42:04 AM »

Your spawnfleet got a little bug , it seems EVERY ship now has an officer  ;D
Ah, the danger of thinking a minor last-minute change isn't worth testing. :)
I don't want to update now as I kinda liked this idea
it IS the sort of thing that would make for a very neat option. maybe an argument (if that's the right word?) that lets you tell the spawner how many captains to spawn in the fleet, and otherwise defaults to how it is now?
I would like that.
Logged
Be the change that you wish to see in the world.

My words are backed with nuclear weapons
Gandhi (Civ)

Zelnik

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #318 on: December 11, 2015, 11:34:19 AM »

Looks like your mod crashes the latest version of the game.


Error looks like this

Fatal:Error compiling [org.lazywizard.console.ConsoleCombatListener]
cause:org.lazywizard.console.consolecombatlistener


Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #319 on: December 11, 2015, 02:21:20 PM »

Could you post the end of starsector.log after a crash? This file is in starsector-core in the game's installation folder.

There's only been one change to ConsoleCombatListener within the last several months, and that was to make console output show up at the top of the screen instead of as floating text. You're sure you're running the latest version of Starsector (the change relies on API additions in 0.7a), and have LazyLib installed as well?
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #320 on: December 11, 2015, 03:33:16 PM »

I can't get my command to work...

I added inside my mod folder a data/commands

inside that folder I put a .java file with my script, and a .csv file, as per tutorial instructions on first page...

Nothing happened, good, or bad.

What I did wrong?
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #321 on: December 11, 2015, 03:39:31 PM »

It's most likely a misnamed/malformed data/console/commands.csv, though it's also possible there was an error loading the command (unlikely unless you're not using an IDE).

Try using the command "reload". It will show any exceptions that occur while loading in the console. If no errors show up then the csv is the culprit.


Edit:
I added inside my mod folder a data/commands

It's actually supposed to be in data/console. That might be your problem. ;)
« Last Edit: December 11, 2015, 03:41:13 PM by LazyWizard »
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #322 on: December 11, 2015, 03:50:24 PM »

Oh, it is data/console/commands

I made a typo in the post :P

Still how it is:

my mod has on its root folder data/console/commands

on data/console/commands.csv there is this:

CSEShowAllStocks,data.console.commands.ShowAllStocks,"CSEMod,campaign",ShowAllStocks (no arguments),"This just show the stock and average price of all commodities."

and on data/console/commands/ folder there is ShowAllStocks.java file


Typing "reload" give no error messages.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #323 on: December 11, 2015, 04:14:19 PM »

Huh, and you have the csv's header (command,class,tags,syntax,help), too?

If so, it should be working given what you've described. Could you send me a copy of your mod so I could take a closer look?
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #324 on: December 11, 2015, 04:30:34 PM »

There was two problems:

One, the csv was "something" wrong, I have no idea what.

I deleted my csv, but instead of copying the one that comes with the mod, I copied the one from the example, and then added my line to it instead...

now my class attempted to load.

now it refuses to work due to janino hating List it seems :(

Any idea on how I make a console command that use a "List" somehow? (I just want to dump all information from the CommodityStatTracker)
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #325 on: December 11, 2015, 04:38:07 PM »

now it refuses to work due to janino hating List it seems :(

Any idea on how I make a console command that use a "List" somehow? (I just want to dump all information from the CommodityStatTracker)

Janino is fine with Lists, it just hates generics and foreach loops (among other things). So if it's a List<CommoditySpecAPI>, you'd change the code from this:
Code: java
List<CommoditySpecAPI> specs = getAllSpecs();
for (CommoditySpecAPI spec : specs)
{
   doSomething(spec);
}

To this:
Code: java
List specs = getAllSpecs();
for (Iterator iter = specs.iterator(); iter.hasNext(); )
{
   CommoditySpecAPI spec = (CommoditySpecAPI) iter.next();
   doSomething(spec);
}

Alternatively you could use a jar and bypass Janino's limitations completely, though that's a significant step up in mod complexity if you don't already know how to do it.
« Last Edit: December 11, 2015, 04:39:55 PM by LazyWizard »
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #326 on: December 11, 2015, 04:46:49 PM »

My mod already has a .jar...

I made a .java because your tutorial never said it also accepts .jars :P

Neither explains how to do it... (ie: to what I need to point the csv to, and how I load my jar with commands, and how I make my jar don't cause bugs if the player don't have console commands mod)

EDIT: Oh, your suggestion worked, indeed it was only a generics AND foreach issue, stripping them away worked :)
« Last Edit: December 11, 2015, 04:59:05 PM by speeder »
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #327 on: December 11, 2015, 05:10:36 PM »

So, the way it works is that the console mod handles loading all commands and their classes. The commands.csv tells the console where to look for these scripts (the class row) and how the player uses the command (command is what they enter to use it, syntax and help are shown by the "help" command, and syntax is also shown to the player if the command returns CommandResult.BAD_SYNTAX). It doesn't know or care if these scripts are loose or in a jar as the actual class loading is done through Starsector's classloader (which supports both).

Since the console mod handles everything, the CSV won't be read and nothing will be loaded if the console isn't enabled in the launcher. Java only loads classes when they are needed, so don't worry about including commands in your mod's jar.

The sole exception to the "don't worry about creating a dependency" rule is any loose script in data/scripts, which is a magic directory whose contents are automatically compiled by Starsector when the game starts. That's why the tutorial recommends putting scripts in data/console, so you don't accidentally create a dependency on the console mod. The tutorial doesn't mention jars because it's old and was written before they became commonplace.

tl;dr: commands can be in jars, don't worry about creating a dependency, the tutorial is outdated. :)
« Last Edit: December 11, 2015, 05:31:05 PM by LazyWizard »
Logged

Zelnik

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #328 on: December 11, 2015, 09:03:12 PM »

sorry this took so long, had to go to work

17147 [Thread-5] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [org.lazywizard.console.ConsoleCombatListener]
java.lang.RuntimeException: Error compiling [org.lazywizard.console.ConsoleCombatListener]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.lazywizard.console.ConsoleCombatListener
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [0.7.1a] Console Commands v2.6b (released 2015-12-04)
« Reply #329 on: December 11, 2015, 09:07:52 PM »

Could you try redownloading? It sounds like you may be missing some parts of the mod.
Logged
Pages: 1 ... 20 21 [22] 23 24 ... 93