Too Much Code? 0_o Bamboozled

Discussion in 'PC Mods' started by Amelia Crasman, Sep 24, 2017.

  1. So recently I was creating a new system for Lonewolf, essentially it runs perfectly without error. BUT only if I disable another file, like Characters.xml. Although, and this part bombards me, if I enable Characters.xml, and disable Rtsevents(The system is run through here) the game works without crash. The game will also crash if I have both files active, but it won't crash if I disable Fatecards,xml, which I haven't made any changes to.

    I'm completely confused on what the problem could be, anyone faced similar problems?
     
    Bob Crees likes this.
  2. For reference here is the code for the system :

    Code:
    <Event Id="Event.NextMorningFatigue">
        <Actions>
          <Action ActionFlags="" ActionId="OrganizeEvents" ActionType="Action.Passive" ExecuteTimeStandard="0.0" OutputDelayTime="0.0" PauseWhenOffline="">
            <RTSActionIcon Name="" Id="" />
            <NameText Flags="" Notes="" Text="" />
            <Alts>
              <Alt AltId="FatigueReminder" AltOdds="100.0" />
              <Alt AltId="NextMorning_ApplyImpediment" AltOdds="100.0" />
              <Alt AltId="FollowingNight_Check" AltOdds="100.0" />
              <Alt AltId="FirstDay" AltOdds="100.0" />
            </Alts>
          </Action>
          <Action ActionFlags="Alt" ActionId="FirstDay" ActionType="Action.Passive" ExecuteTimeStandard="0.0" OutputDelayTime="0.0" PauseWhenOffline="">
            <RTSActionIcon Name="" Id="" />
            <NameText Flags="" Notes="" Text="" />
            <Effects />
            <Inputs>
              <CheckBool InputFlags="" InputId="!Game.RTS.Night" Invert="" />
            </Inputs>
            <Outputs>
              <RTSStat_SetBool DurationCancellable="" OutputAmount="true" OutputDuration="-1" OutputId="Status.Recent.FirstDay_Varified" PauseWhenOffline="True" />
              <Display_Text Flags="" Notes="" Text="FirstDay Activated" Type="Banner - Secondary" />
            </Outputs>
          </Action>
          <Action ActionFlags="Alt" ActionId="FollowingNight_Check" ActionType="Action.Passive" ExecuteTimeStandard="0.0" OutputDelayTime="0.0" PauseWhenOffline="">
            <RTSActionIcon Name="" Id="" />
            <NameText Flags="" Notes="" Text="" />
            <Effects />
            <Inputs>
              <CheckBool InputFlags="" InputId="Game.RTS.Night" Invert="" />
              <CheckBool InputFlags="" InputId="Status.Recent.FirstDay_Varified" Invert="" />
            </Inputs>
            <Outputs>
              <RTSStat_SetBool DurationCancellable="" OutputAmount="true" OutputDuration="-1" OutputId="Status.Recent.FollowingNight_Varified" PauseWhenOffline="True" />
              <Display_Text Flags="" Notes="" Text="FollowingNight_Check Activated" Type="Banner - Secondary" />
            </Outputs>
          </Action>
          <Action ActionFlags="Alt" ActionId="NextMorning_ApplyImpediment" ActionType="Action.Passive" ExecuteTimeStandard="0.0" OutputDelayTime="0.0" PauseWhenOffline="">
            <RTSActionIcon Name="" Id="" />
            <NameText Flags="" Notes="" Text="" />
            <Actors>
              <Player HideWarnings="" Optional="" />
            </Actors>
            <Effects />
            <Inputs>
              <CheckBool InputFlags="" InputId="!Game.RTS.Night" Invert="" />
              <CheckBool InputFlags="" InputId="Status.Recent.FollowingNight_Varified" Invert="" />
              <Player_HasTrait Trait="!Trait.MoodType.NoSleep" />
              <Player_HasTrait Trait="!Trait.MoodType.Hunger" />
              <Player_HasTrait Trait="!Trait.MoodType.Sick" />
              <Player_HasTrait Trait="!Trait.Meta.LW_NextMorningFatigue" />
            </Inputs>
            <Outputs>
              <RTSStat_SetBool DurationCancellable="" OutputAmount="true" OutputDuration="-1" OutputId="Status.Event.FatigueApplied" PauseWhenOffline="True" />
              <Display_Text Flags="" Notes="" Text="NextMorning_ApplyImpediment Activated" Type="Banner - Secondary" />
              <EventRewardStat ExludeFromSummary="false" Icon="HappyFace" OutputAmount="-5" OutputId="Stat.Morale" RewardList="General" IconId="11">
                <DescriptionText Flags="" Notes="" Text="%+d Community Morale." />
              </EventRewardStat>
              <EventLog DisplayType="FateCard" EventFlags="General" Icon="House" IconId="10">
                <NameText Flags="" Notes="" Text="EVENT: Stayed Up All Night" />
                <TutorialText Flags="" Notes="" Text="Lack of plentiful food doesn't allow for proper nutrition." />
                <DescArgs />
                <Descriptions>
                  <EventLogDesc>
                    <DescriptionText Flags="" Notes="" Text="Ugh, I need proper food, my body doesn't feel right(Lowered Stamina and Health)." />
                    <SummaryText Flags="" Notes="" Text="Fatigued" />
                  </EventLogDesc>
                </Descriptions>
                <NpcEffects />
              </EventLog>
              <Actor_GiveTrait ActorIndex="0" DuringMission="" OutputDuration="" PauseWhenOffline="" Trait="Trait.Meta.LW_NextMorningFatigue" />
            </Outputs>
          </Action>
          <Action ActionFlags="Alt" ActionId="FatigueReminder" ActionType="Action.Passive" ExecuteTimeStandard="0.0" OutputDelayTime="0.0" PauseWhenOffline="">
            <RTSActionIcon Name="" Id="" />
            <NameText Flags="" Notes="" Text="" />
            <Actors>
              <Player HideWarnings="" Optional="" />
            </Actors>
            <Effects />
            <Inputs>
              <CheckBool InputFlags="" InputId="Status.Event.FatigueApplied" Invert="" />
              <Player_HasTrait Trait="Trait.Meta.LW_NextMorningFatigue" />
            </Inputs>
            <Outputs>
              <Display_Text Flags="" Notes="" Text="FatigueReminder Activated" Type="Banner - Secondary" />
              <EventRewardStat ExludeFromSummary="false" Icon="HappyFace" OutputAmount="-5" OutputId="Stat.Morale" RewardList="General" IconId="11">
                <DescriptionText Flags="" Notes="" Text="%+d Community Morale." />
              </EventRewardStat>
              <EventLog DisplayType="EventBanner" EventFlags="General" Icon="House" IconId="10">
                <NameText Flags="" Notes="" Text="STATUS: Fatigued" />
                <TutorialText Flags="" Notes="" Text="Power Naps don't help with Fatigue." />
                <DescArgs />
                <Descriptions>
                  <EventLogDesc>
                    <DescriptionText Flags="" Notes="" Text="Staying up all night have taken a serious toll on me(Lowered Stamina and Health)." />
                    <SummaryText Flags="" Notes="" Text="Get Proper Rest" />
                  </EventLogDesc>
                </Descriptions>
                <NpcEffects />
              </EventLog>
              <Actor_GiveTrait ActorIndex="0" DuringMission="" OutputDuration="" PauseWhenOffline="" Trait="Trait.Meta.LW_NextMorningFatigue" />
            </Outputs>
          </Action>
        </Actions>
      </Event>
    This was originally being ran via Fatecards.xml, but after receiving trouble I reverted fatecards xml and transferred the system over to RTS.Events.
    I even completely disabled the code and the game was still crashing.
     
    Bob Crees likes this.
  3. The problem seems fixed for now, I had to disable code in fatecards that was unused:


    20170924231856_1.jpg


    Although I'm inevitably gonna go past the limit again and the same problem is going to occur so a fix or solution must be found; I don't want to compromise :(
     
    tobu24 and Bob Crees like this.
  4. QMJS

    QMJS Famous

    I think you already identified it, and it is an issue I have been having problems with for a long time. It is file size... an individual file can be too big, or total file size can be too big. The number of events/functions can be too high, and an individual one can be too long. That all points to how it is interpreted after compiling, so some pieces with more lines of code can actually end up smaller after compilation.

    So, a few things that you can do... in Breakdown, go through and look for all of the story mode stuff that is left over. Not used, not needed... get rid of it. That frees up a ton of space in enclaves and missions, and a significant amount in other places.
    In characters, reduce the number of names... with 10 first and 10 last that is still 100 times the character can show up with a unique name. Some of the defaults have huge numbers possible, like 25000+... they don't need that many random names.

    Also, in characters and expertise, you can eliminate the 'flavor' traits that don't do anything.
    For example, Beer Pong. There are six characters with the trait added directly, and any of the Bully_Bro characters gets it as well. (If you really want to, you could add another bit in the character description.) But, it doesn't have any effect at all, and there are several other traits related to alcohol. But, the code for beer pong is 11 lines, plus the one in Bully_Bro, plus 21 lines for the progression trait which simply assigns the aptitude trait. Then in expertise, the aptitude takes up another 79 lines. All of that to display the stars, with no effects at all.

    You can eliminate these: <Console_Command Command="LOG:
    There are 352 of those in Breakdown alone. They do nothing useful at all.

    Then there are some of the code blocks that are sub-optimal.

    In facilities, there are a lot of the built-in facilities that are identical except for the name, such as the pastor's quarters... simplifying those can save a huge amount of space.

    For example, there are a lot that have two alts, and then a default result if the alts don't apply. But there are also some that have two alts, where one or the other must apply... (Like "Dead" or " Alive"), but it still has code in the default section, which will never be used. You could rewrite those as one alt, and move the other alt into the default. Any alt with 100 percent odds is suspect, although you have to compare the conditions to be sure what it is doing first.

    There are some other things, but the returns are fairly low for most of the rest of the stuff. But those should give you some places to look to save space.
     
    Najdorf and Bob Crees like this.
  5. Glad to see I'm not the only one. I'll start doing clan up later this afternoon. While I'm at it, QMJS, do you have any advice on creating new custom radio options for a specified character, furthermore, that function only working when playing as that particular character?
     
    Bob Crees likes this.
  6. QMJS

    QMJS Famous

    Not really. I haven't added any, but moving them between modes is pretty easy (like adding the construction assistance from story mode to Breakdown.)
     
    Bob Crees and Amelia Crasman like this.
  7. Alrighty, thanks anyways. Take care
     
    Bob Crees likes this.

Share This Page