#------------------------------------------------------------------------------#
# Msgbox_p searcher #
# Author: Fflo #
# Date: July 9th, 2019 #
# #
# Searches any msgbox_p forgotten in your events #
# Advice: comment the whole script when you've removed all msgbox_p #
#------------------------------------------------------------------------------#

#------------------------------------------------------------------------------#
# Usage: #
# Free to use for personal and commercial projects #
# Credit would be appreciated #
#------------------------------------------------------------------------------#

def searchMsgbox
lang = "EN" # If you wish to change the texts to French, replace "EN" by "FR"
dir = "Data"
x = Dir.select{|m| m.match(/Map{3}/)}

x.each do |f|
map = File.read(f)
s = map.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
hasMatch = s.match(/msgbox_p\(.+\)/i)
if (hasMatch) # Is there a msgbox_p left in the map?
lang == "FR" ?
msgbox_p("Attention, msgbox_p() laissé dans map #{f}. Indiqué #{hasMatch}") :
msgbox_p("Warning, msgbox_p() left in map #{f}. Written #{hasMatch}")
end
end
end

searchMsgbox # Calls the method when the game is launched