I was given this script a while ago to change the word specified in the script to another word of EVERY message box in the editor.
Here is the script:
# Define the input and output strings.
INPUT = "Elna"
OUTPUT = "Alyssa"
#===============================================================================
count = 0
Dir.entries('Data').each {|filename|
if filename =~ /Map[\d]+\.rxdata/
changed = false
map = load_data("Data/#{filename}")
map.events.each_key {|key|
event = map.events[key]
event.pages.each_index {|i|
page = event.pages[i]
page.list.each_index {|j|
cmd = page.list[j]
next unless [101, 401].include?(cmd.code)
if event.pages[i].list[j].parameters[0].include?(INPUT)
count += 1
event.pages[i].list[j].parameters[0].gsub!(INPUT) { OUTPUT }
map.events[key] = event
changed = true
end
}
}
if changed
File.open("Data/#{filename}", 'wb') {|file| Marshal.dump(map, file) }
end
}
end
}
if count == 0
print "No event script calls found with matching string."
else
print "Found and replaced #{count} occurences of input string.\n" +
"Make sure to close and reload your project in order for the effects " +
"take place. DO NOT SAVE THE GAME when closing or nothing will change."
end
exit
I want to request a similar script or maybe just an edit that changes every ":" sign letter to ":\b" and
also puts "\b" in the start of the message box.
So this message box:
Quote
Eilzie: This is a random message box.
should change to:
Quote
\bEilzie:\b This is a random message box.
It'll look like this in game:
Quote
Eilzie: This is a random message box.
Save a copy of your game before using this.
This kind of codes can be highly destructive.
#===============================================================================
count = 0
Dir.entries('Data').each {|filename|
if filename =~ /Map[\d]+\.rxdata/
changed = false
map = load_data("Data/#{filename}")
map.events.each_key {|key|
event = map.events[key]
event.pages.each_index {|i|
page = event.pages[i]
page.list.each_index {|j|
cmd = page.list[j]
next unless cmd.code == 101
count += 1
event.pages[i].list[j].parameters[0].insert(0, "\\b")
if event.pages[i].list[j].parameters[0].include?(":")
event.pages[i].list[j].parameters[0].gsub!(":") { ":\\b" }
map.events[key] = event
changed = true
end
}
}
if changed
File.open("Data/#{filename}", 'wb') {|file| Marshal.dump(map, file) }
end
}
end
}
if count == 0
print "No event script calls found with matching string."
else
print "Found and replaced #{count} occurences of input string.\n" +
"Make sure to close and reload your project in order for the effects " +
"take place. DO NOT SAVE THE GAME when closing or nothing will change."
end
exit
Oh thank you! :) I'll try it out later when I can
I tried it out but I can't figure out how to make it work. It always states the script is hangning.
Try this mark, it's because theres way too many maps/events. If the game doesn't get a graphics update every so often, it'll assume a script is hanging.
#===============================================================================
count = 0
Dir.entries('Data').each {|filename|
Graphics.update
if filename =~ /Map[\d]+\.rxdata/
changed = false
map = load_data("Data/#{filename}")
map.events.each_key {|key|
Graphics.update
event = map.events[key]
event.pages.each_index {|i|
Graphics.update
page = event.pages[i]
page.list.each_index {|j|
cmd = page.list[j]
next unless cmd.code == 101
count += 1
event.pages[i].list[j].parameters[0].insert(0, "\\b")
if event.pages[i].list[j].parameters[0].include?(":")
event.pages[i].list[j].parameters[0].gsub!(":") { ":\\b" }
map.events[key] = event
changed = true
end
}
}
if changed
File.open("Data/#{filename}", 'wb') {|file| Marshal.dump(map, file) }
end
}
end
}
if count == 0
print "No event script calls found with matching string."
else
print "Found and replaced #{count} occurences of input string.\n" +
"Make sure to close and reload your project in order for the effects " +
"take place. DO NOT SAVE THE GAME when closing or nothing will change."
end
exit
@GG: It only gives me a black box :(
(the game acts as if frozen)
How long did you let it run for? It's definitely working for sure though, on a new project with one event.
You're right. I tested it in a new project and it worked. I guess it's just because the script has a lot of things to work with. Almost every single message box has ":" in it.
I'll just let it work for a while more and report if something happens, but nothing seems to happen for now.
EDIT: Yes, the script was working. It replaced 15074 lines :xD:
Thanks so much for the help :)