Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Crash attempting to change hullmods on mod ship in mission  (Read 2833 times)

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Crash attempting to change hullmods on mod ship in mission
« on: September 20, 2013, 12:33:41 PM »

Code
346963 [Thread-6] INFO  com.fs.profiler.Profiler  -   Other                                                                                           -      0,00s      0,00%
346964 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.util.UnknownFormatConversionException: Conversion = '.'
java.util.UnknownFormatConversionException: Conversion = '.'
at java.util.Formatter.checkText(Formatter.java:2503)
at java.util.Formatter.parse(Formatter.java:2485)
at java.util.Formatter.format(Formatter.java:2414)
at java.util.Formatter.format(Formatter.java:2367)
at java.lang.String.format(String.java:2769)
at com.fs.starfarer.loading.specs.oOoo.Ò00000(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog$o.<init>(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog.Ööo000(Unknown Source)
at com.fs.starfarer.coreui.refit.ModPickerDialog.<init>(Unknown Source)
at com.fs.starfarer.coreui.refit.ooOO.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.O00o.super(Unknown Source)
at com.fs.starfarer.ui.F.processInput(Unknown Source)
at com.fs.starfarer.ui.newsuper.o00000(Unknown Source)
at com.fs.starfarer.new.øÒÒ000(Unknown Source)
at com.fs.oOOO.super.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

Not quite sure what this might be about. Said ship had a built in custom hullmod, dont know if it's related in any way, but I've changed hullmods several times without incidents after I implemented that.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #1 on: September 20, 2013, 12:36:27 PM »

Looks like you have a "%." in a hullmod description string, where you probably wanted a "%%." - since '%' is being used as an escape character.
Logged
Wyvern is 100% correct about the math.

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #2 on: September 20, 2013, 12:55:53 PM »

Hmm, I have %s, being used to pull a number from the hullmod file.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #3 on: September 20, 2013, 01:47:06 PM »

Say the string you wanted to display to the user was "Increases blah by 5%."  What you'd expect to see in the .csv file for that is "Increases blah by %s%%."  If you instead had "Increases blah by %s%.", then you'd get exactly this error message; the second '%' sign would be treated as an escape character, and then the formatter would explode because '.' isn't a valid thing to be escaped.
Logged
Wyvern is 100% correct about the math.

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #4 on: September 20, 2013, 02:02:14 PM »

Ah, I see. Thanks :) Still, I wonder why it only crashes rarely and not every time like this.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #5 on: September 20, 2013, 02:05:00 PM »

Ah, I see. Thanks :) Still, I wonder why it only crashes rarely and not every time like this.

It'll crash any time you try to mouseover the hullmod with the description that has an error in it and it tries to create the tooltip for it.
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #6 on: September 20, 2013, 02:15:10 PM »

Strangely enough, it didn't happen every time I did that. But removed the escape now, anyway.
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #7 on: September 24, 2013, 03:44:53 AM »

Okay, still happens despite the hull mod description being plaintext. Crashes to desktop when I try to change hullmods in dev mode in the variant edit menu or in missions. I think it's related to the hull-mod being built into the ships but still appearing in the hull mods menu.

This is the hull mod itself:
Code
package data.hullmods;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;

public class BlackrockFlux extends BaseHullMod {

public static final float VENT_RATE_BONUS = 100f;

public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
stats.getVentRateMult().modifyPercent(id, VENT_RATE_BONUS);
}

public String getDescriptionParam(int index, HullSize hullSize) {
if (index == 0) return "" + (int) VENT_RATE_BONUS;
return null;
}


}

And in hullmods.csv, it's not set to unlocked: true and so forth. Basically this hullmod is supposed to just be a part of the ships and to be unattainable in any other way. Ideally it would never show up in menus either. What gives?

EDIT: Actually, it seems like a conflict between mods. I disabled one and now I cant reproduce it... hmmm.
« Last Edit: September 24, 2013, 03:49:10 AM by Cycerin »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Crash attempting to change hullmods on mod ship in mission
« Reply #8 on: September 24, 2013, 11:31:31 AM »

Maybe another mod had the same hullmod id and an error with the description? In any event, quite sure it's an error with the description - the stack trace is pretty definitive.

(As for not showing up in the hullmod selection dialog: it'll only show up in the dev mod "edit variants". Or if some skill ends up unlocking it, which wouldn't be the case.)
Logged