Jump to content

Text replacement... another problem


temnix

Recommended Posts

I want to insert a condition in front of Heard() triggers in scripts so that creatures only react to shouts unless they are deaf at the time or a special variable is set on them. This should be a simple case of REPLACE_TEXTUALLY, only that's never simple.

COPY_EXISTING ~SHOUT.BCS~ ~override~
DECOMPILE_AND_PATCH BEGIN
REPLACE_TEXTUALLY CASE_INSENSITIVE ~^Heard~ ~Global("JTOAD","LOCALS",0)
!CheckSpellState(Myself,DEAFENED)
Heard~
END

There is a ^ in front of Heard to avoid the LastHeardBy trigger. I have also tried \bHeard and putting EXACT_MATCH in conditions, but decided to remove that in case it made the replacement too picky about spaces in the BCS. Any way I do it, nothing happens. What is the secret of eternal life, Brian?

Link to comment
COPY_EXISTING ~shout.bcs~ ~override~
	DECOMPILE_AND_PATCH BEGIN
		REPLACE_TEXTUALLY ~Heard(~ ~Global("JTOAD","LOCALS",0) !CheckSpellState(Myself,DEAFENED) Heard(~
	END
^ - matches at beginning of line (weidu readme)
Edited by tipun
Link to comment

DECOMPILE_AND_PATCH indents the decompiled text, similar to how near infinity displays it, so it won't be the beginning of the line.  This is the first block of SHOUT.BCS during a DECOMPILE_AND_PATCH:

IF
  OR(2)
    StateCheck(Myself,STATE_STONE_DEATH)
    StateCheck(Myself,STATE_FROZEN_DEATH)
THEN
  RESPONSE #100
    SmallWait(5)
END

 

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...