Jump to content

I am honestly confounded by this.


Icendoan

Recommended Posts

Just a couple of questions;

 

Do Equipping Effects work with .spl files?

 

Can I use variables in filenames? (such as;

FOR (i=0;i<10;i=i+1) BEGIN

COPY_EXISTING_REGEXP ~./.*.itm~ ~foozle%i%~

END

)

 

Icen

Link to comment

Thanks!

 

Oh, cause I am lazy, is there a way if I use

FOR (i=0;i<100;i=i+1) BEGIN
COPY_EXISTING_REGEXP ~./.*.itm.~ ~override/zyswl%i%s.itm~
PATCH_IF ( 0x1c = 14 ) BEGIN
 SET Vars
 LAUNCH_PATCH_MACRO ~ADD_ITEM_EFFECT~
END
END
BUT_ONLY_IF_IT_CHANGES

 

I could discard from the override anything I don't use?

 

Icen

Link to comment
Just a couple of questions;

 

Do Equipping Effects work with .spl files?

well, they aren't "equipping" there, but they do work.

 

Oh, cause I am lazy, is there a way if I use
FOR (i=0;i<100;i=i+1) BEGIN
COPY_EXISTING_REGEXP ~./.*.itm.~ ~override/zyswl%i%s.itm~
PATCH_IF ( 0x1c = 14 ) BEGIN
 SET Vars
 LAUNCH_PATCH_MACRO ~ADD_ITEM_EFFECT~
END
END
BUT_ONLY_IF_IT_CHANGES

 

I could discard from the override anything I don't use?

I don't really understand what are you trying to do. If you need to patch lots of items but exclude several of them, use

COPY_EXISTING_REGEXP ~./.*.itm.~ ~override/zyswl%i%s.itm~
PATCH_IF NOT ((SOURCE_RES=...) AND (SOURCE_RES=...)) BEGIN

Link to comment

Frankly, I would just scan for all the items you want (using a WeiDU snippet) then hardcode them in an ACTION_FOR_EACH statement rather than trying to do something fancy with regexp. You can always use the undocumented (last I checked) ASSOCIATIVE_ARRAY commands if you really want to get fancy :fish:. This works even for mod-added items (existing ones anyway; you can't predict future ones but who cares).

 

I assume your examples are highly hypothetical, since you'll be making 100 copies of every item in the override matching certain criteria...

Link to comment

Oh, I don't really understand ACTION_FOR_EACH though I am very sure it is simple but I know how to use regexp.

 

No, I am making about 700+ items at the moment and I haven't finished it yet. I want to try and compress 3000 lines of code into about 100. The 100 is hypothetical, however, it is put there because I am lazy and haven't found out how many times I want to loop it.

 

I could do EVALUATE_REGEXP, couldn't I?

 

Icen

Link to comment

Ok. Here I am really confounded about how to solve this because I am pretty sure it isn't me.

 

I coded up this minimod for fun. It generates an item dynamically for the user using READLN.

 

Here is all I have so far, and it complains of an error at line 4401 or something else equally absurd. Because I have 12 lines of it so far.

WeiDU v 20800 Log

C:\Game\BG2\setup-cq#itemgen.exe
[./chitin.key] loaded, 590551 bytes
[./chitin.key] 182 BIFFs, 41793 resources
[dialog.tlk] loaded, 13506568 bytes
[dialog.tlk] 106096 string entries
[./Autorun.ini] loaded, 1452 bytes
[./baldur.ini] loaded, 3958 bytes
Possible HD/CD Path: [C:\Game\BG2\]
Possible HD/CD Path: [C:\Game\BG2\English\]
Possible HD/CD Path: [C:\Game\BG2\CD1\]
Possible HD/CD Path: [C:\Game\BG2\CD2\]
Possible HD/CD Path: [C:\Game\BG2\English\]
Possible HD/CD Path: [C:\Game\BG2\CD2\]
Possible HD/CD Path: [C:\Game\BG2\English\]
Possible HD/CD Path: [C:\Game\BG2\CD3\]
Possible HD/CD Path: [C:\Game\BG2\English\]
Possible HD/CD Path: [C:\Game\BG2\CD4\]
Possible HD/CD Path: [C:\Game\BG2\CD5\]
[./CharView.ini] loaded, 237 bytes
[./Keymap.ini] loaded, 5615 bytes
[./Mplaynow.ini] loaded, 230 bytes
[C:\Game\BG2\setup-cq#itemgen.exe] Using scripting style "BG2"
[dialog.tlk] claims to be writeable.
[dialog.tlk] claims to be a regular file.
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0  0 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0  1 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 100 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 102 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 103 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 104 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 106 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 107 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 108 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 109 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 110 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 111 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 112 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 113 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 114 Installed 
SETUP-ICENSMOD.TP2  0  0 Installed 
SETUP-SILM.TP2  0  0 Installed 
SETUP-SILM.TP2  0  1 Installed 
SETUP-SILM.TP2  0  2 Installed 
SETUP-SILM.TP2  0  3 Installed 
SETUP-SILM.TP2  0  4 Installed 
SETUP-SILM.TP2  0  5 Installed 
SETUP-SILM.TP2  0  6 Installed 
SETUP-SILM.TP2  0  7 Installed 
SETUP-SILM.TP2  0  8 Installed 
SETUP-SILM.TP2  0  9 Installed 
SETUP-SILM.TP2  0 10 Installed 

Install Component [item Generator]?
[i]nstall, or [N]ot Install or [Q]uit? 
Installing [item Generator]

This can make an item for you and install it using WeiDU. This mod
      leaves no traces and can be installed more than once. You can uninstall 
      your items however.

      What do you want your component to be called? (Using the name of the item works)


Saving This Log:
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0  0 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0  1 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 100 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 102 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 103 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 104 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 106 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 107 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 108 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 109 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 110 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 111 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 112 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 113 Installed 
BG2FIXPACK/SETUP-BG2FIXPACK.TP2  0 114 Installed 
SETUP-ICENSMOD.TP2  0  0 Installed 
SETUP-SILM.TP2  0  0 Installed 
SETUP-SILM.TP2  0  1 Installed 
SETUP-SILM.TP2  0  2 Installed 
SETUP-SILM.TP2  0  3 Installed 
SETUP-SILM.TP2  0  4 Installed 
SETUP-SILM.TP2  0  5 Installed 
SETUP-SILM.TP2  0  6 Installed 
SETUP-SILM.TP2  0  7 Installed 
SETUP-SILM.TP2  0  8 Installed 
SETUP-SILM.TP2  0  9 Installed 
SETUP-SILM.TP2  0 10 Installed 
SETUP-CQ#ITEMGEN.TP2  0  0 Installed ~Item Generator~
[bg2fixpack/english/setup.tra] has 101 translation strings

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

[sETUP-SILM.TP2] PARSE ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
GLR parse error

[sETUP-SILM.TP2]  ERROR at line 4410 column 1-12
Near Text: DEFINE_ARRAY
Parsing.Parse_error
ERROR: parsing [sETUP-SILM.TP2]: Parsing.Parse_error

SUCCESSFULLY INSTALLED      Item Generator

	WeiDU Timings
adding translation strings       0.000
OUTER_INNER_PATCH                0.000
READ_*                           0.000
load TLK                         0.000
DEFINE_PATCH_MACRO               0.000
DEFINE_ACTION_MACRO              0.000
parsing .log files               0.000
INCLUDE                          0.000
process_patch2                   0.000
eval_pe                          0.000
parsing .tra files               0.001
PATCH_PRINT                      0.005
Parsing TPA files                0.008
unmarshal KEY                    0.044
loading files                    0.046
unmarshal TLK                    0.138
Parsing TP2 files                1.511
stuff not covered elsewhere      1.990
ACTION_READLN                   12.466
TOTAL                           16.209

 

How do I resolve, or do I simply ignore?

 

Icen

Link to comment

Post something from the tp2 around that "error" (DEFINE_ARRAY).

Maybe it's an action instead of a patch and it should be ACTION_DEFINE_ARRAY?

 

/Edit: Or wait, setup-silm.tp2 is not your mod?

Anyway, you would be better of to attach the tp2, so someone might have a look at it.

Link to comment

Setup-Silm is my mod, and I think I only used DEFINE_ARRAY not ACTION_DEFINE_ARRAY.

 

Thanks.

Here is the offending code

ACTION_DEFINE_ARRAY ~m~ BEGIN
~s~
~e~
~r~
~n~
~d~
END
ACTION_DEFINE_ARRAY ~e~ BEGIN
~0~
~1~
~2~
END
COPY_EXISTING_REGEXP ~sw.*.itm~ ~Silm/Itm/Override~
PATCH_IF NOT (0x1c = 0) BEGIN
FOR(i=0;i<15;i=i+1) BEGIN
 SET b = 0
 SET c = 0
 ACTION_IF (0x1c = 20) BEGIN
  COPY ~Silm/Itm/Override~ ~Silm/Itm/Override2/zyswl$e(%c%)$m(%b%)%i%.itm~
  SET b = (%b%+1) UNLESS b = 5
  IF (0x60 > 0) BEGIN
   SET c = (%c%+1) UNLESS c = 3
  END
 END
 ACTION_IF (0x1c = 19) BEGIN
  COPY ~Silm/Itm/Override~ ~Silm/Itm/Override2/zysws$e(%c%)$m(%b%)%i%.itm~ 
  ACTION_IF (0x60 > 0) BEGIN
   SET c = (%c%+1) UNLESS c = 3
  END
  SET b = (%b%+1) UNLESS b = 5
 END
END

 

I switched the arrays to actions and apparently I am missing an END somewhere. It is me trying to be clever, really. I can manage without that lump of code.

 

Icen

Link to comment
apparently I am missing an END somewhere.
I guess. Though I don't know why one mod is throwing up errors in another...
It is me trying to be clever, really.
This causes more problems than it solves, usually :fish:.
I could do EVALUATE_REGEXP, couldn't I?
Again, why? You can pass hundreds of files to an ACTION_FOR_EACH. I don't know if there's an exact limit - it used to be ~256 but Taimon said that should've been remedied in the latest WeiDU. So if you want to mess with a bunch of items:

ACTION_FOR_EACH fm IN ~file01~ ~file02~ ~file03~ ~...~ BEGIN
 ACTION_IF FILE_EXISTS_IN_GAME ~%fm%.itm~ THEN BEGIN
COPY_EXISTING ~%fm%.itm~ ~override~
  ...
BUT_ONLY
 END
END

Worse case scenario is you'd just put the ... code in a macro and call this several times.

Link to comment

Ok, this really has stumped me.

 

WeiDU complains about not being able to read the variable probability2 as an integer. That I can sort, if I actually used that variable.

 

It is used for the macros I am running for this, ADD_ITEM_EFFECT, but it only complains about one part, which is no different to the rest.

 

That was simple, but I don't know why I had to do it. All I had to do was set that variable to 100 (which it says is default) for that bit, and it works smoothly. If someone could tell me why I had to, I would be interested.

 

Icen

Link to comment
That was simple, but I don't know why I had to do it. All I had to do was set that variable to 100 (which it says is default) for that bit, and it works smoothly. If someone could tell me why I had to, I would be interested.
Pay attention to the bit in the WeiDU doc that lacks a closing italics tag:
you need to set all the needed values - they aren't initialized automatically.
In other words, you need to set them all, even if you set them to zero and you don't plan on using them.

 

Also, contrary to common sense, probability2 should be the lower range at 0 and probability1 the upper range at 100. Once they're set once, you don't need to set them again if you don't plan on changing or using them. This is also one place where spelling definitely matters :fish:.

 

Whoops, forgot a closing italics flag.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...