Jump to content


Photo

Increasing existing affects in characters


  • Please log in to reply
143 replies to this topic

#81 i30817

i30817
  • Member
  • 611 posts

Posted 08 November 2011 - 02:25 PM

Huh.

In this IESDP page of the stats:
http://iesdp.gibberl...s/bg2/stats.htm

What's the one for move silently?

#82 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 08 November 2011 - 02:41 PM

BG1 used STEALTH for both 'hide in shadows' and 'move silently'

in BG2 they split it. Stands to reason that where necessary (.2da files) they are labeled with the new names. Whereas in the IDS STATS file, the label is for convenience, the number is what matters. So most likely they gave HIDEINSHADOWS it's own number and left 'move silently' with the STEALTH number.

You could test that by assigning different values for the two stats in say shadowkeeper and then run a script in game that checks both those stats and see if STEALTH returns true for what you put in for 'move silently'

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#83 i30817

i30817
  • Member
  • 611 posts

Posted 08 November 2011 - 03:23 PM

Yeah thanks, i saw the effect of stealth in IESDP and there it says it's move silenty.

EDIT: This is what i ended up for choosing the stats (missing stat feedback, that will probably slow down the start of the dialog.

1785 states is too much for the engine to handle? :P

It's awful, i've been warned:
Spoiler


Would be better to have a option to retry the point allocation in case of mistake, but that would be harder due to not being able to apply the effects as i go.

Edited by i30817, 08 November 2011 - 05:53 PM.


#84 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 08 November 2011 - 08:15 PM

hmm not sure if it would work since the dialog file is on an item, but perhaps you could have a script which checks the given stat in say a 10 pt range and it uses one of these (not sure which would be right)
137 StartDialog(S:DialogFile*,O:Target*)
137 StartDialogue(S:DialogFile*,O:Target*)
138 SetDialog(S:DialogFile*)
138 SetDialogue(S:DialogFile*)
139 PlayerDialog(O:Target*)
139 PlayerDialogue(O:Target*)
to get the right dialog file which covers just that same 10 pt range Would shorten the size of the dialog file considerable...

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#85 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 08 November 2011 - 09:02 PM

Suggestion on code cleanup - I don't know if AND in that position will compile. It's not needed, anyways - I'd take the top one and rewrite it as the bottom one. For evaluation, ~~ is already an AND statement; everything in between the tildes needs to be true before the reply branch is true. (DialogueIncrementGlobal()? That's new Ascension64 stuff? I am off to read up on new ToBEX changes! I've had my head stuck in my own mod for way too long.)

IF ~CheckStat(LastTalkedToBy, 254, STEALTH) AND GlobalGT("gt#pts", "GLOBAL", 0)~ REPLY @43 DO ~DialogueIncrementGlobal("gt#pts", "GLOBAL", -1) SetTokenGlobal("gt#pts","GLOBAL","TPOINTS") ApplySpellRES("GT#MVS1", LastTalkedToBy)~ GOTO 5
+ ~CheckStat(LastTalkedToBy, 254, STEALTH) GlobalGT("gt#pts","GLOBAL",0)~ + @43 DO ~IncrementGlobal("gt#pts","GLOBAL",-1) SetTokenGlobal("gt#pts","GLOBAL","TPOINTS") ApplySpellRES("GT#MVS1", LastTalkedToBy)~ + 5

Edited by cmorgan, 08 November 2011 - 09:07 PM.


#86 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 01:47 AM

If a token is connected to a global variable with
SetTokenGlobal("gt#bks", "GLOBAL", "BKS")

Then the global changes;

SetGlobal("gt#bks", "GLOBAL", 124)

will the <TOKEN> in strings display the old or the new value?

I'm going to find out as soon as i sort the compiler errors, but just as well ask before that.

Also, i have some problems with reading from the keyboard and SNPRINT:

PRINT @9
ACTION_READLN ~KEY~
PRINT ~KEY~
INNER_ACTION BEGIN SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~ END
//while not hotkey
OUTER_WHILE NOT(~T&L_KEY~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 INNER_ACTION BEGIN SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~ END
END
Or
PRINT @9
ACTION_READLN ~KEY~
PRINT ~KEY~
SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~
//while not hotkey
OUTER_WHILE NOT(~T&L_KEY~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~
END
Fail. I'm trying to get the variable as a single letter for the hotkeys.

Edited by i30817, 09 November 2011 - 02:04 AM.


#87 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 09 November 2011 - 02:52 AM

PRINT @9
ACTION_READLN ~KEY~
PRINT ~KEY~
INNER_ACTION BEGIN SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~ END
//while not hotkey
OUTER_WHILE NOT(~T&L_KEY~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 INNER_ACTION BEGIN SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~ END
END
Or
PRINT @9
ACTION_READLN ~KEY~
PRINT ~KEY~
SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~
//while not hotkey
OUTER_WHILE NOT(~T&L_KEY~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 SNPRINT ~1~ ~T&L&P_KEY~ ~KEY~
END
Fail. I'm trying to get the variable as a single letter for the hotkeys.

You set the variable T&L&P_KEY but try to check a variable T&L_KEY. You also need to evaluate KEY in the SNPRINT ("%KEY%"), or the result will always be K. The same goes for the variable you use in the STRING_MATCHES_REGEXP and the PRINTs. Yet another thing is that SNPRINT is a patch but you try to use it in the context of an action. Instead of using SNPRINT you can check the STRING_LENGTH.

Style-wise, you can also drop most of the wavy lines you are using. Aside from a few odd-ball cases you only need to use quotation marks/wavy lines around some special characters and when you want to evaluate string variables.

Edited by Wisp, 09 November 2011 - 03:03 AM.


#88 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 07:07 AM

Maybe i'm still doing something wrong:

PRINT @9
ACTION_READLN ~KEY~
SNPRINT 1 ~T&L&P_KEY~ ~%KEY%~
//while not hotkey
OUTER_WHILE NOT(~%T&L&P_KEY%~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 SNPRINT 1 ~T&L&P_KEY~ ~%KEY%~
END

No dice. Commenting the snprint makes it progress.

And doesn't readln come with the \n anyway? That's why i wanted the first char.


EDIT: Ended up with this:
PRINT @9
ACTION_READLN ~KEY~
OUTER_PATCH ~%KEY%~ BEGIN
  READ_ASCII 0 ~%T&L&P_KEY%~ (1)
END
//while not hotkey
OUTER_WHILE NOT(~%T&L&P_KEY%~ STRING_MATCHES_REGEXP ~[A-Z]~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN ~KEY~
 OUTER_PATCH ~%KEY%~ BEGIN
  READ_ASCII 0 ~%T&L&P_KEY%~ (1)
 END
END

Edited by i30817, 09 November 2011 - 07:36 AM.


#89 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 09 November 2011 - 07:15 AM

No dice. Commenting the snprint makes it progress.

As I said, SNPRINT is a patch (only syntactically valid within the scope of an open stream, I guess you could say). The context you are using it expects nothing but actions, so you get a syntax error. You can either put the SNPRINTs in OUTER_PATCHes or use something else (e.g., STRING_LENGTH). Another thing, STRING_MATCHES_REGEXP returns 0 on a match (eq. to logical false in this context), so your code will continue to ask for input until the user enters something invalid, rather than the other way around.

And doesn't readln come with the \n anyway? That's why i wanted the first char.

No, it should only contain the intended input.

Edited by Wisp, 09 November 2011 - 07:26 AM.


#90 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 09 November 2011 - 07:38 AM

just tell your user to input a single letter. check to make sure that it is a letter. and go on if it is. 90%+ of the users will understand what you want and the other 10% should be reading your readme where you'll explain what they are to be doing in detail.

No need to get complicated

yet if you want to get complicated
Spoiler
but that is if you want to get complicated :P
I've been one known to do things the 'hard way'

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#91 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 08:34 AM

yeah, since i have 4 of the things, i thought to ask for a string and used the regular expression facility to extract them all at once and verifying they are all different.

PRINT @9
ACTION_READLN KEYS

OUTER_WHILE(~%KEYS%~ STRING_MATCHES_REGEXP ~^(.) ([^\1]) ([^\1\2]) ([^\1\2\3])$~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN KEYS
END

How can i extract a capturing group of a regex, or does weidu not support that?
and regex negation?

Bizarrely, when i was using ~^[A-Z]$~ as a regular expression, it matched the Enter key. I don't suppose it is supposed to do that...

EDIT: wait i saw wisp message about the not.

Edited by i30817, 09 November 2011 - 08:54 AM.


#92 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 09 November 2011 - 08:50 AM

How can i extract a capturing group of a regex, or does weidu not support that?

INDEX and READ_ASCII. You can not use regexps directly for assignment. Also, you should have another look at the WeiDU regexp documentation. WeiDU regexps are more Emacs-like than Perl-like.

Edited by Wisp, 09 November 2011 - 09:23 AM.


#93 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 09:12 AM

Ah, backslashed parenthesis. Cool.

Edit: works great thanks:
PRINT @9
ACTION_READLN KEYS
//while not hotkey
OUTER_WHILE(~%KEYS%~ STRING_MATCHES_REGEXP ~^\(.\) \([^\1]\) \([^\1\2]\) \([^\1\2\3]\)$~) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN KEYS
END

OUTER_PATCH ~%KEYS%~ BEGIN
 READ_ASCII 0x0 NM_KEY (1)
 READ_ASCII 0x2 M_KEY (1)
 READ_ASCII 0x4 F_KEY (1)
 READ_ASCII 0x6 S_KEY (1)
END

Edited by i30817, 09 November 2011 - 09:26 AM.


#94 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 09 November 2011 - 10:27 AM

yeah, since i have 4 of the things, i thought to ask for a string and used the regular expression facility to extract them all at once and verifying they are all different.

You ask for 4 different hotkey values all at one time? I woulda asked 4 times in a row. yeah code would have been longer, but user wouldn't see that much difference... oh well looks like you got something working tho and that's all that matters

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#95 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 11:11 AM

Guess i spoke too soon about the regex.

OUTER_WHILE(
~%KEYS%~ STRING_MATCHES_REGEXP ~^\(.\)\([^\1]\)\([^\1\2]\)\([^\1\2\3]\)$~ != 0
OR
~%KEYS%~ STRING_MATCHES_REGEXP ~^[A-Z][A-Z][A-Z][A-Z]$~ != 0
) BEGIN
 PRINT @10
 PRINT @9
 ACTION_READLN KEYS
END

What i want, is a sequence
ABCD

of upper cased letters without spaces that doesn't repeat


But it appears to be accepting "aaaa"

Did i misinterpert the ^ symbol inside a [] ? That's what is usually used for group negation in regexes.

#96 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 11:41 AM

Edit: was a few copy pasta errors.

Edited by i30817, 09 November 2011 - 11:57 AM.


#97 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 09 November 2011 - 11:57 AM

of upper cased letters without spaces that doesn't repeat

Well, first problem, WeiDU regexps are not case-sensitive. But you can force the string to upper case with TO_UPPER KEYS. However, I would advise you to not use variable names all in upper case. Tomorrow KEYS may be the name of a new WeiDU function and you would have to change your code. This is one case where you would need to qualify your variable name by using quotes or wavy lines, but it is easier using something else.

Did i misinterpert the ^ symbol inside a [] ? That's what is usually used for group negation in regexes.

\1, \2 etc are treated literally, as a backslash followed by a number, inside character sets. They do not match preceding groups.

To check for distinctness you can use some regular tp2 code.
¡"%char2%" STRING_EQUAL "%char1%"
AND
!"%char3%" STRING_EQUAL "%char1%" AND !"%char3%" STRING_EQUAL "%char2%"
//and so on

Edited by Wisp, 09 November 2011 - 12:12 PM.


#98 i30817

i30817
  • Member
  • 611 posts

Posted 09 November 2011 - 12:09 PM

No groups :crying: ?

Got it into a rather standard cascading if chain inside a while, and ... i guess i was mistaken about the IF statement. Only PATCH_IF exists? But i'm not patching anything.
Spoiler

edit ah ACTION_IF of course.

Edited by i30817, 09 November 2011 - 03:48 PM.


#99 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 09:47 AM

Edit: duh, INNER_PATCH_SAVE

How can i force evaluation of vars inside ~Mystring with vars~ before i concat it to the old string?




Edit 2:
Any reason the ^ concat would make this code fail? (uncommenting them makes it not compile)


Spoiler


First error appears to be:
SET levelup_string = ""
"ERROR: cannot convert or %% to an integer"

How are we supposed to declare string vars?

Edited by i30817, 10 November 2011 - 02:11 PM.


#100 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 03:32 PM

bump for the question above (and the one about the TOKENS too).