Skip to content

Contingencies and Sequencers Post v2.0 - How or Why?

kjeronkjeron Member Posts: 2,368
Does anyone know how to use Opcode 234 (Create Contingency) or Opcode 257 (Create Spell Sequencer) in v.2.0 or later without hijacking one of the vanilla spell's parent resref's (SPWI420, SPWI617, SPWI710, SPWI809, or SPWI908)?

So far it appears to now be hard-coded to require one of these parent resources, otherwise the game crashes immediately upon activating the effect or completing the spell selection, depending on how its used.

Are we now limited to a maximum of 5 different Contingency/Sequencer spells?

Their related opcodes (232, 256, 258, & 260) all continue to work just fine, as they did pre-v.2.0.

Comments

  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • kjeronkjeron Member Posts: 2,368
    @subtledoctor
    I found the issue, and as suspected, its the new UI.
    Need to add a line:
    	RESREF = {tip = STRREF, title = 'L_en_US_ENTRY', action = "L_en_US_ENTRY"},	
    In UI.menu,here:

    mageBookStrings = {
    SPWI908 = {tip = 24615, title = 'CHAIN_CONTINGENCY_TITLE', action = "ADD_SPELLS_CONTINGENCY_LABEL"},
    SPWI617 = {tip = 24615, title = 'CONTINGENCY_TITLE', action = "ADD_SPELLS_CONTINGENCY_LABEL"},
    SPWI809 = {tip = 24617, title = 'SPELL_TRIGGER_TITLE', action = "ADD_SPELLS_TRIGGER_LABEL"},
    SPWI710 = {tip = 24616, title = 'SPELL_SEQUENCER_TITLE', action = "ADD_SPELLS_SEQUENCER_LABEL"},
    SPWI420 = {tip = 24616, title = 'MINOR_SEQUENCER_TITLE', action = "ADD_SPELLS_SEQUENCER_LABEL"},
    }
    And other Parent Resources will work.
  • smeagolheartsmeagolheart Member Posts: 7,963
    edited June 2016
    kjeron said:

    @subtledoctor
    I found the issue, and as suspected, its the new UI.
    Need to add a line:

    	RESREF = {tip = STRREF, title = 'L_en_US_ENTRY', action = "L_en_US_ENTRY"},	
    In UI.menu,here:

    mageBookStrings = {
    SPWI908 = {tip = 24615, title = 'CHAIN_CONTINGENCY_TITLE', action = "ADD_SPELLS_CONTINGENCY_LABEL"},
    SPWI617 = {tip = 24615, title = 'CONTINGENCY_TITLE', action = "ADD_SPELLS_CONTINGENCY_LABEL"},
    SPWI809 = {tip = 24617, title = 'SPELL_TRIGGER_TITLE', action = "ADD_SPELLS_TRIGGER_LABEL"},
    SPWI710 = {tip = 24616, title = 'SPELL_SEQUENCER_TITLE', action = "ADD_SPELLS_SEQUENCER_LABEL"},
    SPWI420 = {tip = 24616, title = 'MINOR_SEQUENCER_TITLE', action = "ADD_SPELLS_SEQUENCER_LABEL"},
    }
    And other Parent Resources will work.
    @kjeron
    please make a bug report for this.
  • kjeronkjeron Member Posts: 2,368
    edited June 2016


    please make a bug report for this.

    I don't think they'll view this as a bug.
    I think it's a terrible place to put this functionality, but the fact that after extending the table to include my custom spell it works perfectly, it does appear intended.

    I made a function to suit my needs, but current Weidu does not extract .MENU or .LUA files yet, so they have to be exported manually with NI first:

    DEFINE_ACTION_FUNCTION ADD_SEQUENCER_LABEL
    // Can be used for Contingencies too, just using Sequencer Labels for defaults.
    INT_VAR desc_ref = ~-1~ // String Reference for Help/Description text
    STR_VAR
    resource = ~~ // File name of Sequencer/Contingency spell.
    title = ~~ // Title string, only necessary if not using default title_label
    title_label = ~SPELL_SEQUENCER_TITLE~ // Must be unique or use default.
    action = ~~ // Action string, only necessary if not using default title_label
    action_label = ~ADD_SPELLS_SEQUENCER_LABEL~ // Must be unique or use default.
    language = ~~ // Language, in ~en_US~ format, or empty for all
    BEGIN
    ACTION_IF ((~%resource%~ STRING_EQUAL ~~) OR (STRING_LENGTH ~%resource%~ > 8)) BEGIN FAIL ~Must specify a valid resource for Sequencer labeling~ END
    COPY_EXISTING ~UI.MENU~ override
    REPLACE_TEXTUALLY ~mageBookStrings = {~
    ~mageBookStrings = {
    %TAB%%resource% = {tip = %desc_ref%, title = '%title_label%', action = "%action_label%"},~
    BUT_ONLY
    ACTION_IF ~%language%~ STRING_EQUAL ~~ BEGIN
    ACTION_IF NOT ~%title_label%~ STRING_EQUAL ~SPELL_SEQUENCER_TITLE~ BEGIN
    ACTION_IF (~%title%~ STRING_EQUAL ~~) BEGIN FAIL ~Must specify title text~ END
    ACTION_FOR_EACH lang IN ~cs_CZ~ ~de_DE~ ~en_US~ ~es_ES~ ~fr_FR~ ~it_IT~ ~ja_JP~ ~ko_KR~ ~pt_BR~ ~ru_RU~ ~tr_TR~ ~uk_UA~ ~zh_CN~ BEGIN
    ACTION_IF FILE_CONTAINS_EVALUATED (~L_%lang%.LUA~ ~\( \|%TAB%\)%title%\( \|%TAB%\)~) BEGIN
    FAIL ~Sequencer title_label must be unique~
    END
    COPY_EXISTING ~L_%lang%.LUA~ override
    REPLACE_TEXTUALLY ~}~
    ~%TAB%%title_label% = "%title%",
    }~
    BUT_ONLY
    END
    END
    ACTION_IF NOT ~%action_label%~ STRING_EQUAL ~ADD_SPELLS_SEQUENCER_LABEL~ BEGIN
    ACTION_IF (~%action%~ STRING_EQUAL ~~) BEGIN FAIL ~Must specify action text~ END
    ACTION_FOR_EACH lang IN ~cs_CZ~ ~de_DE~ ~en_US~ ~es_ES~ ~fr_FR~ ~it_IT~ ~ja_JP~ ~ko_KR~ ~pt_BR~ ~ru_RU~ ~tr_TR~ ~uk_UA~ ~zh_CN~ BEGIN
    ACTION_IF FILE_CONTAINS_EVALUATED (~L_%lang%.LUA~ ~\( \|%TAB%\)%title%\( \|%TAB%\)~) BEGIN
    FAIL ~Sequencer title_label must be unique~
    END
    COPY_EXISTING ~L_%lang%.LUA~ override
    REPLACE_TEXTUALLY ~}~
    ~%TAB%%action_label% = "%action%",
    }~
    BUT_ONLY
    END
    END
    END ELSE BEGIN
    ACTION_IF NOT ~%title_label%~ STRING_EQUAL ~SPELL_SEQUENCER_TITLE~ BEGIN
    ACTION_IF (~%title%~ STRING_EQUAL ~~) BEGIN FAIL ~Must specify title text for Sequencer labeling~ END
    COPY_EXISTING ~L_%language%.LUA~ override
    REPLACE_TEXTUALLY ~}~
    ~%TAB%%title_label% = "%title%",
    }~
    BUT_ONLY
    END
    ACTION_IF NOT ~%action_label%~ STRING_EQUAL ~ADD_SPELLS_SEQUENCER_LABEL~ BEGIN
    ACTION_IF (~%action%~ STRING_EQUAL ~~) BEGIN FAIL ~Must specify action text for Sequencer labeling~ END
    COPY_EXISTING ~L_%language%.LUA~ override
    REPLACE_TEXTUALLY ~}~
    ~%TAB%%action_label% = "%action%",
    }~
    BUT_ONLY
    END
    END
    END
  • GrammarsaladGrammarsalad Member Posts: 2,582
    You wouldn't by any chance be willing to upload an example, would you? :)
  • Mr2150Mr2150 Member Posts: 1,170
    I would say it is a feature, but one that needs changing.

    Most of the other tables that are hardcoded are stored in BGEE.lua (eg the portraits table). Therefore, I would suggest to raise it as an issue on redmine with the suggestion to move the table to BGEE.lua, if possible.

    Then, a simple M_*.lua file can edit the table at the start of each game session, adding in the extra line items as needed (much like @Dee suggested with the portraits table).

    I've done some testing with @kjeron regarding using a lua file on it's own, but it DOES need to be called from the UI.menu first (requiring a UI.menu edit). Having the table in BGEE.lua should eliminate this...
  • The user and all related content has been deleted.
  • Mr2150Mr2150 Member Posts: 1,170
    That would probably work too... but it would need a bit more work by them.

    WEIDU can build lua files and edit them... the portrait picker mod that I wrote does it... Calling @Pecca to the thread...
  • kjeronkjeron Member Posts: 2,368

    Yeah but even the ability to use M_*.lua files is pretty crappy as long as those files can't be easily patched by Weidu. Takes us right back to the bad old days when the only way to mod was to completely overwrite files.

    You wouldn't need to patch any files though, you could just add a new M_*.lua file for each one.
    If your not worried about translation strings, this is all you would need in each file(replace the variables):
    	mageBookStrings.%RESREF% = {tip = %STRREF%, title = 'Your Title Here', action = "Your Sub-Title Here"}
  • smeagolheartsmeagolheart Member Posts: 7,963
    really sounds like a bug and not a feature to me
  • Mr2150Mr2150 Member Posts: 1,170
    (I'm using feature in an ironic sense... )
Sign In or Register to comment.