Author Topic: [Req] New command for replacing text in LUA and MENU files (like R_B_B)  (Read 1037 times)

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
We need something similar to REPLACE_BCS_BLOCK but for LUA and MENU files format. Let's say I want to replace this code:

Code: [Select]
--This code is different if we're sod or BG
local lineCount = 1
local fullStr = Infinity_FetchString(entryId)
for line in string.gmatch(fullStr, "[^\r\n]+") do
if(lineCount == 1) then
--objective text is first line.
objective.text = line
end
if(lineCount > 1) then
--entry text is everything after first
entry.text = entry.text .. line .. "\n"
end
lineCount = lineCount + 1
end
if(lineCount == 2) then
--it looks like sometimes entries are just an unbroken paragraph
--in this case the entry should get the paragraph and the objective gets nothing
--note lineCount == 2 is a bit misleading, there's only one line in this case.
entry.text = objective.text
objective.text = Infinity_FetchString(quest.text)
end

Doing it with REPLACE_TEXTUALLY would be insane. And that's just a small portion of the file. Some GUI mods needs to replace hundreds of lines at once. Due to this problem all GUI mods are incompatible with one another because they always overwrites whole files rather than replacing part of text within these files. Perfectly the function should work exactly the same as R_B_B, so with ON_MISMATCH and ignoring blank lines and tabs when finding the match.
« Last Edit: May 09, 2016, 04:24:37 PM by K4thos »

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Scripts are not de facto well-defined bytecode, unlike BCS. The tools for editing scripts you are looking for are diff and patch. WeiDU has some undocumented diff/patch stuff targeted at BCS. I'm not familiar with the code. I try to look it over and get back to you.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: