Jump to content

stratagems.ini


Recommended Posts

I can give it a try with 1pp and my mod in progress, and maybe with the next IA release. ;)

 

What about the strings variables? For example, my mod introduces the possibility to gain two kinds of paladin's mount (horse and unicorn). I want to give the players the opportunity to name them as they wish. Let's say, my default_configuration.ini would have something like that:

 

destrier_name = Black Arrow

unicorn_name = Silver Star

 

I found a way to read them with WeiDU, at last (I am not very skilled with regexp :down:), and I can know evaluate them in d files.

 

Edit: I am not sure, but I think mods modifying banters timers would need more than 5 choices...

Edited by Gwendolyne
Link to comment
I can give it a try with 1pp and my mod in progress, and maybe with the next IA release. ;)
What about the strings variables? For example, my mod introduces the possibility to gain two kind of paladins mount (horse and unicorn). I want to give the players the opportunity to name them as they wish. Let's say, my default_configuration.ini would have something ijke that:
destrier_name = Black Arrow
unicorn_name = Silver Star
I found a way to read them with WeiDU, at last (I am not very skilled with regexp :down:), and I can know evaluate them in d files.

Numbers and string values are not a problem for INI. You can even put "valueA,ValueB" and split it by comma via regexp to simulate array of multiple values. But for 'true' Arrays or more complex data values, HJSON must be used.

 

One remark: you already posted an example of you own custom 'Gwendolyne unicorn' file format. It's not an ini file. Can you find out why?

 

And you use custom "configuration filename". There is no way for the tool to detect and use it, if you don't use any of Point 3, solution a) b) or c) from previous page. Currently, only possible way is b) and c).

 

Edit: I am not sure, but I think mods modifying banters timers would need more than 5 choices...

Not a problem. The amount of choices/keys are infinite inside ini/json file. Or I misunderstand you.

Edited by ALIENQuake
Link to comment

So, made a 1pp.ini file:

;Use 1pp or IWD style female dwarf paperdolls?
;1 = IWD - 2 = 1pp
1pp_fdwar = 2

;Do you want to include SoA style loading screens for ToB?
;1 =  Yes. - 2 = Keep loading screens unchanged.
1pp_gui = 1

;Install updated fonts? (may cause issues with languages using different font .BAMs)
;1 = Yes - 2 = Keep fonts unchanged
1pp_updated_fonts = 1

;Use mixed case labels?
;1 = Yes - 2 = No
1pp_labels = 1

;Softer Spell Effects
;WARNING: This component will only work properly with 3D support enabled (alpha blending). Installing this component on BG2 in software rendering mode IS NOT A GOOD IDEA.
;1 = Yes, install - 2 = No, cancel installation
1pp_softer_spell_effects = 1

;Install IWD-style Agannazar s Scorcher or alternate style?
;1 = IWD style - 2 = BGII alternate
1pp_agannazar_scorcher = 2

; Install less obtrusive dispel magic effect?
;1 = Yes - 2 = No (install improved stock effect instead)
1pp_less_obtrusive_dispel_magic_effect = 1

;HAMMERS INVENTORY ICONS
;This component overwrites the vanilla Runnehammer icon and sets it to Borok Fist +2, then assigns Borok Fist icon to Runehammer. Do you want to apply those changes?
;1 = Yes - 2 = No, assign the new icon to Borok Fist, but keep the Runnehammer icon for their respective hammers.
1pp_hammers_icons = 1

;Do you want to include updated potion graphics?
;1 = Yes - 2 = No
1pp_potions_icons = 1

;Do you want existing cause wound spells to use IWD-style icons? (healing icon in red)
;1 = Yes - 2 = No, keep BG2 icons for existing spells.
1pp_IWD_cause_wounds_icons = 1

;WARNING: if SPPR142/1342 (spells Cause Light Wounds, Cause Medium Wounds) are already taken by a previously installed mod. Proceeding to install may cause issues.
;1 = Yes, install - 2 = No, cancel installation
1pp_spell_conflict = 1

;WARNING: What this component installs/offers to install depends on what other components are installed (e.g. it can only make use of additional object animations if they are available). If you have not yet installed a previous component of this mod that you would like to, now is the time.
;1 = Yes, install - 2 = No, cancel installation
1pp_core_update = 1

;SETTING 1: SHIELD APPEARANCE
;This sets the standard appearance of shields in the game in the sense that these will be the ones you mostly find in stores, etc. Does not necessarily affect magical items or prevent you from finding other items.
;1. 1ppv4-BG II style - 2. BGI style - 3. Faux BGI style (use BG1 icons but not animations) - 4. Skip this part of the install
1pp_pshields = 1

;SETTING 1B: SCATTER SHIELDS THROUGHOUT GAME
;This determines whether the available extra shields are scattered throughout the game world (in the form of new items, random finds, etc.) for you to find or not.
;1 = Yes - 2 = No
1pp_pshieldz = 1

; SETTING 2: HELMET APPEARANCE
; This sets the standard appearance of helmets in the game in the sense that these will be the ones you mostly find in stores, etc. Does not necessarily affect magical items or prevent you from finding other items.
; 1. 1ppv4 style - 2. Faux BGI style (use BG1 icons but not animations) - 3. BGII style - 4. Skip this part of the install
1pp_phelmets = 1

;SETTING 2B: SCATTER HELMETS THROUGHOUT GAME
;This determines whether the available extra helmets are scattered throughout the game world (in the form of new items, random finds, etc.) for you to find or not.
;1 = Yes - 2 = No
1pp_phelmetz = 1

;SETTING 2C: HELMET COMPATIBILITY
;This is mainly for unsupported third party mods and determines the animation these will use.
;1. updated BGII style - 2. based on BGI style - 3. Skip this part of the install
1pp_phelmetb = 1

;SETTING 3: ARMOUR ITEM ICONS
;This sets the standard appearance of armour inventory icons in the game. Does not necessarily affect magical items or prevent you from finding other items.
;1. 1ppv4 style - 2. BGI style - 3. BGII style - 4. Skip this part of the install
1pp_parmours = 1

;SETTING 3B: SCATTER ARMOUR THROUGHOUT GAME
;This determines whether the available alternates are scattered throughout the game world (in the form of new items, random finds, etc.) for you to find or not.
;1 = Yes - 2 = No
1pp_parmourz = 1

;SETTING 4: FORCED ITEM COLOURS
;This determines which item colours are set/uneditable for equipped items. By default, magical items have set item colours while non-magical shields/helmets do not (allowing you to customise them via your clothing colour).
;1. Yes for magical items/No for non-magical items - 2. Yes for both magical and non-magical items
;3. Yes for both magical and non-magical items, but exclude BG1 legacy shields - 4. No for either magical nor non-magical items
1pp_pcolour = 1

;SETTING 5A: PAPERDOLL SHADOWS (SHIELDS)
;Traditionally, equipped objects do not render shadows on paperdolls. Enable this option if you want shields to cast shadows on paperdolls.
;1 = No - 2 = Yes
1pp_psshld = 2

; SETTING 5B: PAPERDOLL SHADOWS (HELMETS)
; Traditionally, equipped objects do not render shadows on paperdolls. Enable this option if you want helmets to cast shadows on paperdolls.
; 1 = No - 2 = Yes
1pp_pshelmet = 2

;Do you want gems to require some lore to identify?
;1 = Yes - 2 = No
1pp_gemlore = 1

;Do you want your shield setting to apply to Tutu/BG1 shields as well (warning: replaces Tutu default shields)?
;1 = No - 2 = Yes
1pp_tutu_bg1_shields = 1

;Do you want your BG2 helmet inventory icon choices to apply to Tutu/BG1 helmets as well (warning: replaces Tutu default helmets)?
;1 = No - 2 = Yes
1pp_tutu_bg1_helmets = 1

;Do you want to turn the morningstar +2 The Sleeper into a flail?
;1 = Yes - 2 = No, but install the alternate flail icon IBLUN16V as a new resource for modders.
1pp_psleeper = 1

;SETTING 1: ITEM COLOURS FOR NON-MAGICAL ITEMS (IWD install)
;This determines whether item colours are set for common, non magical shields/helmets. By default, these remain unset so the player can choose their own (matching their clothing colour). By enabling this option, item colours are set for all items.
;1 = No - 2 = Yes
1pp_pcolour_IWD = 1

;There are two choices for the appearance of weapons wielded by solars. Please pick your preference:
;1. New appearance (solid object with glow) - 2. As in BGII vanilla (blurry bright glow all over)
1pp_solar = 1

Unfortunately, I am afraid I must remove the variables below and keep them in READLN process.

 

;Softer Spell Effects
;WARNING: This component will only work properly with 3D support enabled (alpha blending). Installing this component on BG2 in software rendering mode IS NOT A GOOD IDEA.
;1 = Yes, install - 2 = No, cancel installation
1pp_softer_spell_effects = 1

 

;WARNING: if SPPR142/1342 (spells Cause Light Wounds, Cause Medium Wounds) are already taken by a previously installed mod. Proceeding to install may cause issues.
;1 = Yes, install - 2 = No, cancel installation
1pp_spell_conflict = 1


;WARNING: What this component installs/offers to install depends on what other components are installed (e.g. it can only make use of additional object animations if they are available). If you have not yet installed a previous component of this mod that you would like to, now is the time.
;1 = Yes, install - 2 = No, cancel installation
1pp_core_update = 1

 

 

 

Link to comment

Could you can read baldur.ini file and check if 3D Acceleration equals 1? If not, use ABORT weidu function to skip this component without need to use READLN. Could you detect SPPR142/1342 somehow? I see only two choices so 'subcomponent' can also be used. I'm confident that other modders could offer solutions to get rid of READLN.

 

Any kind of READLN options will pause installation and require user to provide input during every new installation. It's not unnecessary but it's major pain to deal for install tool: it's impossible to present such choices at the mod component list to the user before installation without providing custom made data. Life show us that nobody will do this anymore.

 

Remarks:

you are added spaces before and after, so it's "key(space)=(space)value" and it's not how INI file format is defined. You have to remove those spaces. I can't offer to read a custom made "INI version of the file format made by x" because every modder has his own ideas how to write config file. Some uses spaces, tabs, comas, some use weidu formats etc. It would be a nightmare to support.

 

Also you name you file as 1pp.ini so next update will overwrite user choices. Please rename it to configuration-default.ini and add a comment: ";To use this file, rename it as configuration.ini and leave it in current folder."

Edited by ALIENQuake
Link to comment

Gwendolyne, you do know you can make most of those subcomponents, not use a READLN at all ? It would be horrible to run a .exe and have no choises at all.
Back to actual code that potentially needs to use READLN.

How would I code for example, 3 variables("timer11" , "timer12" and "timer13") reading from a .ini file, with current weidu's .tp2 code that uses ACTION_READLN:

PRINT ~What would you like to set the first level refresh timer at?~
ACTION_READLN timer11
OUTER_WHILE !(IS_AN_INT %timer11%) BEGIN
  PRINT ~What would you like to set the first level refresh timer at? K.~
  ACTION_READLN timer11
END

PRINT ~What would you like to set the second level refresh timer at?~
ACTION_READLN timer12
OUTER_WHILE !(IS_AN_INT %timer12%) BEGIN
  PRINT ~What would you like to set the second level refresh timer at? I.~
  ACTION_READLN timer12
END

PRINT ~What would you like to set the third level refresh timer at?~
ACTION_READLN timer13
OUTER_WHILE !(IS_AN_INT %timer13%) BEGIN
  PRINT ~What would you like to set the third level refresh timer at? I.~
  ACTION_READLN timer13
END

This is a sub question in a created-function that also relies on READLN's ... so it's just a small example of a very large kaleidoscope of a 1 component that can't be sub-sectioned: I don't thing this actually works, but the code of the whole component, only for reference...

///////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Mage Spells ///////////////////////////////
///////////////////////////////////////////////////////////////////////////////

BEGIN ~Arcane Spell Refreshment~ DESIGNATED 1

// we zero values and in preparation of the actual ones
OUTER_SET "function" = 0
OUTER_SET "constant" = 0
OUTER_SET "level_variable" = 0
OUTER_SET "ex_base" = 0
OUTER_SET "exponent" = 0
OUTER_SET "root" = 0
OUTER_SET "answer" = 0
OUTER_SET "timer1" = 0
OUTER_SET "timer2" = 0
OUTER_SET "timer3" = 0
OUTER_SET "timer4" = 0
OUTER_SET "timer5" = 0
OUTER_SET "timer6" = 0
OUTER_SET "timer7" = 0
OUTER_SET "timer8" = 0
OUTER_SET "timer9" = 0
OUTER_SET "timer11" = 0
OUTER_SET "timer12" = 0
OUTER_SET "timer13" = 0
OUTER_SET "timer14" = 0
OUTER_SET "timer15" = 0
OUTER_SET "timer16" = 0
OUTER_SET "timer17" = 0
OUTER_SET "timer18" = 0
OUTER_SET "timer19" = 0

OUTER_WHILE ("%answer%" STRING_COMPARE_REGEXP "[yY]") BEGIN

PRINT ~Which type would you like the timer to be for the arcane spells to be set at?
1) Timers are defined by a funtion, based on the spells own level.
2) Timers are set individually per level.
3) Timers are randomized for each level.~

PRINT ~So in:
1) timer = constant + spell level * level variable + exponential base * spell level ^ (exponent/root)
2 & 3) timer = ???
Do not worry, you'll get to see what the value is for each levels will end up being and you can cancel/reset them if you do not wish to install with the set timers.~

ACTION_READLN function
OUTER_WHILE (!(IS_AN_INT %function%) || (%function% > 4) || (%function% < 1)) BEGIN
PRINT ~Which type of function would you like the timer to be for the arcane spells ?~
PRINT ~So in:
1) timer = constant + spell level * level variable + exponential base * spell level ^ (exponent/root)
2 & 3) timer = ???
Do not worry, at the end you'll get to see what the for each levels will end up being and you can cancel/reset them if you do not wish to install with the set timers.~
ACTION_READLN function
END

ACTION_IF (%function% = 1) THEN BEGIN
PRINT ~Set *constant* for all levels:
Timers = constant + spell level * level variable + exponential base * spell level ^ (exponent/root)~
ACTION_READLN constant
OUTER_WHILE !(IS_AN_INT %constant%) BEGIN
PRINT ~We'll try to keep it on the level dude.
So set the darn *constant* to a number, dude. OK ?~
ACTION_READLN constant
END
END

ACTION_IF (%function% = 1 AND IS_AN_INT %constant%) THEN BEGIN
PRINT ~Set the *level variable* for the levels:
Timers = %constant% + spell level * level variable + exponential base * spell level ^ (exponent/root)~
ACTION_READLN level_variable
OUTER_WHILE !(IS_AN_INT %level_variable%) BEGIN
PRINT ~We'll try to keep it on the level dude.
So set the darn *level variable* to a number, dude. OK? Dude.~
ACTION_READLN level_variable
END
END

ACTION_IF (%function% = 1 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable%) THEN BEGIN
PRINT ~Set the exponential base:
Timers = %constant% + spell level * %level_variable% + exponential base * spell level ^ (exponent/root)~
ACTION_READLN ex_base
OUTER_WHILE !(IS_AN_INT %ex_base%) BEGIN
PRINT ~Set the exponential base~
ACTION_READLN ex_base
END
END

ACTION_IF (%function% = 1 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable% AND IS_AN_INT %ex_base%) THEN BEGIN
PRINT ~Set the *exponential base* value that will multiply the exponential and divided by the root you'll decide, later.
Timers = %constant% + spell level * %level_variable% + %ex_base% * spell level ^ (exponent/root)~
ACTION_READLN exponent
OUTER_WHILE !(IS_AN_INT %exponent%) BEGIN
PRINT ~Try, well to keep it on the level dude.
So set the darn *exponent* to a number, dude. OK ?~
ACTION_READLN exponent
END
END

ACTION_IF (%function% = 1 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable% AND IS_AN_INT %ex_base% AND IS_AN_INT %exponent%) THEN BEGIN
PRINT ~Set the exponential *root* or the exponents divider, remember that dividing a number with 1, is the number itself:
Timers = %constant% + spell level * %level_variable% + %ex_base% * spell level ^ ( %exponent% / root)~
ACTION_READLN root
OUTER_WHILE !(IS_AN_INT %root%) BEGIN
PRINT ~We'll be trying to keep it on the level dude.
So set the darn *root* to a number, dude. K?~
ACTION_READLN root
END
END

ACTION_IF (%function% = 1 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable% AND IS_AN_INT %ex_base% AND IS_AN_INT %exponent% AND IS_AN_INT %root%) THEN BEGIN
OUTER_SET timer1 = (%constant% + %level_variable% + %ex_base% * 1 ** (%exponent% %root%))
OUTER_SET timer2 = (%constant% + 2*%level_variable% + %ex_base% * 2 ** (%exponent% %root%))
OUTER_SET timer3 = (%constant% + 3*%level_variable% + %ex_base% * 3 ** (%exponent% %root%))
OUTER_SET timer4 = (%constant% + 4*%level_variable% + %ex_base% * 4 ** (%exponent% %root%))
OUTER_SET timer5 = (%constant% + 5*%level_variable% + %ex_base% * 5 ** (%exponent% %root%))
OUTER_SET timer6 = (%constant% + 6*%level_variable% + %ex_base% * 6 ** (%exponent% %root%))
OUTER_SET timer7 = (%constant% + 7*%level_variable% + %ex_base% * 7 ** (%exponent% %root%))
OUTER_SET timer8 = (%constant% + 8*%level_variable% + %ex_base% * 8 ** (%exponent% %root%))
OUTER_SET timer9 = (%constant% + 9*%level_variable% + %ex_base% * 9 ** (%exponent% %root%))
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the first level refresh timer at?~
ACTION_READLN timer11
OUTER_WHILE !(IS_AN_INT %timer11%) BEGIN
PRINT ~What would you like to set the first level refresh timer at? K.~
ACTION_READLN timer11
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the second level refresh timer at?~
ACTION_READLN timer12
OUTER_WHILE !(IS_AN_INT %timer12%) BEGIN
PRINT ~What would you like to set the second level refresh timer at? I.~
ACTION_READLN timer12
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the third level refresh timer at?~
ACTION_READLN timer13
OUTER_WHILE !(IS_AN_INT %timer13%) BEGIN
PRINT ~What would you like to set the third level refresh timer at? I.~
ACTION_READLN timer13
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the forth level refresh timer at?~
ACTION_READLN timer14
OUTER_WHILE !(IS_AN_INT %timer14%) BEGIN
PRINT ~What would you like to set the forth level refresh timer at? T.~
ACTION_READLN timer14
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the fifth level refresh timer at?~
ACTION_READLN timer15
OUTER_WHILE !(IS_AN_INT %timer15%) BEGIN
PRINT ~What would you like to set the fifth level refresh timer at? O.~
ACTION_READLN timer11
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the sixth level refresh timer at?~
ACTION_READLN timer16
OUTER_WHILE !(IS_AN_INT %timer16%) BEGIN
PRINT ~What would you like to set the sixth level refresh timer at? S.~
ACTION_READLN timer16
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the seventh level refresh timer at?~
ACTION_READLN timer17
OUTER_WHILE !(IS_AN_INT %timer17%) BEGIN
PRINT ~What would you like to set the seventh level refresh timer at? F.~
ACTION_READLN timer17
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the eight level refresh timer at?~
ACTION_READLN timer18
OUTER_WHILE !(IS_AN_INT %timer18%) BEGIN
PRINT ~What would you like to set the eight level refresh timer at? U.~
ACTION_READLN timer18
END
END

ACTION_IF (%function% = 2) THEN BEGIN
PRINT ~What would you like to set the ninth level refresh timer at?~
ACTION_READLN timer19
OUTER_WHILE !(IS_AN_INT %timer19%) BEGIN
PRINT ~What would you like to set the ninth level refresh timer at? K.~
ACTION_READLN timer19
END
END

ACTION_IF (%function% = 2 AND IS_AN_INT %timer11% AND IS_AN_INT %timer12% AND IS_AN_INT %timer13% AND IS_AN_INT %timer14% AND IS_AN_INT %timer15% AND IS_AN_INT %timer16% AND IS_AN_INT %timer17% AND IS_AN_INT %timer18% AND IS_AN_INT %timer19% ) THEN BEGIN
OUTER_SET timer1 = (%timer11%)
OUTER_SET timer2 = (%timer12%)
OUTER_SET timer3 = (%timer13%)
OUTER_SET timer4 = (%timer14%)
OUTER_SET timer5 = (%timer15%)
OUTER_SET timer6 = (%timer16%)
OUTER_SET timer7 = (%timer17%)
OUTER_SET timer8 = (%timer18%)
OUTER_SET timer9 = (%timer19%)
END

ACTION_IF (%function% = 3) THEN BEGIN
RANDOM_SEED ~a~
PRINT ~Seed is set at %a%



~
PRINT ~The timers randomized~
OUTER_SET timer1 = RANDOM(1 100)
OUTER_SET timer2 = RANDOM(2 200)
OUTER_SET timer3 = RANDOM(115 298)
OUTER_SET timer4 = RANDOM(101 400)
OUTER_SET timer5 = RANDOM(20 500)
OUTER_SET timer6 = RANDOM(435 727)
OUTER_SET timer7 = RANDOM(350 619)
OUTER_SET timer8 = RANDOM(40 836)
OUTER_SET timer9 = RANDOM(482 1000)
END

ACTION_IF (IS_AN_INT %timer1% AND IS_AN_INT %timer2% AND IS_AN_INT %timer3% AND IS_AN_INT %timer4% AND IS_AN_INT %timer5% AND IS_AN_INT %timer6% AND IS_AN_INT %timer7% AND IS_AN_INT %timer8% AND IS_AN_INT %timer9%) THEN BEGIN

PRINT ~The timers for the Arcane Spell restorations will be as of following:
Level 1 spells: %timer1% real seconds
Level 2 spells: %timer2% real seconds
Level 3 spells: %timer3% real seconds
Level 4 spells: %timer4% real seconds
Level 5 spells: %timer5% real seconds
Level 6 spells: %timer6% real seconds
Level 7 spells: %timer7% real seconds
Level 8 spells: %timer8% real seconds
Level 9 spells: %timer9% real seconds~
PRINT ~Are you sure you wish to use those ? [y]es/[n]o. I want to [q]uit.~
ACTION_READLN answer
END
ACTION_IF (~%answer%~ STRING_EQUAL_CASE ~n~) THEN BEGIN
OUTER_SET "function" = 0
OUTER_SET "constant" = 0
OUTER_SET "level_variable" = 0
OUTER_SET "ex_base" = 0
OUTER_SET "exponent" = 0
OUTER_SET "root" = 0
OUTER_SET "answer" = 0
OUTER_SET "sucfail" = 0
END
ACTION_IF (~%answer%~ STRING_EQUAL_CASE ~q~) THEN BEGIN
FAIL ~You exited from the installator with the q button, you can ignore the weidu error.~
END
ACTION_IF (~%answer%~ STRING_EQUAL_CASE ~y~) THEN BEGIN
PRINT ~Now, do you wish that the spells are restored when:
1) Only when the casting is completelly successful
2) Even if it's not~
ACTION_READLN sucfail
OUTER_WHILE (!(IS_AN_INT %sucfail%) || (%sucfail% > 2) || (%sucfail% < 1)) BEGIN
PRINT ~OK man, now you are getting to me nerves alright, answer 1 or 2, got it? Good.~
ACTION_READLN sucfail
END
END

//And then we actually set everything


/////////Refresh ARCANE spells only on successful castings

ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND timer8 > 0 AND timer9 > 0 AND %sucfail% = 1) THEN BEGIN
COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN // protects against invalid files
READ_SHORT 0x1c "spl_type"
PATCH_IF ("%spl_type%" = "1") BEGIN
READ_LONG 0x34 ~spell_level~
PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN // protects against invalid files
READ_SHORT 0x1c "spl_type"
PATCH_IF ("%spl_type%" = "1") BEGIN
READ_LONG 0x34 ~spell_level~
PATCH_IF (~spell_level~ = 1) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 1 parameter2 = 0 timing = 4 duration = ~timer1~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 2) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 2 parameter2 = 0 timing = 4 duration = ~timer2~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 3) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 3 parameter2 = 0 timing = 4 duration = ~timer3~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 4) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 4 parameter2 = 0 timing = 4 duration = ~timer4~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 5) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 5 parameter2 = 0 timing = 4 duration = ~timer5~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 6) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 6 parameter2 = 0 timing = 4 duration = ~timer6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 7) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 7 parameter2 = 0 timing = 4 duration = ~timer7~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 8) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 8 parameter2 = 0 timing = 4 duration = ~timer8~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 9 OR ~spell_level~ = 10) BEGIN
LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 9 parameter2 = 0 timing = 4 duration = ~timer9~ resist_dispel = 2 probability1 = 100 END





/////////Refresh ARCANE spells on unsuccessful casting too

ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND timer8 > 0 AND timer9 > 0 AND %sucfail% = 2) THEN BEGIN
COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN // protects against invalid files
READ_SHORT 0x1c "spl_type"
PATCH_IF ("%spl_type%" = "1") BEGIN
READ_LONG 0x34 ~spell_level~
PATCH_IF (~spell_level~ = 1) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 1 parameter2 = 0 timing = 4 duration = ~timer1 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 2) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 2 parameter2 = 0 timing = 4 duration = ~timer2 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 3) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 3 parameter2 = 0 timing = 4 duration = ~timer3 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 4) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 4 parameter2 = 0 timing = 4 duration = ~timer4 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 5) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 5 parameter2 = 0 timing = 4 duration = ~timer5 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 6) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 6 parameter2 = 0 timing = 4 duration = ~timer6 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 7) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 7 parameter2 = 0 timing = 4 duration = ~timer7 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 8) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 8 parameter2 = 0 timing = 4 duration = ~timer8 +6~ resist_dispel = 2 probability1 = 100 END
PATCH_IF (~spell_level~ = 9 OR ~spell_level~ = 10) BEGIN
LPF ~ADD_SPELL_CFEFFECT~ INT_VAR opcode = 261 target = 1 parameter1 = 9 parameter2 = 0 timing = 4 duration = ~timer9 +6~ resist_dispel = 2 probability1 = 100 END


Yes, I only need to know how to do this well on the 3 requested variables in the above code section, not the ones in spoilers. Aka I want the player to be able to set the variables during install, or the Auto-installer to be easily set in a .ini file like proposed. I can walk the rest way home. The original mod was what ... 5 lines long at most.

Edited by Jarno Mikkola
Link to comment

Well, if you want an executable .tp2, make an folder called "IMPsurprice", copy paste this code to a file called setup-IMPsurprice.tp2 and copy paste a weidu.exe renamed as setup-IMPsurprice.exe and then excecure it, ouh the code:

 

BACKUP ~IMPsurprice/backup~
AUTHOR ~Jarno Mikkola aka The Imp~

BEGIN ~Component 1~ DESIGNATED 1

OUTER_SET "timer11" = 0
OUTER_SET "timer12" = 0
OUTER_SET "timer13" = 0

PRINT ~What would you like to set the first level refresh timer at?~
ACTION_READLN timer11
OUTER_WHILE !(IS_AN_INT %timer11%) BEGIN
  PRINT ~What would you like to set the first level refresh timer at? K.~
  ACTION_READLN timer11
END

PRINT ~What would you like to set the second level refresh timer at?~
ACTION_READLN timer12
OUTER_WHILE !(IS_AN_INT %timer12%) BEGIN
  PRINT ~What would you like to set the second level refresh timer at? I.~
  ACTION_READLN timer12
END

PRINT ~What would you like to set the third level refresh timer at?~
ACTION_READLN timer13
OUTER_WHILE !(IS_AN_INT %timer13%) BEGIN
  PRINT ~What would you like to set the third level refresh timer at? I.~
  ACTION_READLN timer13
END

PRINT ~Surpice, we do nothing after this except show what we made with
Level 1 spells: %timer11% real seconds
Level 2 spells: %timer12% real seconds
Level 3 spells: %timer13% real seconds~
END
Ouh, the tp2 file needs to be coded with the "UTF8 no BOM" to install it on to a EE game, so yes, that the default coding language to all the EE games, the .tra files can then be what ever they are on a given language, us the English for example uses the Windows 1252 (Which is actually Latin, not US English, though there's multiple sources that refer to it as such)... that most use. Edited by Jarno Mikkola
Link to comment

This is what I cooked copied from cdtweaks :p

BACKUP ~IMPsurprice/backup~
AUTHOR ~Jarno Mikkola aka The Imp~

AUTO_EVAL_STRINGS

ALWAYS

    INCLUDE ~IMPsurprice/configuration-default.ini~ // config file

    ACTION_IF !VARIABLE_IS_SET timer11 THEN BEGIN OUTER_SET timer11 = 0 END
    ACTION_IF !VARIABLE_IS_SET timer12 THEN BEGIN OUTER_SET timer12 = 0 END
    ACTION_IF !VARIABLE_IS_SET timer13 THEN BEGIN OUTER_SET timer13 = 0 END

    ACTION_IF FILE_EXISTS ~IMPsurprice/configuration.ini~ THEN BEGIN
        INCLUDE ~IMPsurprice/configuration.ini~ // config file
    END 
END

BEGIN ~Component 1~ DESIGNATED 1

PRINT "%timer11%"
PRINT "%timer12%"
PRINT "%timer13%"

configuration-default.ini

//timer11
OUTER_SET timer11 = 0

//timer12
OUTER_SET timer12 = 0

//timer13
OUTER_SET timer13 = 0

configuration.ini

//timer11
OUTER_SET timer11 = 1

//timer12
OUTER_SET timer12 = 1

//timer13
OUTER_SET timer13 = 1

If user won't create configuration.ini, values will be read from configuration-default.ini

 

But this solution is using 2DA format :/ Could someone help me with this request: http://gibberlings3.net/forums/index.php?showtopic=29657 ?

Setup-IMPsurprice.zip

Edited by ALIENQuake
Link to comment

Hmm...

    ACTION_IF FILE_EXISTS ~IMPsurprice/configuration.ini~ THEN BEGIN
        INCLUDE ~IMPsurprice/configuration.ini~ // config file
    END 

Now, that a nice trick, I'll try to use it, eventually. Onces I get the mod to work as it's supposed. There's always too few ENDs in my try-codes.

Link to comment

... so in light of Ardaniss post, I should revisit this: why do you want to edit stratagems.ini anyway?

 

 

Guys, my point was to use ini for eradicate READLN nightmare and present normal options, not to present experimental options for advanced users. So let's forget about those concerns, ok? Now we have code which can be adopted to any mod if it has READLN (level1npc) or basic user settings (Scales of Balance) etc. Mods with debbug/experimental settings will simply not use code/example and everything will be fine for them.

 

As soon as I you wrote that SCS ini contains only experimental/debug settings, I don't want to edit it not present to user for edits. Don't worry. Discussion moves in the direction of replacing READLN or usage such config file for basic user settings, which was my only intention. Since SCS doesn't contain READLN nor basic user settings, even changing ini to be 'true ini' is irrelevant.

 

Yet, you can still solve "overwrite default advanced configuration" problem, even if ini file is not intended for the normal user, correct? This is up to you, ofc. If you intend to do it, you should use filenames which won't be detected via tool like "configuration-default.ini", "configuration.ini" so there won't be surprises.

 

Regardless of fixing "overwrite default advanced configuration" problem, may I have yet another future concern? Currently, the stratagems.ini falls into into naming scheme "sameAStp2name.ini", can you change it anyway to for eg: settings.ini/experimental.ini/anything which doesn't have possible tp2name?

Edited by ALIENQuake
Link to comment

As soon as I you wrote that SCS ini contains only experimental/debug settings, I don't want to edit it not present to user for edits. Don't worry.

Well, to be fair it doesn't contain *only* those settings. But it doesn't contain settings that I'd want anyone messing with unless they've read SCS's readme and done it themselves. I agree the sensible thing for an autoinstaller to do is replace READLN tricks.

 

Regardless of fixing "overwrite default advanced configuration" problem, may I have yet another future concern? Currently, the stratagems.ini falls into into naming scheme "sameAStp2name.ini", can you change it anyway to for eg: settings.ini/experimental.ini/anything which doesn't have possible tp2name?

I can, but I'm reluctant to. Partly that's just because I'm pretty sure I've been using stratagems.ini this way longer than pretty much anyone else and I'm not sure why I should suddenly change my usage case. But more importantly (and less selfishly!) I don't think it's good autoinstaller design just to assume that any file sitting in the mymod directory and called mymod.ini is a list of options to be presented to the player. Let me suggest instead that your autoinstaller checks every file in the mymod base directory with a .ini suffix for the string

 

;;;IE_MOD_AUTOINSTALL;;;
and processes the ini file as user-friendly configuration options only if it finds that string. (If I understand the .ini file spec, that's a comment that will be ignored by any ini parser.)
Link to comment

I knew that even such simple and totally neutral change could face doubts and hesitation.

Having a file header is not necessary a bad thing. But you want me to go against one of the most basic thing in the application development/programming word, that is "ignore comments when parsing a file". In addition, you want to base the whole search algorithm on this. What you programmers sense tells you? Also, I would need to write "algorithm" to scan every mod directory for specific file extension, parse it and extract specific data. And when if fails because "one extra character", people will complain to me. From my perspective it's a road to nowhere.
My proposition/design also aims for be "less selfish as possible" aka "don't require anything and if, require minimal amount" Consider the fact that you are adding extra requirement: instead of having a simple <modTp2name>.ini file with "key=value" pair, I would need to require a extra file header. Recently, I suggested that the "mod version" should be required to be able to install the mod because its absence caused many problems for players, modders and BWS. The only thing I receive was a boycott. Imagine how people will react, when instead of putting <modTp2name>.ini file, they still have to worry about the correct header of the file. They will complain because it is unnecessary under the condition of which the file has <modTp2name>.ini naming scheme.

I can, but I'm reluctant to. Partly that's just because I'm pretty sure I've been using stratagems.ini this way longer than pretty much anyone else and I'm not sure why I should suddenly change my usage case.

You were first one using such naming scheme, that's true. Take a look at any of the apps which you are using and try to look for their configuration files. I'm sure that 90% of them are using "config" or "settings" filename. I understand that you don't see a reason. So let me clear the clouds: "<modTp2name> scheme is, IMHO a perfect naming scheme for "mod metadata file" - please read this proposal: http://gibberlings3.net/forums/index.php?showtopic=29669

 

Now, when you know what I'm aim for, could you reconsider renaming stratagems.ini to settings.ini/experimental.ini/anything which doesn't have possible tp2name? SCS is a mod which everyone takes example of.

Edited by ALIENQuake
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...