Jump to content

Weidu Q: read text from file, and if match, then do X


subtledoctor

Recommended Posts

Pretty much what it says on the tin. This question has such universal terms ("read" "text" "file") that it is defeating my Google-fu, so I come to you in supplication.

 

Specifically: I would like to read from baldur.ini, check to see whether the string ~'Cleric Ranger Spells', '0'~ exists, and then take a certain action if it does and a different action if it doesn't.

 

Like, can I

TEXT_SPRINT %rcspells% ~'Cleric Ranger Spells',    '0'~
COPY + ~%USER_DIRECTORY%/Baldur.ini~ ~override~
   [umm, maybe SET a %boolean value% to check for the presence of %rcspells%...?]
   BUT_ONLY
ACTION_IF [%boolean value%] = true THEN BEGIN
   [yadda yadda]
END
ACTION_IF [%boolean value% = false] THEN BEGIN
   [yadda yadda]
END

Possible?

Link to comment

Yes, this is possible. COPY + is a very bad idea - maybe you were thinking of COPY - ?

 

COPY - ~%USER_DIRECTORY%/Baldur.ini~ ~%USER_DIRECTORY%~
  COUNT_REGEXP_INSTANCES ~'Cleric Ranger Spells',[ %TAB%]*'1'~ cr_bugfix_enabled

ACTION_IF (cr_bugfix_enabled) BEGIN // no druid spells for cleric/rangers

END
ELSE BEGIN

END
Link to comment

Archived

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

×
×
  • Create New...